diff --git a/app/build.gradle b/app/build.gradle index e859fd981..dfeba7aeb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion "24.0.2" + compileSdkVersion 25 + buildToolsVersion "25.0.1" defaultConfig { applicationId "com.topjohnwu.magisk" minSdkVersion 21 - targetSdkVersion 24 + targetSdkVersion 25 versionCode 7 versionName "2.5" jackOptions { @@ -19,8 +19,13 @@ android { } } + compileOptions { + incremental false + } + buildTypes { release { + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } @@ -44,11 +49,10 @@ repositories { dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:recyclerview-v7:24.2.1' - compile 'com.android.support:cardview-v7:24.2.1' - compile 'com.android.support:design:24.2.1' + compile 'com.android.support:recyclerview-v7:25.0.1' + compile 'com.android.support:cardview-v7:25.0.1' + compile 'com.android.support:design:25.0.1' compile 'com.jakewharton:butterknife:8.4.0' - compile 'com.github.michalis-vitos:aFileChooser:master' compile 'com.google.code.gson:gson:2.8.0' compile 'com.github.clans:fab:1.6.4' compile 'com.madgag.spongycastle:core:1.54.0.0' diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 124d5dc1f..d3890d692 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -15,3 +15,29 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} + +# Gson uses generic type information stored in a class file when working with fields. Proguard +# removes such information by default, so configure it to keep all of it. +-keepattributes Signature + +# For using GSON @Expose annotation +-keepattributes *Annotation* + +# Gson specific classes +-keep class sun.misc.Unsafe { *; } +-keep class com.google.gson.** { *; } + +# Application classes that will be serialized/deserialized over Gson +-keep class com.topjohnwu.magisk.module.** { *; } +-keep class com.topjohnwu.magisk.utils.ModuleHelper$ValueSortedMap { *; } + +# Prevent proguard from stripping interface information from TypeAdapterFactory, +# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) +-keep class * implements com.google.gson.TypeAdapterFactory +-keep class * implements com.google.gson.JsonSerializer +-keep class * implements com.google.gson.JsonDeserializer + +-keep class android.support.v7.internal.** { *; } +-keep interface android.support.v7.internal.** { *; } +-keep class android.support.v7.** { *; } +-keep interface android.support.v7.** { *; } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 23a5d85de..62787a159 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,8 +4,6 @@ xmlns:tools="http://schemas.android.com/tools"> - - @@ -36,33 +34,6 @@ - - - - - - - - - - - - - - - - { - Intent getContentIntent = FileUtils.createGetContentIntent(null); - getContentIntent.setType("application/zip"); - Intent fileIntent = Intent.createChooser(getContentIntent, "Select a file"); - startActivityForResult(fileIntent, FETCH_ZIP_CODE); + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("application/zip"); + startActivityForResult(intent, FETCH_ZIP_CODE); }); prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); @@ -80,7 +79,7 @@ public class ModulesFragment extends Fragment { @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (data != null) { + if (requestCode == FETCH_ZIP_CODE && resultCode == Activity.RESULT_OK && data != null) { // Get the URI of the selected file final Uri uri = data.getData(); new Async.FlashZIP(getActivity(), uri).exec(); diff --git a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java index 189f0daab..847693b75 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java @@ -69,23 +69,24 @@ public class SettingsActivity extends AppCompatActivity { } } - public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { + public static class SettingsFragment extends PreferenceFragment + implements SharedPreferences.OnSharedPreferenceChangeListener { private ListPreference themePreference; + private SharedPreferences prefs; @Override 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()); themePreference = (ListPreference) findPreference("theme"); CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox"); CheckBoxPreference magiskhidePreference = (CheckBoxPreference) findPreference("magiskhide"); CheckBoxPreference hostsPreference = (CheckBoxPreference) findPreference("hosts"); - PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this); - themePreference.setSummary(themePreference.getValue()); if (MagiskFragment.magiskVersion < 9) { @@ -103,23 +104,23 @@ public class SettingsActivity extends AppCompatActivity { @Override public void onResume() { super.onResume(); - PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this); + prefs.registerOnSharedPreferenceChangeListener(this); } @Override public void onDestroy() { super.onDestroy(); - PreferenceManager.getDefaultSharedPreferences(getActivity()).unregisterOnSharedPreferenceChangeListener(this); + prefs.unregisterOnSharedPreferenceChangeListener(this); } @Override - public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { + public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { Logger.dev("Settings: Prefs change " + key); boolean checked; switch (key) { case "theme": - String theme = sharedPreferences.getString(key, ""); + String theme = prefs.getString(key, ""); themePreference.setSummary(theme); if (theme.equals("Dark")) { @@ -133,7 +134,7 @@ public class SettingsActivity extends AppCompatActivity { startActivity(intent); break; case "magiskhide": - checked = sharedPreferences.getBoolean("magiskhide", false); + checked = prefs.getBoolean("magiskhide", false); if (checked) { new Async.RootTask() { @Override @@ -151,9 +152,10 @@ public class SettingsActivity extends AppCompatActivity { } }.exec(); } + Toast.makeText(getActivity(), R.string.settings_reboot_toast, Toast.LENGTH_LONG).show(); break; case "busybox": - checked = sharedPreferences.getBoolean("busybox", false); + checked = prefs.getBoolean("busybox", false); if (checked) { new Async.RootTask() { @Override @@ -174,7 +176,7 @@ public class SettingsActivity extends AppCompatActivity { Toast.makeText(getActivity(), R.string.settings_reboot_toast, Toast.LENGTH_LONG).show(); break; case "hosts": - checked = sharedPreferences.getBoolean("hosts", false); + checked = prefs.getBoolean("hosts", false); if (checked) { new Async.RootTask() { @Override @@ -195,10 +197,10 @@ public class SettingsActivity extends AppCompatActivity { Toast.makeText(getActivity(), R.string.settings_reboot_toast, Toast.LENGTH_LONG).show(); break; case "developer_logging": - Logger.devLog = sharedPreferences.getBoolean("developer_logging", false); + Logger.devLog = prefs.getBoolean("developer_logging", false); break; case "shell_logging": - Logger.logShell = sharedPreferences.getBoolean("shell_logging", false); + Logger.logShell = prefs.getBoolean("shell_logging", false); break; } diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/ModuleHelper.java b/app/src/main/java/com/topjohnwu/magisk/utils/ModuleHelper.java index c5b864c4c..eb23b9198 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/ModuleHelper.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/ModuleHelper.java @@ -82,7 +82,7 @@ public class ModuleHelper { } // Making a request to url and getting response - jsonString = WebRequest.makeWebServiceCall(context.getString(R.string.url_main) + Utils.getToken(), WebRequest.GET); + jsonString = WebRequest.makeWebServiceCall(context.getString(R.string.url_main, Utils.getToken()), WebRequest.GET); if (jsonString != null && !jsonString.isEmpty()) { // Have internet access diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 5cd7e57bf..18c731520 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -79,9 +79,6 @@ Wollen Sie Magisk herunterladen und installieren? - https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token= - https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s - https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip Allgemein diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 54065d58e..82b227041 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -81,9 +81,6 @@ ¿Deseas descargar e instalar Magisk? - https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token= - https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s - https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip General diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 7c5487fdb..d80be5db0 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -79,9 +79,6 @@ Vuoi scaricare ed installare Magisk? - https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token= - https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s - https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip Generali diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f18934bbb..b514d5c9c 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -79,9 +79,6 @@ Wilt u Magisk downloaden en installeren? - https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token= - https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s - https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip Algemeen @@ -97,6 +94,7 @@ 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-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 5961616f1..95da4bdbc 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -77,9 +77,6 @@ Você quer baixar e instalar o Magisk? - https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token= - https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s - https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip Geral diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c9779df16..f88f1870b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -86,9 +86,9 @@ Do you want to download and install Magisk? - https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token= - https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s - https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip + https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=%1$s + https://raw.githubusercontent.com/Magisk-Modules-Repo/%1$s/master/%2$s + https://github.com/Magisk-Modules-Repo/%1$s/archive/master.zip General