android.os.health.SystemHealthManager Java Examples

The following examples show how to use android.os.health.SystemHealthManager. 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: BatteryDataStatsAggregator.java    From bitgatt with Mozilla Public License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.N)
BatteryDataStatsAggregator(@Nullable Context context) {
    if (context != null && BuildConfig.BUILD_TYPE.equals("batteryDataTest") && FitbitGatt.atLeastSDK(Build.VERSION_CODES.N)) {
        healthManager = (SystemHealthManager) context.getSystemService(Context.SYSTEM_HEALTH_SERVICE);
        mainHandler = new Handler(Looper.getMainLooper());
        mainHandler.postDelayed(this::snapshotAndLogMetrics, SNAPSHOT_INTERVAL);
    }
}
 
Example #2
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 #3
Source File: HealthStatsMetricsCollector.java    From Battery-Metrics with MIT License 4 votes vote down vote up
public HealthStatsMetricsCollector(Context context) {
  mSystemHealthManager =
      (SystemHealthManager) context.getSystemService(Context.SYSTEM_HEALTH_SERVICE);
}