Skip to content
Permalink
Browse files
Properly remove root access under DevSettings
If magiskManager is installed, management is
done there, so remove root access and appops
preferences from Developer Settings

Change-Id: Id88d3db6495f858901f0370a27e17674da3a55b1
  • Loading branch information
eyosen committed Feb 11, 2017
1 parent 904cae7 commit 5f150830d61da30912b173902a2b0fc6bd59b276
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/com/android/settings/DevelopmentSettings.java
@@ -640,6 +640,25 @@ private SwitchPreference findAndInitSwitchPref(String key) {
}

private boolean removeRootOptionsIfRequired() {

// Magisk Manager
boolean magiskSupported = false;
try {
magiskSupported = (getPackageManager().getPackageInfo("com.topjohnwu.magisk", 0).versionCode > 0);
} catch (PackageManager.NameNotFoundException e) {
}

// if magisk is supported, management is done in MagiskManager.
// remove the root access and appops preferences
if (magiskSupported) {
if (mRootAccess != null) {
getPreferenceScreen().removePreference(mRootAccess);
}
if (mRootAppops != null) {
getPreferenceScreen().removePreference(mRootAppops);
}
return true;
}
// user builds don't get root, and eng always gets root
if (!(Build.IS_DEBUGGABLE || "eng".equals(Build.TYPE))) {
if (mRootAccess != null) {

0 comments on commit 5f15083

Please sign in to comment.