Network Reset should have a lockdown like Factory Reset.
bug:20332322
Change-Id: I645ad0d226869042c11225630e4de5968ebb7a0d
(cherry picked from commit 176f512c5a
)
This commit is contained in:
39
res/layout/network_reset_disallowed_screen.xml
Normal file
39
res/layout/network_reset_disallowed_screen.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/listContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:drawSelectorOnTop="false"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:background="@android:color/white"
|
||||
android:cacheColorHint="@android:color/white"
|
||||
android:fadingEdgeLength="16dip" />
|
||||
|
||||
<TextView android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/network_reset_not_available"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</FrameLayout>
|
@@ -2557,6 +2557,8 @@
|
||||
<string name="reset_network_final_button_text">Reset settings</string>
|
||||
<!-- Reset settings confirmation screen title [CHAR LIMIT=30] -->
|
||||
<string name="reset_network_confirm_title">Reset?</string>
|
||||
<!-- Error message for users that aren't allowed to reset network settings [CHAR LIMIT=none] -->
|
||||
<string name="network_reset_not_available">Network reset is not available for this user</string>
|
||||
<!-- Reset settings complete toast text [CHAR LIMIT=75] -->
|
||||
<string name="reset_network_complete_toast">Network settings have been reset</string>
|
||||
|
||||
@@ -5860,6 +5862,7 @@
|
||||
<string name="keywords_voice_input">recognizer input speech speak language hands-free hand free recognition offensive word audio history bluetooth headset</string>
|
||||
<string name="keywords_text_to_speech_output">rate language default speak speaking tts accessibility reader blind</string>
|
||||
<string name="keywords_date_and_time">clock military</string>
|
||||
<string name="keywords_network_reset">reset restore factory</string>
|
||||
<string name="keywords_factory_data_reset">wipe delete restore clear remove</string>
|
||||
<string name="keywords_printing">printer</string>
|
||||
<string name="keywords_sounds_and_notifications">speaker beep</string>
|
||||
|
@@ -48,7 +48,9 @@
|
||||
|
||||
<!-- Network reset -->
|
||||
<PreferenceScreen
|
||||
android:key="network_reset"
|
||||
android:title="@string/reset_network_title"
|
||||
settings:keywords="@string/keywords_network_reset"
|
||||
android:fragment="com.android.settings.ResetNetwork" />
|
||||
|
||||
<!-- Factory reset -->
|
||||
|
@@ -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