diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 95388009d..8786b884b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -53,6 +53,12 @@
+
+
+
+
+
+
repoMap = new ValueSortedMap<>();
@@ -60,12 +59,8 @@ public class Global {
Configs.isDarkTheme = prefs.getBoolean("dark_theme", false);
Configs.devLogging = prefs.getBoolean("developer_logging", false);
Configs.shellLogging = prefs.getBoolean("shell_logging", false);
- List ret = Shell.sh("su -v");
- if (Utils.isValidShellResponse(ret)) {
- Info.suVersion = ret.get(0);
- Info.isSuClient = Info.suVersion.toUpperCase().contains("MAGISK");
- }
updateMagiskInfo();
+ initSuAccess();
initSuConfigs(context);
// Initialize prefs
prefs.edit()
@@ -82,19 +77,26 @@ public class Global {
public static void initSuConfigs(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- List ret = Shell.sh("getprop persist.sys.root_access");
- if (Utils.isValidShellResponse(ret))
- Configs.suAccessState = Integer.parseInt(ret.get(0));
- else {
- Shell.su("setprop persist.sys.root_access 3");
- Configs.suAccessState = 3;
- }
Configs.suRequestTimeout = Utils.getPrefsInt(prefs, "su_request_timeout", 10);
Configs.suResponseType = Utils.getPrefsInt(prefs, "su_auto_response", 0);
Configs.suNotificationType = Utils.getPrefsInt(prefs, "su_notification", 1);
- ret = Shell.sh("id -u shell");
- if (Utils.isValidShellResponse(ret))
- Info.shellUid = Integer.parseInt(ret.get(0));
+ }
+
+ public static void initSuAccess() {
+ List ret = Shell.sh("su -v");
+ if (Utils.isValidShellResponse(ret)) {
+ Info.suVersion = ret.get(0);
+ Info.isSuClient = Info.suVersion.toUpperCase().contains("MAGISK");
+ }
+ if (Info.isSuClient) {
+ ret = Shell.sh("getprop persist.sys.root_access");
+ if (Utils.isValidShellResponse(ret))
+ Configs.suAccessState = Integer.parseInt(ret.get(0));
+ else {
+ Shell.su("setprop persist.sys.root_access 3");
+ Configs.suAccessState = 3;
+ }
+ }
}
static void updateMagiskInfo() {
diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java b/app/src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java
index 44d3d1dec..683500a07 100644
--- a/app/src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java
+++ b/app/src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java
@@ -156,7 +156,6 @@ public class MagiskLogFragment extends Fragment {
return "";
case 2:
- case 3:
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
@@ -221,17 +220,6 @@ public class MagiskLogFragment extends Fragment {
else
Toast.makeText(getActivity(), getString(R.string.logs_save_failed), Toast.LENGTH_LONG).show();
break;
- case 3:
- bool = (boolean) o;
- if (bool) {
- Intent sendIntent = new Intent();
- sendIntent.setAction(Intent.ACTION_SEND);
- sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(targetFile));
- sendIntent.setType("application/html");
- startActivity(Intent.createChooser(sendIntent, getResources().getString(R.string.menuSend)));
- } else {
- Toast.makeText(getActivity(), getString(R.string.logs_save_failed), Toast.LENGTH_LONG).show();
- }
}
}
@@ -246,10 +234,6 @@ public class MagiskLogFragment extends Fragment {
public void save() {
exec(2);
}
-
- public void send() {
- exec(3);
- }
}
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java b/app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java
new file mode 100644
index 000000000..327210889
--- /dev/null
+++ b/app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java
@@ -0,0 +1,14 @@
+package com.topjohnwu.magisk.receivers;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.topjohnwu.magisk.Global;
+
+public class BootReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Global.initSuAccess();
+ }
+}