• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

Revisiond3617764e73ce9a1b69c5e44b7fc8d802412304e (tree)
Time2016-10-07 06:18:02
AuthorJaap Jan Meijer <jjmeijer88@gmai...>
CommiterJaap Jan Meijer

Log Message

Revert "Add preference for enabling root access (3/3)"

This reverts commit d63634d986ba81140c3ee5fa169adfe9ecf5976e.

Change Summary

Incremental Difference

--- a/res/values/cm_arrays.xml
+++ /dev/null
@@ -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>
--- a/res/values/cm_strings.xml
+++ /dev/null
@@ -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>
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -99,13 +99,6 @@
9999 <intent android:action="com.android.settings.action.DEMO_MODE" />
100100 </PreferenceScreen>
101101
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-
109102 <PreferenceCategory android:key="debug_debugging_category"
110103 android:title="@string/debug_debugging_category">
111104
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -189,9 +189,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
189189
190190 private static final String INACTIVE_APPS_KEY = "inactive_apps";
191191
192- private static final String ROOT_ACCESS_KEY = "root_access";
193- private static final String ROOT_ACCESS_PROPERTY = "persist.sys.root_access";
194-
195192 private static final String IMMEDIATELY_DESTROY_ACTIVITIES_KEY
196193 = "immediately_destroy_activities";
197194 private static final String APP_PROCESS_LIMIT_KEY = "app_process_limit";
@@ -301,10 +298,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
301298
302299 private SwitchPreference mColorTemperaturePreference;
303300
304- private PreferenceScreen mProcessStats;
305- private ListPreference mRootAccess;
306- private Object mSelectedRootValue;
307-
308301 private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
309302
310303 private final ArrayList<SwitchPreference> mResetSwitchPrefs
@@ -318,7 +311,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
318311
319312 private Dialog mAdbKeysDialog;
320313 private boolean mUnavailable;
321- private Dialog mRootDialog;
322314
323315 public DevelopmentSettings() {
324316 super(UserManager.DISALLOW_DEBUGGING_FEATURES);
@@ -497,12 +489,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
497489 removePreference(COLOR_TEMPERATURE_KEY);
498490 mColorTemperaturePreference = null;
499491 }
500-
501- mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY);
502- mRootAccess.setOnPreferenceChangeListener(this);
503- if (!removeRootOptionsIfRequired()) {
504- mAllPrefs.add(mRootAccess);
505- }
506492 }
507493
508494 private ListPreference addListPreference(String prefKey) {
@@ -529,18 +515,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
529515 return pref;
530516 }
531517
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-
544518 @Override
545519 public void onActivityCreated(Bundle savedInstanceState) {
546520 super.onActivityCreated(savedInstanceState);
@@ -731,7 +705,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
731705 updateColorTemperature();
732706 }
733707 updateBluetoothDisableAbsVolumeOptions();
734- updateRootAccessOptions();
735708 }
736709
737710 private void resetDangerousOptions() {
@@ -745,7 +718,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
745718 }
746719 resetDebuggerOptions();
747720 writeLogdSizeOption(null);
748- resetRootAccessOptions();
749721 writeAnimationScaleOption(0, mWindowAnimationScale, null);
750722 writeAnimationScaleOption(1, mTransitionAnimationScale, null);
751723 writeAnimationScaleOption(2, mAnimatorDurationScale, null);
@@ -813,40 +785,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
813785 }
814786 }
815787
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-
850788 private void updateHdcpValues() {
851789 ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY);
852790 if (hdcpChecking != null) {
@@ -2040,25 +1978,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
20401978 } else if (preference == mSimulateColorSpace) {
20411979 writeSimulateColorSpace(newValue);
20421980 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;
20621981 }
20631982 return false;
20641983 }
@@ -2076,10 +1995,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
20761995 mEnableDialog.dismiss();
20771996 mEnableDialog = null;
20781997 }
2079- if (mRootDialog != null) {
2080- mRootDialog.dismiss();
2081- mRootDialog = null;
2082- }
20831998 }
20841999
20852000 public void onClick(DialogInterface dialog, int which) {
@@ -2116,13 +2031,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
21162031 // Reset the toggle
21172032 mSwitchBar.setChecked(false);
21182033 }
2119- } else if (dialog == mRootDialog) {
2120- if (which == DialogInterface.BUTTON_POSITIVE) {
2121- writeRootAccessOptions(mSelectedRootValue);
2122- } else {
2123- // Reset the option
2124- writeRootAccessOptions("0");
2125- }
21262034 }
21272035 }
21282036