DO NOT MERGE - Allow FR in carrier demo mode
Bug: 34341567 Test: manual - in carrier demo mode, go to Settings > Backup and Reset > Factory data reset > Reset phone > Erase everything and this entire path is viewable. Change-Id: I373a2e94f205f6e6e4dd9a54dcf08532a64e5187
This commit is contained in:
@@ -286,11 +286,13 @@ public class MasterClear extends OptionsMenuFragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
final EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(
|
final Context context = getContext();
|
||||||
getActivity(), UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
|
final EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(context,
|
||||||
final UserManager um = UserManager.get(getActivity());
|
UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
|
||||||
if (!um.isAdminUser() || RestrictedLockUtils.hasBaseUserRestriction(getActivity(),
|
final UserManager um = UserManager.get(context);
|
||||||
UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
|
final boolean disallow = !um.isAdminUser() || RestrictedLockUtils.hasBaseUserRestriction(
|
||||||
|
context, UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
|
||||||
|
if (disallow && !Utils.isCarrierDemoUser(context)) {
|
||||||
return inflater.inflate(R.layout.master_clear_disallowed_screen, null);
|
return inflater.inflate(R.layout.master_clear_disallowed_screen, null);
|
||||||
} else if (admin != null) {
|
} else if (admin != null) {
|
||||||
View view = inflater.inflate(R.layout.admin_support_details_empty_view, null);
|
View view = inflater.inflate(R.layout.admin_support_details_empty_view, null);
|
||||||
|
@@ -1134,7 +1134,8 @@ public class SettingsActivity extends SettingsDrawerActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTileEnabled(new ComponentName(packageName,
|
setTileEnabled(new ComponentName(packageName,
|
||||||
BackupSettingsActivity.class.getName()), hasBackupActivity, isAdmin, pm);
|
BackupSettingsActivity.class.getName()), hasBackupActivity,
|
||||||
|
isAdmin || Utils.isCarrierDemoUser(this), pm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1207,4 +1207,13 @@ public final class Utils extends com.android.settingslib.Utils {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isCarrierDemoUser(Context context) {
|
||||||
|
final String carrierDemoModeSetting =
|
||||||
|
context.getString(com.android.internal.R.string.config_carrierDemoModeSetting);
|
||||||
|
return UserManager.isDeviceInDemoMode(context)
|
||||||
|
&& getUserManager(context).isDemoUser()
|
||||||
|
&& !TextUtils.isEmpty(carrierDemoModeSetting)
|
||||||
|
&& Settings.Secure.getInt(context.getContentResolver(), carrierDemoModeSetting, 0) == 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user