Not show time information in battery optimization page when opened from
Settings -> Apps Test: make RunSettingsRoboTests + manual Bug: 265130434 Change-Id: Ie7ae6a97041f490e81adbe8e0c530799e09a7c66
This commit is contained in:
@@ -121,11 +121,11 @@ public class AppBatteryPreferenceController extends BasePreferenceController
|
||||
Log.i(TAG, "handlePreferenceTreeClick():\n" + mBatteryDiffEntry);
|
||||
AdvancedPowerUsageDetail.startBatteryDetailPage(
|
||||
mParent.getActivity(),
|
||||
mParent,
|
||||
mParent.getMetricsCategory(),
|
||||
mBatteryDiffEntry,
|
||||
Utils.formatPercentage(
|
||||
mBatteryDiffEntry.getPercentOfTotal(), /* round */ true),
|
||||
/*slotInformation=*/ null);
|
||||
/*slotInformation=*/ null, /*showTimeInformation=*/ false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -139,13 +139,15 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
Activity caller, InstrumentedPreferenceFragment fragment,
|
||||
BatteryDiffEntry diffEntry, String usagePercent, String slotInformation) {
|
||||
startBatteryDetailPage(
|
||||
caller, fragment.getMetricsCategory(), diffEntry, usagePercent, slotInformation);
|
||||
caller, fragment.getMetricsCategory(), diffEntry, usagePercent, slotInformation,
|
||||
/*showTimeInformation=*/ true);
|
||||
}
|
||||
|
||||
/** Launches battery details page for an individual battery consumer fragment. */
|
||||
public static void startBatteryDetailPage(
|
||||
Context context, int sourceMetricsCategory,
|
||||
BatteryDiffEntry diffEntry, String usagePercent, String slotInformation) {
|
||||
BatteryDiffEntry diffEntry, String usagePercent, String slotInformation,
|
||||
boolean showTimeInformation) {
|
||||
final BatteryHistEntry histEntry = diffEntry.mBatteryHistEntry;
|
||||
final LaunchBatteryDetailPageArgs launchArgs = new LaunchBatteryDetailPageArgs();
|
||||
// configure the launch argument.
|
||||
@@ -156,9 +158,11 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
launchArgs.mUid = (int) histEntry.mUid;
|
||||
launchArgs.mIconId = diffEntry.getAppIconId();
|
||||
launchArgs.mConsumedPower = (int) diffEntry.mConsumePower;
|
||||
launchArgs.mForegroundTimeMs = diffEntry.mForegroundUsageTimeInMs;
|
||||
launchArgs.mBackgroundTimeMs = diffEntry.mBackgroundUsageTimeInMs;
|
||||
launchArgs.mScreenOnTimeMs = diffEntry.mScreenOnTimeInMs;
|
||||
if (showTimeInformation) {
|
||||
launchArgs.mForegroundTimeMs = diffEntry.mForegroundUsageTimeInMs;
|
||||
launchArgs.mBackgroundTimeMs = diffEntry.mBackgroundUsageTimeInMs;
|
||||
launchArgs.mScreenOnTimeMs = diffEntry.mScreenOnTimeInMs;
|
||||
}
|
||||
launchArgs.mIsUserEntry = histEntry.isUserEntry();
|
||||
startBatteryDetailPage(context, sourceMetricsCategory, launchArgs);
|
||||
}
|
||||
|
@@ -126,6 +126,7 @@ private class AppBatteryPresenter(private val context: Context, private val app:
|
||||
this,
|
||||
Utils.formatPercentage(percentOfTotal, true),
|
||||
null,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -162,6 +162,7 @@ class AppBatteryPreferenceTest {
|
||||
batteryDiffEntry,
|
||||
"10%",
|
||||
null,
|
||||
false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user