Skip to content

Commit

Permalink
[app] support lsposed 1.9.1 new api and auto select scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornaco committed Sep 6, 2023
1 parent 4d6dd76 commit e87a62b
Show file tree
Hide file tree
Showing 70 changed files with 582 additions and 942 deletions.
4 changes: 2 additions & 2 deletions android/android_framework/base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType<Checkstyle> {
Expand Down
4 changes: 2 additions & 2 deletions android/android_framework/dex-maker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
4 changes: 2 additions & 2 deletions android/android_framework/hidden-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions android/android_framework/patch-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

externalNativeBuild {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
4 changes: 2 additions & 2 deletions android/android_framework/patchx-lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
4 changes: 2 additions & 2 deletions android/android_framework/res/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
4 changes: 2 additions & 2 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:description="@string/app_description"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppThemeLight.NoActionBar"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:allowBackup"
tools:targetApi="n">
>

<activity
android:name=".main.NavActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class AppPreference {
private static final String PREF_KEY_PROCESS_MANAGE_UI_V2 = "PREF_KEY_PROCESS_MANAGE_UI_V2";
private static final String PREF_KEY_CURRENT_TIP_INDEX = "PREF_KEY_CURRENT_TIP_INDEX";
private static final String PREF_KEY_PKG_SET_SORT_PREFIX = "PREF_KEY_PKG_SORT_";
private static final String PREF_KEY_AUTO_REQUEST_XPOSED_SCOPE = "PREF_KEY_AUTO_REQUEST_XPOSED_SCOPE";

@Verify
public static boolean isFirstRun(Context context) {
Expand Down Expand Up @@ -103,16 +102,4 @@ public static void setPkgSetSort(Context context, List<PackageSet> packageSets)
.apply();
}
}

public static boolean isAutoRequestXposedScopeEnabled(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(PREF_KEY_AUTO_REQUEST_XPOSED_SCOPE, true);
}

public static void setAutoRequestXposedScopeEnabled(Context context, boolean value) {
PreferenceManager.getDefaultSharedPreferences(context)
.edit()
.putBoolean(PREF_KEY_AUTO_REQUEST_XPOSED_SCOPE, value)
.apply();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import github.tornaco.android.thanos.BuildProp;
import github.tornaco.android.thanos.R;
import github.tornaco.android.thanos.ThanosApp;
import github.tornaco.android.thanos.XposedScope;
import github.tornaco.android.thanos.app.donate.DonateActivity;
import github.tornaco.android.thanos.app.donate.DonateSettings;
import github.tornaco.android.thanos.apps.AppDetailsActivity;
Expand Down Expand Up @@ -204,14 +203,6 @@ private void invalidateIconPack(IconPack pack) {
}

protected void onBindStrategyPreferences() {
SwitchPreferenceCompat autoXposedScope = findPreference(getString(R.string.key_new_auto_request_xposed_scope));
Objects.requireNonNull(autoXposedScope).setVisible(XposedScope.INSTANCE.getService() != null);
autoXposedScope.setChecked(AppPreference.isAutoRequestXposedScopeEnabled(requireContext()));
autoXposedScope.setOnPreferenceChangeListener((preference, newValue) -> {
AppPreference.setAutoRequestXposedScopeEnabled(requireContext(), (Boolean) newValue);
return true;
});

ThanosManager thanos = ThanosManager.from(getContext());
if (!thanos.isServiceInstalled()) {
return;
Expand Down
1 change: 0 additions & 1 deletion android/app/src/main/res/values/pref_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@
<string name="key_app_feature_config_redaction_notification_text" translatable="false">key_app_feature_config_redaction_notification_text</string>

<string name="key_strategy" translatable="false">key_strategy</string>
<string name="key_new_auto_request_xposed_scope" translatable="false">key_new_auto_request_xposed_scope</string>
<string name="key_new_installed_apps_config" translatable="false">key_new_installed_apps_config</string>
<string name="key_new_installed_apps_config_enabled" translatable="false">key_new_installed_apps_config_enabled</string>
<string name="key_config_template_category" translatable="false">key_config_template_category</string>
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="app_name">Thanox</string>
<string name="app_description">I am Thanos! 😈👌</string>

<!-- Switch On/Off -->
<string name="switch_on_text">On</string>
Expand Down
6 changes: 0 additions & 6 deletions android/app/src/main/res/xml/settings_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@
app:summary="@string/pref_summary_enable_power_save"
app:title="@string/pref_title_enable_power_save" />

<SwitchPreferenceCompat
app:key="@string/key_new_auto_request_xposed_scope"
app:persistent="false"
app:summary="@string/pref_summary_auto_request_xposed_scope"
app:title="@string/pref_title_auto_request_xposed_scope" />

<SwitchPreferenceCompat
app:isPreferenceVisible="false"
app:key="@string/key_enable_battery_drain_app_reminging"
Expand Down
11 changes: 11 additions & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ fun printVersions() {
log("thanoxVersionName: $thanoxVersionName")
}


val androidSourceCompatibility by extra(JavaVersion.VERSION_11)
val androidTargetCompatibility by extra(JavaVersion.VERSION_11)

subprojects {
log("subprojects: ${this.name}")
repositories {
Expand All @@ -72,6 +76,13 @@ subprojects {
options.encoding = "UTF-8"
}

plugins.withType(JavaPlugin::class.java) {
extensions.configure(JavaPluginExtension::class.java) {
sourceCompatibility = androidSourceCompatibility
targetCompatibility = androidTargetCompatibility
}
}

buildDir = file("${outDir}${path.replace(":", File.separator)}")
}

Expand Down
2 changes: 1 addition & 1 deletion android/internal/Thanox-Internal
4 changes: 2 additions & 2 deletions android/modules/module_activity_trampoline/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_component_manager/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_easteregg/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_filepicker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_locker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_noroot_support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_notification_recorder/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_ops/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_ops2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions android/modules/module_profile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
Expand Down
Loading

0 comments on commit e87a62b

Please sign in to comment.