Hide preference when no app restricted

Change-Id: I37135bce5354ce7380441f86f94cb79d89cc500c
Fixes: 77799629
Test: RunSettingsRoboTests
This commit is contained in:
Lei Yu
2018-04-09 11:25:31 -07:00
parent 78e2cad8b1
commit 9d2c7e822b
2 changed files with 6 additions and 5 deletions

View File

@@ -72,8 +72,8 @@ public class RestrictAppPreferenceController extends BasePreferenceController {
mAppInfos = BatteryTipUtils.getRestrictedAppsList(mAppOpsManager, mUserManager);
final int num = mAppInfos.size();
// Enable the preference if some apps already been restricted, otherwise disable it
preference.setEnabled(num > 0);
// Don't show it if no app been restricted
preference.setVisible(num > 0);
preference.setSummary(
mContext.getResources().getQuantityString(R.plurals.restricted_app_summary, num,
num));