Java Code Examples for android.os.ServiceManager#getServiceOrThrow()

The following examples show how to use android.os.ServiceManager#getServiceOrThrow() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public WifiScanner createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_SCANNING_SERVICE);
    IWifiScanner service = IWifiScanner.Stub.asInterface(b);
    return new WifiScanner(ctx.getOuterContext(), service,
            ConnectivityThread.getInstanceLooper());
}
 
Example 2
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public WifiAwareManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_AWARE_SERVICE);
    IWifiAwareManager service = IWifiAwareManager.Stub.asInterface(b);
    if (service == null) {
        return null;
    }
    return new WifiAwareManager(ctx.getOuterContext(), service);
}
 
Example 3
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public FingerprintManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    final IBinder binder;
    if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.O) {
        binder = ServiceManager.getServiceOrThrow(Context.FINGERPRINT_SERVICE);
    } else {
        binder = ServiceManager.getService(Context.FINGERPRINT_SERVICE);
    }
    IFingerprintService service = IFingerprintService.Stub.asInterface(binder);
    return new FingerprintManager(ctx.getOuterContext(), service);
}
 
Example 4
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public WifiManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_SERVICE);
    IWifiManager service = IWifiManager.Stub.asInterface(b);
    return new WifiManager(ctx.getOuterContext(), service,
            ConnectivityThread.getInstanceLooper());
}
 
Example 5
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public LowpanManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.LOWPAN_SERVICE);
    ILowpanManager service = ILowpanManager.Stub.asInterface(b);
    return new LowpanManager(ctx.getOuterContext(), service,
            ConnectivityThread.getInstanceLooper());
}
 
Example 6
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public CrossProfileApps createService(ContextImpl ctx)
        throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(
            Context.CROSS_PROFILE_APPS_SERVICE);
    return new CrossProfileApps(ctx.getOuterContext(),
            ICrossProfileApps.Stub.asInterface(b));
}
 
Example 7
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public PersistentDataBlockManager createService() throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.PERSISTENT_DATA_BLOCK_SERVICE);
    IPersistentDataBlockService persistentDataBlockService =
            IPersistentDataBlockService.Stub.asInterface(b);
    if (persistentDataBlockService != null) {
        return new PersistentDataBlockManager(persistentDataBlockService);
    } else {
        // not supported
        return null;
    }
}
 
Example 8
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public PowerManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.POWER_SERVICE);
    IPowerManager service = IPowerManager.Stub.asInterface(b);
    return new PowerManager(ctx.getOuterContext(),
            service, ctx.mMainThread.getHandler());
}
 
Example 9
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public SystemUpdateManager createService(ContextImpl ctx)
        throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(
            Context.SYSTEM_UPDATE_SERVICE);
    ISystemUpdateManager service = ISystemUpdateManager.Stub.asInterface(b);
    return new SystemUpdateManager(service);
}
 
Example 10
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public RecoverySystem createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.RECOVERY_SERVICE);
    IRecoverySystem service = IRecoverySystem.Stub.asInterface(b);
    return new RecoverySystem(service);
}
 
Example 11
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public SerialManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.SERIAL_SERVICE);
    return new SerialManager(ctx, ISerialManager.Stub.asInterface(b));
}
 
Example 12
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public TrustManager createService() throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.TRUST_SERVICE);
    return new TrustManager(b);
}
 
Example 13
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public AccountManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.ACCOUNT_SERVICE);
    IAccountManager service = IAccountManager.Stub.asInterface(b);
    return new AccountManager(ctx, service);
}
 
Example 14
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public VrManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.VR_SERVICE);
    return new VrManager(IVrManager.Stub.asInterface(b));
}
 
Example 15
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public LocationManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.LOCATION_SERVICE);
    return new LocationManager(ctx, ILocationManager.Stub.asInterface(b));
}
 
Example 16
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public DevicePolicyManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.DEVICE_POLICY_SERVICE);
    return new DevicePolicyManager(ctx, IDevicePolicyManager.Stub.asInterface(b));
}
 
Example 17
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public SystemHealthManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(BatteryStats.SERVICE_NAME);
    return new SystemHealthManager(IBatteryStats.Stub.asInterface(b));
}
 
Example 18
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public AppOpsManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.APP_OPS_SERVICE);
    IAppOpsService service = IAppOpsService.Stub.asInterface(b);
    return new AppOpsManager(ctx, service);
}
 
Example 19
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public HdmiControlManager createService() throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.HDMI_CONTROL_SERVICE);
    return new HdmiControlManager(IHdmiControlService.Stub.asInterface(b));
}
 
Example 20
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public AppWidgetManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(Context.APPWIDGET_SERVICE);
    return new AppWidgetManager(ctx, IAppWidgetService.Stub.asInterface(b));
}