From bb56d34bf0151291038c7927e15dbebfbc2d1043 Mon Sep 17 00:00:00 2001 From: programminghoch10 <16062290+programminghoch10@users.noreply.github.com> Date: Wed, 23 Jul 2025 22:51:57 +0200 Subject: [PATCH 1/6] add AlwaysAllowChargingSounds --- AlwaysAllowChargingSounds/Readme.md | 4 ++++ AlwaysAllowChargingSounds/build.gradle.kts | 15 ++++++++++++ .../src/main/AndroidManifest.xml | 24 +++++++++++++++++++ .../src/main/assets/xposed_init | 1 + .../AlwaysAllowChargingSounds/Hook.kt | 15 ++++++++++++ .../src/main/res/values/arrays.xml | 6 +++++ .../en-US/full_description.txt | 2 ++ .../en-US/short_description.txt | 1 + .../en-US/title.txt | 1 + settings.gradle.kts | 1 + 10 files changed, 70 insertions(+) create mode 100644 AlwaysAllowChargingSounds/Readme.md create mode 100644 AlwaysAllowChargingSounds/build.gradle.kts create mode 100644 AlwaysAllowChargingSounds/src/main/AndroidManifest.xml create mode 100644 AlwaysAllowChargingSounds/src/main/assets/xposed_init create mode 100644 AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt create mode 100644 AlwaysAllowChargingSounds/src/main/res/values/arrays.xml create mode 100644 metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt create mode 100644 metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt create mode 100644 metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt diff --git a/AlwaysAllowChargingSounds/Readme.md b/AlwaysAllowChargingSounds/Readme.md new file mode 100644 index 0000000..acc0a81 --- /dev/null +++ b/AlwaysAllowChargingSounds/Readme.md @@ -0,0 +1,4 @@ +# AlwaysAllowChargingSounds + +Always allow charging sounds and vibration, +even when the device is in Do-not-Disturb mode. diff --git a/AlwaysAllowChargingSounds/build.gradle.kts b/AlwaysAllowChargingSounds/build.gradle.kts new file mode 100644 index 0000000..2820155 --- /dev/null +++ b/AlwaysAllowChargingSounds/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + alias(libs.plugins.buildlogic.android.application) + alias(libs.plugins.buildlogic.kotlin.android) +} + +android { + namespace = "de.binarynoise.AlwaysAllowChargingSounds" + + defaultConfig { + minSdk = 28 + targetSdk = 36 + } +} + +dependencies {} diff --git a/AlwaysAllowChargingSounds/src/main/AndroidManifest.xml b/AlwaysAllowChargingSounds/src/main/AndroidManifest.xml new file mode 100644 index 0000000..bc1bfb8 --- /dev/null +++ b/AlwaysAllowChargingSounds/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/AlwaysAllowChargingSounds/src/main/assets/xposed_init b/AlwaysAllowChargingSounds/src/main/assets/xposed_init new file mode 100644 index 0000000..229dfde --- /dev/null +++ b/AlwaysAllowChargingSounds/src/main/assets/xposed_init @@ -0,0 +1 @@ +de.binarynoise.AlwaysAllowChargingSounds.Hook diff --git a/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt new file mode 100644 index 0000000..381c8a7 --- /dev/null +++ b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt @@ -0,0 +1,15 @@ +package de.binarynoise.AlwaysAllowChargingSounds + +import de.robv.android.xposed.IXposedHookLoadPackage +import de.robv.android.xposed.XC_MethodReplacement +import de.robv.android.xposed.XposedHelpers +import de.robv.android.xposed.callbacks.XC_LoadPackage + +class Hook : IXposedHookLoadPackage { + + override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) { + val NotifierClass = XposedHelpers.findClass("com.android.server.power.Notifier", lpparam.classLoader) + XposedHelpers.findAndHookMethod(NotifierClass, "isChargingFeedbackEnabled", Int::class.java, XC_MethodReplacement.returnConstant(true)) + } + +} diff --git a/AlwaysAllowChargingSounds/src/main/res/values/arrays.xml b/AlwaysAllowChargingSounds/src/main/res/values/arrays.xml new file mode 100644 index 0000000..db6e46a --- /dev/null +++ b/AlwaysAllowChargingSounds/src/main/res/values/arrays.xml @@ -0,0 +1,6 @@ + + + + android + + diff --git a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt new file mode 100644 index 0000000..08f1e65 --- /dev/null +++ b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt @@ -0,0 +1,2 @@ +Always allow charging sound and vibration, +even when the device is set into Do-not-Disturb mode. diff --git a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt new file mode 100644 index 0000000..b07b44d --- /dev/null +++ b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt @@ -0,0 +1 @@ +Always allow charging sounds, even in DnD mode. diff --git a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt new file mode 100644 index 0000000..30ce4d0 --- /dev/null +++ b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt @@ -0,0 +1 @@ +AlwaysAllowChargingSounds diff --git a/settings.gradle.kts b/settings.gradle.kts index 667cf53..f77923b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -39,6 +39,7 @@ dependencyResolutionManagement { rootProject.name = "XposedModulets" enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") +include(":AlwaysAllowChargingSounds") include(":AlwaysAllowMultiInstanceSplit") include(":AnimationScaleMod") include(":AntiBrightnessChange") From c2273b88769d72d99056ab324350ef318816afc1 Mon Sep 17 00:00:00 2001 From: programminghoch10 <16062290+programminghoch10@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:07:13 +0200 Subject: [PATCH 2/6] make AlwaysAllowChargingSounds respect the user settings --- .../binarynoise/AlwaysAllowChargingSounds/Hook.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt index 381c8a7..a1d16e6 100644 --- a/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt +++ b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt @@ -1,15 +1,24 @@ package de.binarynoise.AlwaysAllowChargingSounds +import android.content.Context +import android.provider.Settings import de.robv.android.xposed.IXposedHookLoadPackage import de.robv.android.xposed.XC_MethodReplacement import de.robv.android.xposed.XposedHelpers import de.robv.android.xposed.callbacks.XC_LoadPackage class Hook : IXposedHookLoadPackage { - + override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) { val NotifierClass = XposedHelpers.findClass("com.android.server.power.Notifier", lpparam.classLoader) - XposedHelpers.findAndHookMethod(NotifierClass, "isChargingFeedbackEnabled", Int::class.java, XC_MethodReplacement.returnConstant(true)) + XposedHelpers.findAndHookMethod(NotifierClass, "isChargingFeedbackEnabled", Int::class.java, object : XC_MethodReplacement() { + override fun replaceHookedMethod(param: MethodHookParam): Boolean { + val userId = param.args[0] as Int + val context = XposedHelpers.getObjectField(param.thisObject, "mContext") as Context + return XposedHelpers.callStaticMethod( + Settings.Secure::class.java, "getIntForUser", context.contentResolver, "charging_sounds_enabled", 1, userId + ) != 0 + } + }) } - } From 118fbfe7065fa91d6dd87a38125cbb724924e28d Mon Sep 17 00:00:00 2001 From: binarynoise Date: Sat, 26 Jul 2025 21:23:02 +0200 Subject: [PATCH 3/6] restrict to android package only --- .../main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt index a1d16e6..cb2f323 100644 --- a/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt +++ b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt @@ -10,6 +10,8 @@ import de.robv.android.xposed.callbacks.XC_LoadPackage class Hook : IXposedHookLoadPackage { override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) { + if (lpparam.packageName != "android") return + val NotifierClass = XposedHelpers.findClass("com.android.server.power.Notifier", lpparam.classLoader) XposedHelpers.findAndHookMethod(NotifierClass, "isChargingFeedbackEnabled", Int::class.java, object : XC_MethodReplacement() { override fun replaceHookedMethod(param: MethodHookParam): Boolean { From 7f252f0cf4fd0a82e1e239e0b3011258368c1ee1 Mon Sep 17 00:00:00 2001 From: binarynoise Date: Sat, 26 Jul 2025 21:23:52 +0200 Subject: [PATCH 4/6] add comment --- .../main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt index cb2f323..6c95c88 100644 --- a/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt +++ b/AlwaysAllowChargingSounds/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt @@ -17,6 +17,7 @@ class Hook : IXposedHookLoadPackage { override fun replaceHookedMethod(param: MethodHookParam): Boolean { val userId = param.args[0] as Int val context = XposedHelpers.getObjectField(param.thisObject, "mContext") as Context + // charging_sounds_enabled comes from Settings.Secure.CHARGING_SOUNDS_ENABLED which is @hide return XposedHelpers.callStaticMethod( Settings.Secure::class.java, "getIntForUser", context.contentResolver, "charging_sounds_enabled", 1, userId ) != 0 From 7d2e3b2b0585f2be8a4dc95f9a1a0b67b6545ba2 Mon Sep 17 00:00:00 2001 From: binarynoise Date: Sat, 26 Jul 2025 21:36:47 +0200 Subject: [PATCH 5/6] docs --- README.md | 1 + .../en-US/short_description.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a7c600..becf3e4 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A collection of small Xposed Modules. | Module | Author | Description | Releases | |-|-|-|-| +| [AlwaysAllowChargingSounds](AlwaysAllowChargingSounds) | [@binarynoise](https://github.com/binarynoise) | Always allow charging sounds, even in DnD mode | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AlwaysAllowChargingSounds) | | [AlwaysAllowMultiInstanceSplit](AlwaysAllowMultiInstanceSplit) | [@binarynoise](https://github.com/binarynoise) & [@programminghoch10](https://github.com/programminghoch10) | Allow all apps to be launched twice in a split screen | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) | | [AnimationScaleMod](AnimationScaleMod) | [@programminghoch10](https://github.com/programminghoch10) | Add more animation scale multipliers | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) | | [AntiBrightnessChange](AntiBrightnessChange) | [@programminghoch10](https://github.com/programminghoch10) | Prevent apps from changing display brightness | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AntiBrightnessChange) [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/com.programminghoch10.AntiBrightnessChange) | diff --git a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt index b07b44d..bf48d76 100644 --- a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt +++ b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt @@ -1 +1 @@ -Always allow charging sounds, even in DnD mode. +Always allow charging sounds, even in DnD mode From 417ef0cd77b42db976ae534c491e026f3058d037 Mon Sep 17 00:00:00 2001 From: binarynoise Date: Sat, 26 Jul 2025 22:01:54 +0200 Subject: [PATCH 6/6] s/Sound/Feedback/g --- AlwaysAllowChargingFeedback/Readme.md | 4 ++++ .../build.gradle.kts | 2 +- .../src/main/AndroidManifest.xml | 4 ++-- AlwaysAllowChargingFeedback/src/main/assets/xposed_init | 1 + .../java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt | 2 +- .../src/main/res/values/arrays.xml | 0 AlwaysAllowChargingSounds/Readme.md | 4 ---- AlwaysAllowChargingSounds/src/main/assets/xposed_init | 1 - README.md | 2 +- .../en-US/full_description.txt | 2 +- .../en-US/short_description.txt | 2 +- .../de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt | 2 +- settings.gradle.kts | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 AlwaysAllowChargingFeedback/Readme.md rename {AlwaysAllowChargingSounds => AlwaysAllowChargingFeedback}/build.gradle.kts (78%) rename {AlwaysAllowChargingSounds => AlwaysAllowChargingFeedback}/src/main/AndroidManifest.xml (80%) create mode 100644 AlwaysAllowChargingFeedback/src/main/assets/xposed_init rename {AlwaysAllowChargingSounds => AlwaysAllowChargingFeedback}/src/main/java/de/binarynoise/AlwaysAllowChargingSounds/Hook.kt (96%) rename {AlwaysAllowChargingSounds => AlwaysAllowChargingFeedback}/src/main/res/values/arrays.xml (100%) delete mode 100644 AlwaysAllowChargingSounds/Readme.md delete mode 100644 AlwaysAllowChargingSounds/src/main/assets/xposed_init diff --git a/AlwaysAllowChargingFeedback/Readme.md b/AlwaysAllowChargingFeedback/Readme.md new file mode 100644 index 0000000..2f668a2 --- /dev/null +++ b/AlwaysAllowChargingFeedback/Readme.md @@ -0,0 +1,4 @@ +# AlwaysAllowChargingFeedback + +Always allow charging feedback, +even when the device is in Do-not-Disturb mode. diff --git a/AlwaysAllowChargingSounds/build.gradle.kts b/AlwaysAllowChargingFeedback/build.gradle.kts similarity index 78% rename from AlwaysAllowChargingSounds/build.gradle.kts rename to AlwaysAllowChargingFeedback/build.gradle.kts index 2820155..8b19b6e 100644 --- a/AlwaysAllowChargingSounds/build.gradle.kts +++ b/AlwaysAllowChargingFeedback/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } android { - namespace = "de.binarynoise.AlwaysAllowChargingSounds" + namespace = "de.binarynoise.AlwaysAllowChargingFeedback" defaultConfig { minSdk = 28 diff --git a/AlwaysAllowChargingSounds/src/main/AndroidManifest.xml b/AlwaysAllowChargingFeedback/src/main/AndroidManifest.xml similarity index 80% rename from AlwaysAllowChargingSounds/src/main/AndroidManifest.xml rename to AlwaysAllowChargingFeedback/src/main/AndroidManifest.xml index bc1bfb8..1a5a909 100644 --- a/AlwaysAllowChargingSounds/src/main/AndroidManifest.xml +++ b/AlwaysAllowChargingFeedback/src/main/AndroidManifest.xml @@ -2,14 +2,14 @@ - + | Module | Author | Description | Releases | |-|-|-|-| -| [AlwaysAllowChargingSounds](AlwaysAllowChargingSounds) | [@binarynoise](https://github.com/binarynoise) | Always allow charging sounds, even in DnD mode | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AlwaysAllowChargingSounds) | +| [AlwaysAllowChargingFeedback](AlwaysAllowChargingFeedback) | [@binarynoise](https://github.com/binarynoise) | Always allow charging feedback, even in DnD mode | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AlwaysAllowChargingFeedback) | | [AlwaysAllowMultiInstanceSplit](AlwaysAllowMultiInstanceSplit) | [@binarynoise](https://github.com/binarynoise) & [@programminghoch10](https://github.com/programminghoch10) | Allow all apps to be launched twice in a split screen | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) | | [AnimationScaleMod](AnimationScaleMod) | [@programminghoch10](https://github.com/programminghoch10) | Add more animation scale multipliers | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) | | [AntiBrightnessChange](AntiBrightnessChange) | [@programminghoch10](https://github.com/programminghoch10) | Prevent apps from changing display brightness | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AntiBrightnessChange) [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/com.programminghoch10.AntiBrightnessChange) | diff --git a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt index 08f1e65..775fa12 100644 --- a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt +++ b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/full_description.txt @@ -1,2 +1,2 @@ -Always allow charging sound and vibration, +Always allow charging feedback, even when the device is set into Do-not-Disturb mode. diff --git a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt index bf48d76..ec53190 100644 --- a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt +++ b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/short_description.txt @@ -1 +1 @@ -Always allow charging sounds, even in DnD mode +Always allow charging feedback, even in DnD mode diff --git a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt index 30ce4d0..83bfe24 100644 --- a/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt +++ b/metadata/de.binarynoise.AlwaysAllowChargingSounds/en-US/title.txt @@ -1 +1 @@ -AlwaysAllowChargingSounds +AlwaysAllowChargingFeedback diff --git a/settings.gradle.kts b/settings.gradle.kts index f77923b..931746a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -39,7 +39,7 @@ dependencyResolutionManagement { rootProject.name = "XposedModulets" enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") -include(":AlwaysAllowChargingSounds") +include(":AlwaysAllowChargingFeedback") include(":AlwaysAllowMultiInstanceSplit") include(":AnimationScaleMod") include(":AntiBrightnessChange")