Loading src/com/android/settings/fuelgauge/BatteryHistoryPreference.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class BatteryHistoryPreference extends Preference { BatteryInfo.getBatteryInfo(getContext(), info -> { mBatteryInfo = info; notifyChanged(); }, batteryStats.getStats(), false); }, batteryStats, false); } public void setBottomSummary(CharSequence text) { Loading src/com/android/settings/fuelgauge/BatteryInfo.java +16 −15 Original line number Diff line number Diff line Loading @@ -134,31 +134,32 @@ public class BatteryInfo { } public static void getBatteryInfo(final Context context, final Callback callback) { BatteryInfo.getBatteryInfo(context, callback, false /* shortString */); BatteryInfo.getBatteryInfo(context, callback, null /* statsHelper */, false /* shortString */); } public static void getBatteryInfo(final Context context, final Callback callback, boolean shortString) { final long startTime = System.currentTimeMillis(); BatteryStatsHelper statsHelper = new BatteryStatsHelper(context, true); statsHelper.create((Bundle) null); BatteryUtils.logRuntime(LOG_TAG, "time to make batteryStatsHelper", startTime); BatteryInfo.getBatteryInfo(context, callback, statsHelper, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, BatteryStatsHelper statsHelper, boolean shortString) { final long startTime = System.currentTimeMillis(); BatteryStats stats = statsHelper.getStats(); BatteryUtils.logRuntime(LOG_TAG, "time for getStats", startTime); getBatteryInfo(context, callback, stats, shortString); BatteryInfo.getBatteryInfo(context, callback, null /* statsHelper */, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, BatteryStats stats, boolean shortString) { final BatteryStatsHelper statsHelper, boolean shortString) { new AsyncTask<Void, Void, BatteryInfo>() { @Override protected BatteryInfo doInBackground(Void... params) { final BatteryStats stats; final long batteryStatsTime = System.currentTimeMillis(); if (statsHelper == null) { final BatteryStatsHelper localStatsHelper = new BatteryStatsHelper(context, true); localStatsHelper.create((Bundle) null); stats = localStatsHelper.getStats(); } else { stats = statsHelper.getStats(); } BatteryUtils.logRuntime(LOG_TAG, "time for getStats", batteryStatsTime); final long startTime = System.currentTimeMillis(); PowerUsageFeatureProvider provider = FeatureFactory.getFactory(context).getPowerUsageFeatureProvider(context); Loading Loading
src/com/android/settings/fuelgauge/BatteryHistoryPreference.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class BatteryHistoryPreference extends Preference { BatteryInfo.getBatteryInfo(getContext(), info -> { mBatteryInfo = info; notifyChanged(); }, batteryStats.getStats(), false); }, batteryStats, false); } public void setBottomSummary(CharSequence text) { Loading
src/com/android/settings/fuelgauge/BatteryInfo.java +16 −15 Original line number Diff line number Diff line Loading @@ -134,31 +134,32 @@ public class BatteryInfo { } public static void getBatteryInfo(final Context context, final Callback callback) { BatteryInfo.getBatteryInfo(context, callback, false /* shortString */); BatteryInfo.getBatteryInfo(context, callback, null /* statsHelper */, false /* shortString */); } public static void getBatteryInfo(final Context context, final Callback callback, boolean shortString) { final long startTime = System.currentTimeMillis(); BatteryStatsHelper statsHelper = new BatteryStatsHelper(context, true); statsHelper.create((Bundle) null); BatteryUtils.logRuntime(LOG_TAG, "time to make batteryStatsHelper", startTime); BatteryInfo.getBatteryInfo(context, callback, statsHelper, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, BatteryStatsHelper statsHelper, boolean shortString) { final long startTime = System.currentTimeMillis(); BatteryStats stats = statsHelper.getStats(); BatteryUtils.logRuntime(LOG_TAG, "time for getStats", startTime); getBatteryInfo(context, callback, stats, shortString); BatteryInfo.getBatteryInfo(context, callback, null /* statsHelper */, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, BatteryStats stats, boolean shortString) { final BatteryStatsHelper statsHelper, boolean shortString) { new AsyncTask<Void, Void, BatteryInfo>() { @Override protected BatteryInfo doInBackground(Void... params) { final BatteryStats stats; final long batteryStatsTime = System.currentTimeMillis(); if (statsHelper == null) { final BatteryStatsHelper localStatsHelper = new BatteryStatsHelper(context, true); localStatsHelper.create((Bundle) null); stats = localStatsHelper.getStats(); } else { stats = statsHelper.getStats(); } BatteryUtils.logRuntime(LOG_TAG, "time for getStats", batteryStatsTime); final long startTime = System.currentTimeMillis(); PowerUsageFeatureProvider provider = FeatureFactory.getFactory(context).getPowerUsageFeatureProvider(context); Loading