Fix testcase error and UI refresh issue
Restricted App list can be update in RestrictedAppDetails page and go back to SmartBatterySettings page without update the App list. We need to update the list in updateState() again. Fixes: 140585454 Test: manual, robolectric Change-Id: I48a197351ffb9b07490f1de7ba1f7417102458a2
This commit is contained in:
@@ -63,10 +63,15 @@ public class RestrictAppPreferenceController extends BasePreferenceController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
mAppInfos = BatteryTipUtils.getRestrictedAppsList(mAppOpsManager, mUserManager);
|
||||
final int num = mAppInfos.size();
|
||||
return mContext.getResources().getQuantityString(R.plurals.restricted_app_summary, num,
|
||||
num);
|
||||
// Fragment change RestrictedAppsList after onPause(), UI needs to be updated in onResume()
|
||||
preference.setVisible(num > 0);
|
||||
preference.setSummary(
|
||||
mContext.getResources().getQuantityString(R.plurals.restricted_app_summary, num,
|
||||
num));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user