Network Reset should have a lockdown like Factory Reset.
bug:20332322
Change-Id: I645ad0d226869042c11225630e4de5968ebb7a0d
(cherry picked from commit 176f512c5a)
This commit is contained in:
@@ -54,6 +54,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index
|
||||
private static final String AUTO_RESTORE = "auto_restore";
|
||||
private static final String CONFIGURE_ACCOUNT = "configure_account";
|
||||
private static final String BACKUP_INACTIVE = "backup_inactive";
|
||||
private static final String NETWORK_RESET = "network_reset";
|
||||
private static final String FACTORY_RESET = "factory_reset";
|
||||
private static final String TAG = "PrivacySettings";
|
||||
private IBackupManager mBackupManager;
|
||||
@@ -244,5 +245,9 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index
|
||||
UserManager.DISALLOW_FACTORY_RESET)) {
|
||||
nonVisibleKeys.add(FACTORY_RESET);
|
||||
}
|
||||
if (UserManager.get(context).hasUserRestriction(
|
||||
UserManager.DISALLOW_NETWORK_RESET)) {
|
||||
nonVisibleKeys.add(NETWORK_RESET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Process;
|
||||
import android.os.UserManager;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
@@ -191,6 +192,12 @@ public class ResetNetwork extends InstrumentedFragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (!Process.myUserHandle().isOwner()
|
||||
|| UserManager.get(getActivity()).hasUserRestriction(
|
||||
UserManager.DISALLOW_NETWORK_RESET)) {
|
||||
return inflater.inflate(R.layout.network_reset_disallowed_screen, null);
|
||||
}
|
||||
|
||||
mContentView = inflater.inflate(R.layout.reset_network, null);
|
||||
|
||||
establishInitialState();
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.net.ConnectivityManager;
|
||||
import android.net.NetworkPolicyManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -108,6 +109,10 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (UserManager.get(getActivity()).hasUserRestriction(
|
||||
UserManager.DISALLOW_NETWORK_RESET)) {
|
||||
return inflater.inflate(R.layout.network_reset_disallowed_screen, null);
|
||||
}
|
||||
mContentView = inflater.inflate(R.layout.reset_network_confirm, null);
|
||||
establishFinalConfirmationState();
|
||||
return mContentView;
|
||||
|
||||
Reference in New Issue
Block a user