(SHIFT) Revert "Add toggle to enable ADB root"
This reverts commit 7e11a02a6bf4452e04e8d4032043b54f69beab98.
Change-Id: Ib5c325d6f3e42487eba8477d0c1f4be98d4a59f7
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 160d81d..19c1209 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -137,13 +137,6 @@
android:title="@string/enable_adb"
android:summary="@string/enable_adb_summary" />
- <SwitchPreference
- android:key="enable_adb_root"
- android:title="@string/adb_enable_root"
- android:summary="@string/adb_enable_summary_root"
- android:dependency="enable_adb"
- android:persistent="false" />
-
<Preference android:key="clear_adb_keys"
android:title="@string/clear_adb_keys" />
diff --git a/src/com/android/settings/development/AdbRootPreferenceController.java b/src/com/android/settings/development/AdbRootPreferenceController.java
deleted file mode 100644
index 54f249e..0000000
--- a/src/com/android/settings/development/AdbRootPreferenceController.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2018 The LineageOS 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.
- */
-
-package com.android.settings.development;
-
-import android.adb.ADBRootService;
-import android.content.Context;
-import android.os.UserManager;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-
-import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class AdbRootPreferenceController extends DeveloperOptionsPreferenceController
- implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
-
- private static final String TAG = "AdbRootPreferenceController";
- private static final String PREF_KEY = "enable_adb_root";
-
- private final ADBRootService mADBRootService;
-
- public AdbRootPreferenceController(Context context,
- DevelopmentSettingsDashboardFragment fragment) {
- super(context);
-
- mADBRootService = new ADBRootService();
- }
-
- @Override
- public String getPreferenceKey() {
- return PREF_KEY;
- }
-
- @Override
- public boolean isAvailable() {
- return mADBRootService.isSupported();
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
-
- ((SwitchPreference) mPreference).setChecked(mADBRootService.getEnabled());
-
- if (!isAdminUser()) {
- mPreference.setEnabled(false);
- }
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean rootEnabled = (Boolean) newValue;
- mADBRootService.setEnabled(rootEnabled);
- return true;
- }
-
- @Override
- protected void onDeveloperOptionsSwitchEnabled() {
- if (isAdminUser()) {
- mPreference.setEnabled(true);
- }
- }
-
- boolean isAdminUser() {
- return ((UserManager) mContext.getSystemService(Context.USER_SERVICE)).isAdminUser();
- }
-}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 704f4d8..60c4a0f 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -525,7 +525,6 @@
controllers.add(new DisableAutomaticUpdatesPreferenceController(context));
controllers.add(new SelectDSUPreferenceController(context));
controllers.add(new AdbPreferenceController(context, fragment));
- controllers.add(new AdbRootPreferenceController(context, fragment));
controllers.add(new ClearAdbKeysPreferenceController(context, fragment));
controllers.add(new WirelessDebuggingPreferenceController(context, lifecycle));
controllers.add(new AdbAuthorizationTimeoutPreferenceController(context));