Prevent root tasks if no root access
This commit is contained in:
parent
742055c43b
commit
cadab12737
@ -144,8 +144,12 @@ public class MainActivity extends AppCompatActivity
|
||||
Menu menu = navigationView.getMenu();
|
||||
menu.findItem(R.id.magiskhide).setVisible(StatusFragment.magiskVersion > 0 &&
|
||||
prefs.getBoolean("magiskhide", false) && Shell.rootAccess());
|
||||
menu.findItem(R.id.modules).setVisible(StatusFragment.magiskVersion > 0);
|
||||
menu.findItem(R.id.downloads).setVisible(StatusFragment.magiskVersion > 0);
|
||||
menu.findItem(R.id.modules).setVisible(StatusFragment.magiskVersion > 0 &&
|
||||
Shell.rootAccess());
|
||||
menu.findItem(R.id.downloads).setVisible(StatusFragment.magiskVersion > 0 &&
|
||||
Shell.rootAccess());
|
||||
menu.findItem(R.id.log).setVisible(Shell.rootAccess());
|
||||
menu.findItem(R.id.install).setVisible(Shell.rootAccess());
|
||||
}
|
||||
|
||||
public void navigate(final int itemId) {
|
||||
|
@ -36,6 +36,7 @@ public class Async {
|
||||
public abstract static class RootTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
|
||||
@SafeVarargs
|
||||
public final void exec(Params... params) {
|
||||
if (!Shell.rootAccess()) return;
|
||||
executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, params);
|
||||
}
|
||||
}
|
||||
@ -126,7 +127,6 @@ public class Async {
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
if (! Shell.rootAccess()) return null;
|
||||
MagiskHideFragment.hideList.clear();
|
||||
MagiskHideFragment.fListApps.clear();
|
||||
MagiskHideFragment.listApps = pm.getInstalledApplications(PackageManager.GET_META_DATA);
|
||||
@ -240,7 +240,6 @@ public class Async {
|
||||
return -1;
|
||||
}
|
||||
if (!unzipAndCheck()) return 0;
|
||||
if (Shell.rootAccess()) {
|
||||
publishProgress(mContext.getString(R.string.zip_install_progress_msg, mFilename));
|
||||
ret = Shell.su(
|
||||
"BOOTMODE=true sh " + mCachedFile.getParent() +
|
||||
@ -255,12 +254,6 @@ public class Async {
|
||||
"rm -rf " + mCachedFile.getParent() + "/*",
|
||||
"rm -rf " + TMP_FOLDER_PATH
|
||||
);
|
||||
} else {
|
||||
if (mCachedFile != null && mCachedFile.exists() && !mCachedFile.delete()) {
|
||||
Utils.removeItem(mCachedFile.getPath());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (Boolean.parseBoolean(ret.get(ret.size() - 1))) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -74,11 +74,7 @@ public class Utils {
|
||||
public static List<String> getModList(String path) {
|
||||
List<String> ret;
|
||||
String command = "find " + path + " -type d -maxdepth 1 ! -name \"*.core\" ! -name \"*lost+found\" ! -name \"*magisk\"";
|
||||
if (Shell.rootAccess()) {
|
||||
ret = Shell.su(command);
|
||||
} else {
|
||||
ret = Shell.sh(command);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user