diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..b3c0d04 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,31 @@ +name: Android CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build debug version of NST with Gradle + run: ./gradlew :app:assembleDebug + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: NST-debugBuild + path: ./app/build/outputs/apk/debug/NST-debug.apk diff --git a/.gitignore b/.gitignore index aa724b7..1a6fcec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,34 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store -/build -/captures -.externalNativeBuild -.cxx +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) local.properties + +# Log/OS Files +*.log + +# Android Studio generated files and folders +captures/ +.externalNativeBuild/ +.cxx/ +*.apk +output.json + +# IntelliJ +*.iml +.idea/ +misc.xml +deploymentTargetDropDown.xml +render.experimental.xml + +# Keystore files +*.jks +*.keystore + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Android Profiling +*.hprof + diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index c25d974..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -A11 Blur for A12 \ No newline at end of file diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml deleted file mode 100644 index 0962c39..0000000 --- a/.idea/appInsightsSettings.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b589d56..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index 0c0c338..0000000 --- a/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 0897082..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml deleted file mode 100644 index f8051a6..0000000 --- a/.idea/migrations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index a58f46e..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 4aa8d82..b57dc86 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **Compatible with Android 12+** -![Android 13](notifshade13.png "Screenshot of module working on Android 13") +![Android 15](notifshade15d.png "Screenshot of module working on Android 15, dark theme")![Android 15](notifshade15l.png "Screenshot of module working on Android 15, light theme") ### License This project is licensed under the Apache License, Version 2.0 (the "License"). See [LICENSE](LICENSE) for details. diff --git a/app/.gitignore b/app/.gitignore index 42afabf..a85312c 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,2 @@ -/build \ No newline at end of file +debug/ +release/ \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index c310232..76e3798 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,22 +3,20 @@ plugins { } android { - compileSdk 31 + compileSdk 34 defaultConfig { applicationId "com.asyjaiz.A12blur" minSdk 31 - targetSdk 31 - versionCode 5 - versionName "1.4N" + targetSdk 35 + versionCode 6 + versionName "1.5N" archivesBaseName = "NST" } buildTypes { release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.debug } } @@ -27,11 +25,14 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } namespace 'com.asyjaiz.A12blur' + buildFeatures { + buildConfig true + } } dependencies { - compileOnly 'de.robv.android.xposed:api:82' + compileOnly fileTree("libs") {include("*.jar")} //implementation 'androidx.appcompat:appcompat:1.4.2' //implementation 'com.google.android.material:material:1.6.1' diff --git a/app/libs/api-82-sources.jar b/app/libs/api-82-sources.jar new file mode 100644 index 0000000..6e3a0fb Binary files /dev/null and b/app/libs/api-82-sources.jar differ diff --git a/app/libs/api-82.jar b/app/libs/api-82.jar new file mode 100644 index 0000000..eec212f Binary files /dev/null and b/app/libs/api-82.jar differ diff --git a/app/src/main/java/com/asyjaiz/A12blur/Replace.java b/app/src/main/java/com/asyjaiz/A12blur/Replace.java index d89ea5c..52a0b08 100644 --- a/app/src/main/java/com/asyjaiz/A12blur/Replace.java +++ b/app/src/main/java/com/asyjaiz/A12blur/Replace.java @@ -1,10 +1,8 @@ package com.asyjaiz.A12blur; -import static de.robv.android.xposed.XposedHelpers.findConstructorExact; import static de.robv.android.xposed.XposedHelpers.setFloatField; import android.content.res.XModuleResources; -import android.os.Build; import java.io.BufferedReader; import java.io.IOException; @@ -58,131 +56,13 @@ public static Boolean read(String propName) { } } - /* public static Boolean lowPower() { - Process process = null; - BufferedReader bufferedReader = null; - - try { - process = new ProcessBuilder().command("/system/bin/settings", "get global low_power").start(); - bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); - String line = bufferedReader.readLine(); - XposedBridge.log("Power Saving Mode check returned " + line); - return line.contains("true") || line.contains("1"); - } catch (Exception e) { - XposedBridge.log("Power Saving Mode check returned an exception. Returning fail by default"); - return false; - } finally { - if (bufferedReader != null){ - try { - bufferedReader.close(); - } catch (IOException ignored) {} - } - if (process != null){ - process.destroy(); - } - } - } */ - - /* public static float alpha(boolean capable) { - float defaultA = 0.85f; - float supportedA = 0.54f; - if (capable) { - if (false) - return defaultA; - else return supportedA; - } else return defaultA; - } */ - - private Constructor findConstructor(boolean forceOld13Constructor, Class hookClass) throws Throwable { - Object[] parameterTypesAndCallback = new Object[0]; - if (Build.VERSION.SDK_INT >= 33) { - if (Build.TIME > 1678278441000L && !forceOld13Constructor) { - if (BuildConfig.DEBUG) { - XposedBridge.log("Your device is using a build of the new type."); - } - parameterTypesAndCallback = new Object [] { - rootPackage + ".statusbar.phone.LightBarController", - rootPackage + ".statusbar.phone.DozeParameters", - "android.app.AlarmManager", - rootPackage + ".statusbar.policy.KeyguardStateController", - rootPackage + ".util.wakelock.DelayedWakeLock.Builder", - "android.os.Handler", - "com.android.keyguard.KeyguardUpdateMonitor", - rootPackage + ".dock.DockManager", - rootPackage + ".statusbar.policy.ConfigurationController", - "java.util.concurrent.Executor", - rootPackage + ".statusbar.phone.ScreenOffAnimationController", - rootPackage + ".keyguard.KeyguardUnlockAnimationController", - rootPackage + ".statusbar.phone.StatusBarKeyguardViewManager", - rootPackage + ".keyguard.ui.viewmodel.PrimaryBouncerToGoneTransitionViewModel", - rootPackage + ".keyguard.domain.interactor.KeyguardTransitionInteractor", - "kotlinx.coroutines.CoroutineDispatcher", - rootPackage + ".shade.transition.LargeScreenShadeInterpolator", - rootPackage + ".flags.FeatureFlags" - }; - try { - return findConstructorExact(hookClass, parameterTypesAndCallback); - } catch (Throwable t) { - if (BuildConfig.DEBUG) { - XposedBridge.log("Problem with finding corresponding constructor, retrying with an old scheme"); - } - return findConstructor(true, hookClass); - } - } else { - parameterTypesAndCallback = new Object [] { - rootPackage + ".statusbar.phone.LightBarController", - rootPackage + ".statusbar.phone.DozeParameters", - "android.app.AlarmManager", - rootPackage + ".statusbar.policy.KeyguardStateController", - rootPackage + ".util.wakelock.DelayedWakeLock.Builder", - "android.os.Handler", - "com.android.keyguard.KeyguardUpdateMonitor", - rootPackage + ".dock.DockManager", - rootPackage + ".statusbar.policy.ConfigurationController", - "java.util.concurrent.Executor", - rootPackage + ".statusbar.phone.ScreenOffAnimationController", - rootPackage + ".keyguard.KeyguardUnlockAnimationController", - rootPackage + ".statusbar.phone.StatusBarKeyguardViewManager", - }; - } - } - else if (Build.VERSION.SDK_INT == 32) { - parameterTypesAndCallback = new Object [] { - rootPackage + ".statusbar.phone.LightBarController", - rootPackage + ".statusbar.phone.DozeParameters", - "android.app.AlarmManager", - rootPackage + ".statusbar.policy.KeyguardStateController", - rootPackage + ".util.wakelock.DelayedWakeLock.Builder", - "android.os.Handler", - "com.android.keyguard.KeyguardUpdateMonitor", - rootPackage + ".dock.DockManager", - rootPackage + ".statusbar.policy.ConfigurationController", - "java.util.concurrent.Executor", - rootPackage + ".statusbar.phone.UnlockedScreenOffAnimationController", - rootPackage + ".statusbar.phone.panelstate.PanelExpansionStateManager" - }; - } - else if (Build.VERSION.SDK_INT == 31) { - parameterTypesAndCallback = new Object [] { - rootPackage + ".statusbar.phone.LightBarController", - rootPackage + ".statusbar.phone.DozeParameters", - "android.app.AlarmManager", - rootPackage + ".statusbar.policy.KeyguardStateController", - rootPackage + ".util.wakelock.DelayedWakeLock.Builder", - "android.os.Handler", - "com.android.keyguard.KeyguardUpdateMonitor", - rootPackage + ".dock.DockManager", - rootPackage + ".statusbar.policy.ConfigurationController", - "java.util.concurrent.Executor", - rootPackage + ".statusbar.phone.UnlockedScreenOffAnimationController" - }; - } - return findConstructorExact(hookClass, parameterTypesAndCallback); - } - private Constructor findConstructor(Class hookClass) throws Throwable { Constructor[] constructors = hookClass.getConstructors(); - return constructors.length == 1 ? constructors[0] : findConstructor(false, hookClass); + if (constructors.length >= 1) { + return constructors[0]; + } else { + throw new NoSuchMethodException("Did not find constructor for " + hookClass.getName()); + } } @Override @@ -205,7 +85,7 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpParam) throws Th avoidAccel2 = read("ro.config.avoid_gfx_accel"); lowRam = read("ro.config.low_ram"); disableBlur = read("persist.sysui.disableBlur"); - boolean capable = supportsBlur && !avoidAccel1 && !avoidAccel2 && !lowRam && !disableBlur; + boolean capable = supportsBlur && !avoidAccel1 && !avoidAccel2 && !lowRam && !disableBlur; // yes, sadly we can't just call BlurUtils check for this, so we should do this on our own if (BuildConfig.DEBUG) XposedBridge.log(capable ? "Your device is capable of handling blur. Using a corresponding alpha value" : "Your device is not capable of handling blur. Using a default alpha value"); @@ -215,7 +95,7 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpParam) throws Th XC_MethodHook xcMethodHook = new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { - setFloatField(param.thisObject, "mDefaultScrimAlpha", alpha); + setFloatField(param.thisObject, "mDefaultScrimAlpha", alpha); // Override BUSY_SCRIM_ALPHA } }; diff --git a/build.gradle b/build.gradle index e606792..c945af8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,5 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.3.0' apply false - id 'com.android.library' version '8.3.0' apply false -} - -task clean(type: Delete) { - delete rootProject.buildDir + id 'com.android.application' version '8.5.0' apply false + id 'com.android.library' version '8.5.0' apply false } diff --git a/gradle.properties b/gradle.properties index ec63151..95c615a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,5 +19,4 @@ android.useAndroidX=true # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 17655d0..48c0a02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/notifshade15d.png b/notifshade15d.png new file mode 100644 index 0000000..cc003c8 Binary files /dev/null and b/notifshade15d.png differ diff --git a/notifshade15l.png b/notifshade15l.png new file mode 100644 index 0000000..bde4b41 Binary files /dev/null and b/notifshade15l.png differ diff --git a/settings.gradle b/settings.gradle index e190410..71967a7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,7 +8,6 @@ pluginManagement { dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { - jcenter() google() mavenCentral() }