diff --git a/app/src/main/java/com/topjohnwu/magisk/Global.java b/app/src/main/java/com/topjohnwu/magisk/Global.java index 3da2bfa65..127cda8b6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/Global.java +++ b/app/src/main/java/com/topjohnwu/magisk/Global.java @@ -56,6 +56,7 @@ public class Global { public static boolean isDarkTheme; public static boolean shellLogging; public static boolean devLogging; + public static boolean magiskHide; public static int suRequestTimeout; public static int suLogTimeout = 14; public static int suAccessState; @@ -68,13 +69,14 @@ public class Global { Configs.isDarkTheme = prefs.getBoolean("dark_theme", false); Configs.devLogging = prefs.getBoolean("developer_logging", false); Configs.shellLogging = prefs.getBoolean("shell_logging", false); + Configs.magiskHide = prefs.getBoolean("magiskhide", false); updateMagiskInfo(); initSuAccess(); initSuConfigs(context); // Initialize prefs prefs.edit() .putBoolean("dark_theme", Configs.isDarkTheme) - .putBoolean("magiskhide", Utils.itemExist(false, "/magisk/.core/magiskhide/enable")) + .putBoolean("magiskhide", Configs.magiskHide) .putBoolean("busybox", Utils.commandExists("busybox")) .putBoolean("hosts", Utils.itemExist(false, "/magisk/.core/hosts")) .putString("su_request_timeout", String.valueOf(Configs.suRequestTimeout)) diff --git a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java index 9fcce6e85..993fd685f 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java @@ -95,10 +95,6 @@ public class SettingsActivity extends AppCompatActivity { setSummary(); - CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox"); - CheckBoxPreference magiskhidePreference = (CheckBoxPreference) findPreference("magiskhide"); - SwitchPreference hostsPreference = (SwitchPreference) findPreference("hosts"); - findPreference("clear").setOnPreferenceClickListener((pref) -> { ModuleHelper.clearRepoCache(getActivity()); return true; @@ -108,16 +104,10 @@ public class SettingsActivity extends AppCompatActivity { prefScreen.removePreference(magiskCategory); prefScreen.removePreference(suCategory); } else { - if (!Global.Info.isSuClient) { + if (!Global.Info.isSuClient) prefScreen.removePreference(suCategory); - } - if (Global.Info.magiskVersion < 9) { - hostsPreference.setEnabled(false); - busyboxPreference.setEnabled(false); - } - if (Global.Info.magiskVersion < 8) { - magiskhidePreference.setEnabled(false); - } + if (Global.Info.magiskVersion < 11) + prefScreen.removePreference(magiskCategory); } } @@ -149,20 +139,10 @@ public class SettingsActivity extends AppCompatActivity { break; case "magiskhide": enabled = prefs.getBoolean("magiskhide", false); - new Async.RootTask() { - private boolean enable = enabled; - @Override - protected Void doInBackground(Void... params) { - if (enable) { - Utils.createFile("/magisk/.core/magiskhide/enable"); - } else { - Utils.removeItem("/magisk/.core/magiskhide/enable"); - } - - return null; - } - }.exec(); - Toast.makeText(getActivity(), R.string.settings_reboot_toast, Toast.LENGTH_LONG).show(); + if (enabled) + new Async.MagiskHide().enable(); + else + new Async.MagiskHide().disable(); break; case "busybox": enabled = prefs.getBoolean("busybox", false); @@ -170,11 +150,10 @@ public class SettingsActivity extends AppCompatActivity { private boolean enable = enabled; @Override protected Void doInBackground(Void... params) { - if (enable) { + if (enable) Utils.createFile("/magisk/.core/busybox/enable"); - } else { + else Utils.removeItem("/magisk/.core/busybox/enable"); - } return null; } }.exec(); diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java b/app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java index 87a0bb28e..009dc641a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java @@ -76,8 +76,11 @@ public class ApplicationAdapter extends RecyclerView.Adapter - Snackbar.make(holder.itemView, R.string.safetyNet_hide_notice, Snackbar.LENGTH_LONG).show()); + holder.itemView.setOnClickListener(v -> { + Snackbar snackbar = Snackbar.make(holder.itemView, R.string.safetyNet_hide_notice, Snackbar.LENGTH_LONG); + ((TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text)).setMaxLines(2); + snackbar.show(); + }); } else { holder.checkBox.setEnabled(true); holder.checkBox.setChecked(mHideList.contains(info.packageName)); diff --git a/app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java b/app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java index 327210889..308af0fa8 100644 --- a/app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java +++ b/app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java @@ -3,12 +3,22 @@ package com.topjohnwu.magisk.receivers; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import android.widget.Toast; import com.topjohnwu.magisk.Global; +import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.utils.Async; public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Global.initSuAccess(); + if (prefs.getBoolean("magiskhide", false)) { + Toast.makeText(context, R.string.start_magiskhide, Toast.LENGTH_SHORT).show(); + new Async.MagiskHide().enable(); + } } } diff --git a/app/src/main/java/com/topjohnwu/magisk/superuser/RequestActivity.java b/app/src/main/java/com/topjohnwu/magisk/superuser/RequestActivity.java index b5b934159..dd7d7bd8b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/superuser/RequestActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/superuser/RequestActivity.java @@ -12,13 +12,13 @@ public class RequestActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Global.initSuConfigs(this); - Intent intent = getIntent(); if (intent == null) { finish(); return; } + + Global.initSuConfigs(this); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClass(this, SuRequestActivity.class); startActivity(intent); diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Async.java b/app/src/main/java/com/topjohnwu/magisk/utils/Async.java index 047417c00..95d5d7e23 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Async.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Async.java @@ -293,18 +293,25 @@ public class Async { public static class MagiskHide extends RootTask { @Override protected Void doInBackground(Object... params) { - boolean add = (boolean) params[0]; - String packageName = (String) params[1]; - Shell.su(MAGISK_HIDE_PATH + (add ? "add " : "rm ") + packageName); + String command = (String) params[0]; + Shell.su(MAGISK_HIDE_PATH + command); return null; } public void add(CharSequence packageName) { - exec(true, packageName); + exec("add " + packageName); } public void rm(CharSequence packageName) { - exec(false, packageName); + exec("rm " + packageName); + } + + public void enable() { + exec("enable"); + } + + public void disable() { + exec("disable"); } } diff --git a/app/src/main/res/drawable/ic_send.xml b/app/src/main/res/drawable/ic_send.xml deleted file mode 100644 index a55465776..000000000 --- a/app/src/main/res/drawable/ic_send.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index b81d59243..87702a526 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -39,7 +39,6 @@ حفظ إلى بطاقة ذاكرة SD - إرسال إعادة تحميل حذف السجل الآن تم حذف السجل بنجاح @@ -86,7 +85,6 @@ السمة أختر سمة - تمكين إخفاء Magisk إخفاء Magisk من مختلف حالات الإكتشاف تمكين BusyBox ربط تحميل Magisk\'s المدمج في busybox إلى xbin diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 1ee67d8cc..f9c841425 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -65,7 +65,6 @@ Auf SD-Karte speichern - Senden Erneut laden Log löschen Log erfolgreich gelöscht @@ -126,7 +125,6 @@ Repo-Cache löschen Löscht die zwischengespeicherten Informtionen der Online-Repos. Erzwingt eine Aktualisierung - Magisk Hide aktivieren Versteckt Magisk vor diversen Entdeckungsmethoden\nErfordert einen Neustart BusyBox aktivieren Magisk\'s integriertes BusyBox nach xbin mounten\nErfordert einen Neustart diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index ad1eeb3e9..d0f692e99 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -39,7 +39,6 @@ Salvar a SD - Enviar Recargar Vaciar Log ahora Log vaciado correctamente @@ -83,7 +82,6 @@ Tema Selecciona un tema - Habilitar Magisk Hide Ocultar Magisk de varias detecciones Habilitar BusyBox Montar el busybox interno de Magisk en xbin diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 582c39b98..1ce8057f7 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -37,7 +37,6 @@ Salva nella SD - Invia Ricarica Cancella log Log creato con successo diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index ab39135ad..efae14cf6 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -37,7 +37,6 @@ Opslaan op SD-kaart - Verzenden Herladen Maak log leeg Log succesvol geleegd @@ -89,7 +88,6 @@ Schakel dit in voor uitgebreidere logging. Shell command debug loggin Schakel dit in om alle shell commands en output te loggen - Magisk verbergen Reboot om de instellingen toe te passen diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index bafa6fe70..fab2fe44a 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -65,7 +65,6 @@ Zapisz na SD - Wyślij Załaduj ponownie Wyczyść Log Log wyczyszczony @@ -126,7 +125,6 @@ Wyczyść Cache Repozytorium Wyczyść cache dla repozytorium, wymusza odświeżenie online przez aplikację - Włącz Magisk Hide Włącz Hide Magisk dla wykrytych aplikacji Włącz BusyBox Bind mount Magisk\'s built-in busybox to xbin diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 09346eb83..321d9d6a7 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -59,7 +59,6 @@ Salvar no SD - Enviar Recarregar Limpar registro agora Registro limpado com sucesso @@ -110,7 +109,6 @@ Tema Escolha um tema - Ativar Magisk Hide Ocultar Magisk de várias detecções Ativar BusyBox Monta a busybox interna do Magisk\'s para xbin diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2668398ff..3c0be8406 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -57,7 +57,6 @@ 保存到 SD 卡 - 发送 重载 清除日志 日志已成功清除 @@ -107,7 +106,6 @@ 主题 选择一个主题 - 启用 Magisk 隐藏 隐藏 Magisk 使其不被多种方法检测到 启用 BusyBox 将 Magisk 内置的 Busybox 挂载到 xbin diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ce408bffb..aedbef4f6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -65,7 +65,6 @@ Save to SD - Send Reload Clear log now Log successfully cleared @@ -114,6 +113,7 @@ Check release notes Repo cache cleared This app uses SafetyNet\nAlready handled by MagiskHide by default + Starting MagiskHide … https://api.github.com/orgs/Magisk-Modules-Repo/repos @@ -127,8 +127,7 @@ Clear Repo Cache Clear the cached information for online repos, forces the app to refresh online - Enable Magisk Hide - Hide Magisk from various detections\nRequires reboot + Hide Magisk from various detections Enable BusyBox Bind mount Magisk\'s built-in busybox to xbin\nRequires reboot Systemless hosts diff --git a/app/src/main/res/xml/app_settings.xml b/app/src/main/res/xml/app_settings.xml index 7352dad71..0cb9c9a60 100644 --- a/app/src/main/res/xml/app_settings.xml +++ b/app/src/main/res/xml/app_settings.xml @@ -21,18 +21,18 @@ android:key="magisk" android:title="@string/magisk"> - - + +