Don't show Restrictions item if it has been disabled for the user.
Also don't show actual Restrictions content if the fragment was launched through a different entry point. Change-Id: I70cb76ca6f68a382e68219053e6f69e7f1fa0150
This commit is contained in:
@@ -488,7 +488,8 @@ public class Settings extends PreferenceActivity
|
||||
target.remove(i);
|
||||
}
|
||||
} else if (id == R.id.restriction_settings) {
|
||||
if (um.isLinkedUser()) {
|
||||
if (um.isLinkedUser()
|
||||
|| um.hasUserRestriction(UserManager.DISALLOW_APP_RESTRICTIONS)) {
|
||||
target.remove(i);
|
||||
}
|
||||
}
|
||||
|
@@ -46,10 +46,15 @@ public class RestrictionSettings extends AppRestrictionsFragment {
|
||||
|
||||
private boolean mChallengeSucceeded;
|
||||
private boolean mChallengeRequested;
|
||||
private boolean mDisableSelf;
|
||||
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (UserManager.get(getActivity()).hasUserRestriction(
|
||||
UserManager.DISALLOW_APP_RESTRICTIONS)) {
|
||||
mDisableSelf = true;
|
||||
return;
|
||||
}
|
||||
init(icicle);
|
||||
if (icicle != null) {
|
||||
mChallengeSucceeded = icicle.getBoolean(KEY_CHALLENGE_SUCCEEDED, false);
|
||||
@@ -60,8 +65,10 @@ public class RestrictionSettings extends AppRestrictionsFragment {
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (!mDisableSelf) {
|
||||
ensurePin();
|
||||
}
|
||||
}
|
||||
|
||||
private void ensurePin() {
|
||||
if (!mChallengeSucceeded) {
|
||||
@@ -122,9 +129,10 @@ public class RestrictionSettings extends AppRestrictionsFragment {
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
if (!mDisableSelf) {
|
||||
menu.add(0, MENU_RESET, 0, R.string.restriction_menu_reset);
|
||||
menu.add(0, MENU_CHANGE_PIN, 0, R.string.restriction_menu_change_pin);
|
||||
|
||||
}
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user