am 18d44684: am 0b2781ae: Write restriction bundle right away for required apps.

* commit '18d44684d3d384cc1eed114808c3870c7738e352':
  Write restriction bundle right away for required apps.
This commit is contained in:
Amith Yamasani
2013-05-21 18:20:36 -07:00
committed by Android Git Automerger

View File

@@ -607,6 +607,11 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
p.setImmutable(true); p.setImmutable(true);
// If the app is required and has no restrictions, skip showing it // If the app is required and has no restrictions, skip showing it
if (!hasSettings && !isSettingsApp) continue; if (!hasSettings && !isSettingsApp) continue;
// Get and populate the defaults, since the user is not going to be
// able to toggle this app ON (it's ON by default and immutable).
if (hasSettings) {
requestRestrictionsForApp(packageName, p);
}
} else if (!mNewUser && appInfoListHasPackage(mUserApps, packageName)) { } else if (!mNewUser && appInfoListHasPackage(mUserApps, packageName)) {
p.setChecked(true); p.setChecked(true);
} }
@@ -896,6 +901,12 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
} }
} }
preference.setRestrictions(restrictions); preference.setRestrictions(restrictions);
if (count == 1 // No visible restrictions
&& preference.isImmutable()
&& preference.isChecked()) {
// Special case of required app with no visible restrictions. Remove it
mAppList.removePreference(preference);
}
} }
/** /**
@@ -1001,7 +1012,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
mSavedPhoto, drawable); mSavedPhoto, drawable);
mEditUserInfoDialog = new AlertDialog.Builder(getActivity()) mEditUserInfoDialog = new AlertDialog.Builder(getActivity())
.setTitle(R.string.user_info_settings_title) .setTitle(R.string.profile_info_settings_title)
.setIconAttribute(R.drawable.ic_settings_multiuser) .setIconAttribute(R.drawable.ic_settings_multiuser)
.setView(content) .setView(content)
.setCancelable(true) .setCancelable(true)