packages/apps/Settings
Revision | d3617764e73ce9a1b69c5e44b7fc8d802412304e (tree) |
---|---|
Zeit | 2016-10-07 06:18:02 |
Autor | Jaap Jan Meijer <jjmeijer88@gmai...> |
Commiter | Jaap Jan Meijer |
Revert "Add preference for enabling root access (3/3)"
This reverts commit d63634d986ba81140c3ee5fa169adfe9ecf5976e.
@@ -1,32 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8"?> | |
2 | -<!-- | |
3 | -Copyright (C) 2012-2014 The CyanogenMod Project | |
4 | - | |
5 | -Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -you may not use this file except in compliance with the License. | |
7 | -You may obtain a copy of the License at | |
8 | - | |
9 | - http://www.apache.org/licenses/LICENSE-2.0 | |
10 | - | |
11 | -Unless required by applicable law or agreed to in writing, software | |
12 | -distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -See the License for the specific language governing permissions and | |
15 | -limitations under the License. | |
16 | ---> | |
17 | -<resources> | |
18 | - <!-- Arrays for root access capability --> | |
19 | - <string-array name="root_access_entries"> | |
20 | - <item>@string/root_access_none</item> | |
21 | - <item>@string/root_access_apps</item> | |
22 | - <item>@string/root_access_adb</item> | |
23 | - <item>@string/root_access_all</item> | |
24 | - </string-array> | |
25 | - | |
26 | - <string-array name="root_access_values"> | |
27 | - <item>0</item> | |
28 | - <item>1</item> | |
29 | - <item>2</item> | |
30 | - <item>3</item> | |
31 | - </string-array> | |
32 | -</resources> |
@@ -1,26 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8"?> | |
2 | -<!-- | |
3 | - Copyright (C) 2012-2014 The CyanogenMod Project | |
4 | - | |
5 | - Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | - you may not use this file except in compliance with the License. | |
7 | - You may obtain a copy of the License at | |
8 | - | |
9 | - http://www.apache.org/licenses/LICENSE-2.0 | |
10 | - | |
11 | - Unless required by applicable law or agreed to in writing, software | |
12 | - distributed under the License is distributed on an "AS IS" BASIS, | |
13 | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | - See the License for the specific language governing permissions and | |
15 | - limitations under the License. | |
16 | ---> | |
17 | -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | |
18 | - <!-- Setting checkbox title for root access --> | |
19 | - <string name="root_access">Root access</string> | |
20 | - <string name="root_access_warning_title">Allow root access?</string> | |
21 | - <string name="root_access_warning_message">Allowing applications to request root access is very dangerous and could compromise the security of your system!</string> | |
22 | - <string name="root_access_none">Disabled</string> | |
23 | - <string name="root_access_apps">Apps only</string> | |
24 | - <string name="root_access_adb">ADB only</string> | |
25 | - <string name="root_access_all">Apps and ADB</string> | |
26 | -</resources> |
@@ -99,13 +99,6 @@ | ||
99 | 99 | <intent android:action="com.android.settings.action.DEMO_MODE" /> |
100 | 100 | </PreferenceScreen> |
101 | 101 | |
102 | - <ListPreference | |
103 | - android:key="root_access" | |
104 | - android:title="@string/root_access" | |
105 | - android:persistent="false" | |
106 | - android:entries="@array/root_access_entries" | |
107 | - android:entryValues="@array/root_access_values" /> | |
108 | - | |
109 | 102 | <PreferenceCategory android:key="debug_debugging_category" |
110 | 103 | android:title="@string/debug_debugging_category"> |
111 | 104 |
@@ -189,9 +189,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
189 | 189 | |
190 | 190 | private static final String INACTIVE_APPS_KEY = "inactive_apps"; |
191 | 191 | |
192 | - private static final String ROOT_ACCESS_KEY = "root_access"; | |
193 | - private static final String ROOT_ACCESS_PROPERTY = "persist.sys.root_access"; | |
194 | - | |
195 | 192 | private static final String IMMEDIATELY_DESTROY_ACTIVITIES_KEY |
196 | 193 | = "immediately_destroy_activities"; |
197 | 194 | private static final String APP_PROCESS_LIMIT_KEY = "app_process_limit"; |
@@ -301,10 +298,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
301 | 298 | |
302 | 299 | private SwitchPreference mColorTemperaturePreference; |
303 | 300 | |
304 | - private PreferenceScreen mProcessStats; | |
305 | - private ListPreference mRootAccess; | |
306 | - private Object mSelectedRootValue; | |
307 | - | |
308 | 301 | private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>(); |
309 | 302 | |
310 | 303 | private final ArrayList<SwitchPreference> mResetSwitchPrefs |
@@ -318,7 +311,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
318 | 311 | |
319 | 312 | private Dialog mAdbKeysDialog; |
320 | 313 | private boolean mUnavailable; |
321 | - private Dialog mRootDialog; | |
322 | 314 | |
323 | 315 | public DevelopmentSettings() { |
324 | 316 | super(UserManager.DISALLOW_DEBUGGING_FEATURES); |
@@ -497,12 +489,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
497 | 489 | removePreference(COLOR_TEMPERATURE_KEY); |
498 | 490 | mColorTemperaturePreference = null; |
499 | 491 | } |
500 | - | |
501 | - mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY); | |
502 | - mRootAccess.setOnPreferenceChangeListener(this); | |
503 | - if (!removeRootOptionsIfRequired()) { | |
504 | - mAllPrefs.add(mRootAccess); | |
505 | - } | |
506 | 492 | } |
507 | 493 | |
508 | 494 | private ListPreference addListPreference(String prefKey) { |
@@ -529,18 +515,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
529 | 515 | return pref; |
530 | 516 | } |
531 | 517 | |
532 | - private boolean removeRootOptionsIfRequired() { | |
533 | - // user builds don't get root, and eng always gets root | |
534 | - if (!(Build.IS_DEBUGGABLE || "eng".equals(Build.TYPE))) { | |
535 | - if (mRootAccess != null) { | |
536 | - getPreferenceScreen().removePreference(mRootAccess); | |
537 | - return true; | |
538 | - } | |
539 | - } | |
540 | - | |
541 | - return false; | |
542 | - } | |
543 | - | |
544 | 518 | @Override |
545 | 519 | public void onActivityCreated(Bundle savedInstanceState) { |
546 | 520 | super.onActivityCreated(savedInstanceState); |
@@ -731,7 +705,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
731 | 705 | updateColorTemperature(); |
732 | 706 | } |
733 | 707 | updateBluetoothDisableAbsVolumeOptions(); |
734 | - updateRootAccessOptions(); | |
735 | 708 | } |
736 | 709 | |
737 | 710 | private void resetDangerousOptions() { |
@@ -745,7 +718,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
745 | 718 | } |
746 | 719 | resetDebuggerOptions(); |
747 | 720 | writeLogdSizeOption(null); |
748 | - resetRootAccessOptions(); | |
749 | 721 | writeAnimationScaleOption(0, mWindowAnimationScale, null); |
750 | 722 | writeAnimationScaleOption(1, mTransitionAnimationScale, null); |
751 | 723 | writeAnimationScaleOption(2, mAnimatorDurationScale, null); |
@@ -813,40 +785,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
813 | 785 | } |
814 | 786 | } |
815 | 787 | |
816 | - private void updateRootAccessOptions() { | |
817 | - String value = SystemProperties.get(ROOT_ACCESS_PROPERTY, "1"); | |
818 | - mRootAccess.setValue(value); | |
819 | - mRootAccess.setSummary(getResources() | |
820 | - .getStringArray(R.array.root_access_entries)[Integer.valueOf(value)]); | |
821 | - } | |
822 | - | |
823 | - private void writeRootAccessOptions(Object newValue) { | |
824 | - String oldValue = SystemProperties.get(ROOT_ACCESS_PROPERTY, "1"); | |
825 | - SystemProperties.set(ROOT_ACCESS_PROPERTY, newValue.toString()); | |
826 | - if (Integer.valueOf(newValue.toString()) < 2 && !oldValue.equals(newValue) | |
827 | - && "1".equals(SystemProperties.get("service.adb.root", "0"))) { | |
828 | - SystemProperties.set("service.adb.root", "0"); | |
829 | - Settings.Secure.putInt(getActivity().getContentResolver(), | |
830 | - Settings.Secure.ADB_ENABLED, 0); | |
831 | - Settings.Secure.putInt(getActivity().getContentResolver(), | |
832 | - Settings.Secure.ADB_ENABLED, 1); | |
833 | - } | |
834 | - updateRootAccessOptions(); | |
835 | - } | |
836 | - | |
837 | - private void resetRootAccessOptions() { | |
838 | - String oldValue = SystemProperties.get(ROOT_ACCESS_PROPERTY, "1"); | |
839 | - SystemProperties.set(ROOT_ACCESS_PROPERTY, "1"); | |
840 | - if (!oldValue.equals("1") && "1".equals(SystemProperties.get("service.adb.root", "0"))) { | |
841 | - SystemProperties.set("service.adb.root", "0"); | |
842 | - Settings.Secure.putInt(getActivity().getContentResolver(), | |
843 | - Settings.Secure.ADB_ENABLED, 0); | |
844 | - Settings.Secure.putInt(getActivity().getContentResolver(), | |
845 | - Settings.Secure.ADB_ENABLED, 1); | |
846 | - } | |
847 | - updateRootAccessOptions(); | |
848 | - } | |
849 | - | |
850 | 788 | private void updateHdcpValues() { |
851 | 789 | ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY); |
852 | 790 | if (hdcpChecking != null) { |
@@ -2040,25 +1978,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
2040 | 1978 | } else if (preference == mSimulateColorSpace) { |
2041 | 1979 | writeSimulateColorSpace(newValue); |
2042 | 1980 | return true; |
2043 | - } else if (preference == mRootAccess) { | |
2044 | - if ("0".equals(SystemProperties.get(ROOT_ACCESS_PROPERTY, "1")) | |
2045 | - && !"0".equals(newValue)) { | |
2046 | - mSelectedRootValue = newValue; | |
2047 | - mDialogClicked = false; | |
2048 | - if (mRootDialog != null) { | |
2049 | - dismissDialogs(); | |
2050 | - } | |
2051 | - mRootDialog = new AlertDialog.Builder(getActivity()) | |
2052 | - .setMessage(getResources().getString(R.string.root_access_warning_message)) | |
2053 | - .setTitle(R.string.root_access_warning_title) | |
2054 | - .setIcon(android.R.drawable.ic_dialog_alert) | |
2055 | - .setPositiveButton(android.R.string.yes, this) | |
2056 | - .setNegativeButton(android.R.string.no, this).show(); | |
2057 | - mRootDialog.setOnDismissListener(this); | |
2058 | - } else { | |
2059 | - writeRootAccessOptions(newValue); | |
2060 | - } | |
2061 | - return true; | |
2062 | 1981 | } |
2063 | 1982 | return false; |
2064 | 1983 | } |
@@ -2076,10 +1995,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
2076 | 1995 | mEnableDialog.dismiss(); |
2077 | 1996 | mEnableDialog = null; |
2078 | 1997 | } |
2079 | - if (mRootDialog != null) { | |
2080 | - mRootDialog.dismiss(); | |
2081 | - mRootDialog = null; | |
2082 | - } | |
2083 | 1998 | } |
2084 | 1999 | |
2085 | 2000 | public void onClick(DialogInterface dialog, int which) { |
@@ -2116,13 +2031,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment | ||
2116 | 2031 | // Reset the toggle |
2117 | 2032 | mSwitchBar.setChecked(false); |
2118 | 2033 | } |
2119 | - } else if (dialog == mRootDialog) { | |
2120 | - if (which == DialogInterface.BUTTON_POSITIVE) { | |
2121 | - writeRootAccessOptions(mSelectedRootValue); | |
2122 | - } else { | |
2123 | - // Reset the option | |
2124 | - writeRootAccessOptions("0"); | |
2125 | - } | |
2126 | 2034 | } |
2127 | 2035 | } |
2128 | 2036 |