diff --git a/app/build.gradle b/app/build.gradle index 465b4b6bd..773866914 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,7 +20,7 @@ android { } compileOptions { - incremental false + incremental true } buildTypes { @@ -34,7 +34,7 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } dexOptions { - preDexLibraries = false + preDexLibraries = true } externalNativeBuild { cmake { diff --git a/app/src/main/java/com/topjohnwu/magisk/Global.java b/app/src/main/java/com/topjohnwu/magisk/Global.java index 6c9cf9a55..15c7afb3c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/Global.java +++ b/app/src/main/java/com/topjohnwu/magisk/Global.java @@ -69,6 +69,7 @@ public class Global { initSuConfigs(context); // Initialize prefs prefs.edit() + .putBoolean("dark_theme", Configs.isDarkTheme) .putBoolean("magiskhide", Utils.itemExist(false, "/magisk/.core/magiskhide/enable")) .putBoolean("busybox", Utils.commandExists("busybox")) .putBoolean("hosts", Utils.itemExist(false, "/magisk/.core/hosts")) diff --git a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java index 31f056f8e..09d2f72ee 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java @@ -3,7 +3,9 @@ package com.topjohnwu.magisk; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.CheckBoxPreference; +import android.preference.ListPreference; import android.preference.Preference; +import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; @@ -79,25 +81,42 @@ public class SettingsActivity extends AppCompatActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.app_settings); - PreferenceManager.setDefaultValues(getActivity(), R.xml.app_settings, false); prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); prefScreen = getPreferenceScreen(); + PreferenceCategory magiskCategory = (PreferenceCategory) findPreference("magisk"); + PreferenceCategory suCategory = (PreferenceCategory) findPreference("superuser"); + + ListPreference suAccess = (ListPreference) findPreference("su_access"); + ListPreference autoRes = (ListPreference) findPreference("su_auto_response"); + ListPreference requestTimeout = (ListPreference) findPreference("su_request_timeout"); + ListPreference suNotification = (ListPreference) findPreference("su_notification"); + + suAccess.setSummary(getResources() + .getStringArray(R.array.su_access)[Utils.getPrefsInt(prefs, "su_access", 3)]); + autoRes.setSummary(getResources() + .getStringArray(R.array.auto_response)[Utils.getPrefsInt(prefs, "su_auto_response", 0)]); + suNotification.setSummary(getResources() + .getStringArray(R.array.su_notification)[Utils.getPrefsInt(prefs, "su_notification", 1)]); + requestTimeout.setSummary( + getString(R.string.request_timeout_summary, prefs.getString("su_request_timeout", "10"))); + CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox"); CheckBoxPreference magiskhidePreference = (CheckBoxPreference) findPreference("magiskhide"); SwitchPreference hostsPreference = (SwitchPreference) findPreference("hosts"); - Preference clear = findPreference("clear"); - clear.setOnPreferenceClickListener((pref) -> { + findPreference("clear").setOnPreferenceClickListener((pref) -> { ModuleHelper.clearRepoCache(getActivity()); return true; }); if (!Shell.rootAccess()) { - busyboxPreference.setEnabled(false); - magiskhidePreference.setEnabled(false); - hostsPreference.setEnabled(false); + prefScreen.removePreference(magiskCategory); + prefScreen.removePreference(suCategory); } else { + if (!Global.Info.isSuClient) { + prefScreen.removePreference(suCategory); + } if (Global.Info.magiskVersion < 9) { hostsPreference.setEnabled(false); busyboxPreference.setEnabled(false); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index af92f13cd..c809a3965 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -130,8 +130,8 @@ Hide Magisk from various detections\nRequires reboot Enable BusyBox Bind mount Magisk\'s built-in busybox to xbin\nRequires reboot - Enable systemless hosts - Systemless support for Adblock apps + Systemless hosts + Systemless hosts support for Adblock apps Apps and ADB Apps only @@ -141,6 +141,11 @@ 20 seconds 30 seconds 60 seconds + Superuser Access + Automatic Response + Request Timeout + Superuser Notification + %1$s seconds App Development Enable advanced debug logging diff --git a/app/src/main/res/xml/app_settings.xml b/app/src/main/res/xml/app_settings.xml index 762d15f4b..7352dad71 100644 --- a/app/src/main/res/xml/app_settings.xml +++ b/app/src/main/res/xml/app_settings.xml @@ -18,6 +18,7 @@ diff --git a/gradle.properties b/gradle.properties index 4aa88fce4..6feb37555 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,8 @@ org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryErr # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true + +# When set to true the Gradle daemon is used to run the build. For local developer builds this is our favorite property. +# The developer environment is optimized for speed and feedback so we nearly always run Gradle jobs with the daemon. +org.gradle.daemon=true \ No newline at end of file