diff options
author | Adrian DC <radian.dc@gmail.com> | 2016-08-05 09:11:44 +0200 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2016-08-11 10:25:49 -0700 |
commit | 830a8464a067c022227344c95738bfe9e53fc526 (patch) | |
tree | 6e9fd11ae1f158864315df75118f9811ab8613f8 /src | |
parent | d47d2e4ff6972e262139f368a108ce8ac0b6577d (diff) | |
download | packages_apps_Settings-830a8464a067c022227344c95738bfe9e53fc526.zip packages_apps_Settings-830a8464a067c022227344c95738bfe9e53fc526.tar.gz packages_apps_Settings-830a8464a067c022227344c95738bfe9e53fc526.tar.bz2 |
Settings: Root appops access in developer settings
* Allow users to directly access the root app settings,
as the feature is mostly unknown and often a reason
for users to try using alternatives to CM root
* Use the appops extra intent to link the su tab,
introduced in I79d963ecbadc624dc45a398387a348691318b6be
Change-Id: Ia5bc9d56fb11700b19d73336fad13c0a936091ff
Signed-off-by: Adrian DC <radian.dc@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 5ae3b1b..3666212 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -79,6 +79,7 @@ import android.widget.TextView; import android.widget.Toast; import com.android.internal.logging.MetricsLogger; +import com.android.settings.Settings.AppOpsSummaryActivity; import com.android.settings.fuelgauge.InactiveApps; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; @@ -178,6 +179,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String ROOT_ACCESS_KEY = "root_access"; private static final String ROOT_ACCESS_PROPERTY = "persist.sys.root_access"; + private static final String ROOT_APPOPS_KEY = "root_appops"; + private static final String UPDATE_RECOVERY_KEY = "update_recovery"; private static final String UPDATE_RECOVERY_PROPERTY = "persist.sys.recovery_update"; @@ -292,6 +295,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private PreferenceScreen mDevelopmentTools; private ColorModePreference mColorModePreference; + private Preference mRootAppops; + private SwitchPreference mAdvancedReboot; private SwitchPreference mUpdateRecovery; @@ -477,6 +482,10 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY); mRootAccess.setOnPreferenceChangeListener(this); + + mRootAppops = (Preference) findPreference(ROOT_APPOPS_KEY); + mRootAppops.setOnPreferenceClickListener(this); + if (!removeRootOptionsIfRequired()) { if (isRootForAppsAvailable()) { mRootAccess.setEntries(R.array.root_access_entries); @@ -486,6 +495,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mRootAccess.setEntryValues(R.array.root_access_values_adb); } mAllPrefs.add(mRootAccess); + mAllPrefs.add(mRootAppops); } mDevelopmentTools = (PreferenceScreen) findPreference(DEVELOPMENT_TOOLS); @@ -841,6 +851,10 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mRootAccess.setValue(value); mRootAccess.setSummary(getResources() .getStringArray(R.array.root_access_entries)[Integer.valueOf(value)]); + + if (mRootAppops != null) { + mRootAppops.setEnabled(isRootForAppsEnabled()); + } } private boolean isRootForAppsAvailable() { @@ -1910,6 +1924,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment preference == mTransitionAnimationScale || preference == mAnimatorDurationScale) { ((AnimationScalePreference) preference).click(); + } else if (preference == mRootAppops) { + Activity mActivity = getActivity(); + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.putExtra("appops_tab", getString(R.string.app_ops_categories_su)); + intent.setClass(mActivity, AppOpsSummaryActivity.class); + mActivity.startActivity(intent); + return true; } return false; } |