Make time remaining estimate debug mode more reliable.
Previously, the long click handler was unregistered on first use and never re-registered. This meant that, e.g., on plugging and unplugging the phone, debug mode stopped working. This change moves long click activation into restartBatteryInfoLoader(). Bug: 63133793 Test: make RunSettingsRoboTests Change-Id: I4c25a1f05ab3718bf06faf455cf670b5460a7306
This commit is contained in:
@@ -231,13 +231,7 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
|
||||
initFeatureProvider();
|
||||
mBatteryLayoutPref = (LayoutPreference) findPreference(KEY_BATTERY_HEADER);
|
||||
View header = mBatteryLayoutPref.findViewById(R.id.summary1);
|
||||
// Unfortunately setting a long click listener on a means it will no longer pass the regular
|
||||
// click event to the parent, so we have to register a regular click listener as well.
|
||||
if (mPowerFeatureProvider.isEstimateDebugEnabled()) {
|
||||
header.setOnLongClickListener(this);
|
||||
header.setOnClickListener(this);
|
||||
}
|
||||
|
||||
mAppListGroup = (PreferenceGroup) findPreference(KEY_APP_LIST);
|
||||
mScreenUsagePref = (PowerGaugePreference) findPreference(KEY_SCREEN_USAGE);
|
||||
mLastFullChargePref = (PowerGaugePreference) findPreference(
|
||||
@@ -772,6 +766,14 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
void restartBatteryInfoLoader() {
|
||||
getLoaderManager().restartLoader(BATTERY_INFO_LOADER, Bundle.EMPTY,
|
||||
mBatteryInfoLoaderCallbacks);
|
||||
if (mPowerFeatureProvider.isEstimateDebugEnabled()) {
|
||||
// Unfortunately setting a long click listener on a view means it will no
|
||||
// longer pass the regular click event to the parent, so we have to register
|
||||
// a regular click listener as well.
|
||||
View header = mBatteryLayoutPref.findViewById(R.id.summary1);
|
||||
header.setOnLongClickListener(this);
|
||||
header.setOnClickListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<BatterySipper> getFakeStats() {
|
||||
|
Reference in New Issue
Block a user