Merge "Fix battery optimization display problems"
This commit is contained in:
@@ -1050,6 +1050,7 @@ public class ManageApplications extends InstrumentedFragment
|
|||||||
} else if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
|
} else if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
|
||||||
mExtraInfoBridge = new AppStateUsageBridge(mContext, mState, this);
|
mExtraInfoBridge = new AppStateUsageBridge(mContext, mState, this);
|
||||||
} else if (mManageApplications.mListType == LIST_TYPE_HIGH_POWER) {
|
} else if (mManageApplications.mListType == LIST_TYPE_HIGH_POWER) {
|
||||||
|
mBackend.refreshList();
|
||||||
mExtraInfoBridge = new AppStatePowerBridge(mContext, mState, this);
|
mExtraInfoBridge = new AppStatePowerBridge(mContext, mState, this);
|
||||||
} else if (mManageApplications.mListType == LIST_TYPE_OVERLAY) {
|
} else if (mManageApplications.mListType == LIST_TYPE_OVERLAY) {
|
||||||
mExtraInfoBridge = new AppStateOverlayBridge(mContext, mState, this);
|
mExtraInfoBridge = new AppStateOverlayBridge(mContext, mState, this);
|
||||||
|
@@ -69,6 +69,7 @@ public class BatteryOptimizationPreferenceController extends AbstractPreferenceC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
|
mBackend.refreshList();
|
||||||
final boolean isAllowlisted = mBackend.isAllowlisted(mPackageName);
|
final boolean isAllowlisted = mBackend.isAllowlisted(mPackageName);
|
||||||
preference.setSummary(isAllowlisted ? R.string.high_power_on : R.string.high_power_off);
|
preference.setSummary(isAllowlisted ? R.string.high_power_on : R.string.high_power_off);
|
||||||
}
|
}
|
||||||
|
@@ -112,6 +112,13 @@ public class BatteryOptimizationPreferenceControllerTest {
|
|||||||
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.high_power_off));
|
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.high_power_off));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateState_refreshList() {
|
||||||
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
|
verify(mBackend).refreshList();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create this test class so we could mock it
|
* Create this test class so we could mock it
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user