类android.os.health.SystemHealthManager源码实例Demo

下面列出了怎么用android.os.health.SystemHealthManager的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: bitgatt   文件: BatteryDataStatsAggregator.java
@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);
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: SystemServiceRegistry.java
@Override
public SystemHealthManager createService(ContextImpl ctx) throws ServiceNotFoundException {
    IBinder b = ServiceManager.getServiceOrThrow(BatteryStats.SERVICE_NAME);
    return new SystemHealthManager(IBatteryStats.Stub.asInterface(b));
}
 
public HealthStatsMetricsCollector(Context context) {
  mSystemHealthManager =
      (SystemHealthManager) context.getSystemService(Context.SYSTEM_HEALTH_SERVICE);
}
 
 类所在包
 类方法
 同包方法