Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e64e1b78 authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Automerger Merge Worker
Browse files

Merge "Use consistent Wifi-only checking" into sc-dev am: 9d060c9e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13424591

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2c07b541f59e935952f0e23ccb54e16bd058ce6d
parents 02c48b5b 9d060c9e
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.internal.os;

import android.content.Context;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.os.BatteryStats;
import android.os.BatteryUsageStats;
import android.os.BatteryUsageStatsQuery;
@@ -57,7 +56,7 @@ public class BatteryUsageStatsProvider {
                mPowerCalculators.add(new CpuPowerCalculator(mPowerProfile));
                mPowerCalculators.add(new MemoryPowerCalculator(mPowerProfile));
                mPowerCalculators.add(new WakelockPowerCalculator(mPowerProfile));
                if (!isWifiOnlyDevice(mContext)) {
                if (!BatteryStatsHelper.checkWifiOnly(mContext)) {
                    mPowerCalculators.add(new MobileRadioPowerCalculator(mPowerProfile));
                }
                mPowerCalculators.add(new WifiPowerCalculator(mPowerProfile));
@@ -81,14 +80,6 @@ public class BatteryUsageStatsProvider {
        return mPowerCalculators;
    }

    private static boolean isWifiOnlyDevice(Context context) {
        ConnectivityManager cm = context.getSystemService(ConnectivityManager.class);
        if (cm == null) {
            return false;
        }
        return !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
    }

    /**
     * Returns a snapshot of battery attribution data.
     */