Skip to content

Commit 620f0ff

Browse files
add AlwaysAllowChargingSounds (#16)
Co-authored-by: binarynoise <[email protected]>
1 parent c66cd79 commit 620f0ff

File tree

11 files changed

+83
-0
lines changed

11 files changed

+83
-0
lines changed

AlwaysAllowChargingFeedback/Readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# AlwaysAllowChargingFeedback
2+
3+
Always allow charging feedback,
4+
even when the device is in Do-not-Disturb mode.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
plugins {
2+
alias(libs.plugins.buildlogic.android.application)
3+
alias(libs.plugins.buildlogic.kotlin.android)
4+
}
5+
6+
android {
7+
namespace = "de.binarynoise.AlwaysAllowChargingFeedback"
8+
9+
defaultConfig {
10+
minSdk = 28
11+
targetSdk = 36
12+
}
13+
}
14+
15+
dependencies {}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android">
4+
5+
<application android:label="AlwaysAllowChargingFeedback">
6+
<meta-data
7+
android:name="xposedmodule"
8+
android:value="true"
9+
/>
10+
<meta-data
11+
android:name="xposeddescription"
12+
android:value="Always allow charging feedback, even in DnD mode."
13+
/>
14+
<meta-data
15+
android:name="xposedminversion"
16+
android:value="53"
17+
/>
18+
<meta-data
19+
android:name="xposedscope"
20+
android:resource="@array/scope"
21+
/>
22+
</application>
23+
24+
</manifest>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
de.binarynoise.AlwaysAllowChargingFeedback.Hook
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package de.binarynoise.AlwaysAllowChargingFeedback
2+
3+
import android.content.Context
4+
import android.provider.Settings
5+
import de.robv.android.xposed.IXposedHookLoadPackage
6+
import de.robv.android.xposed.XC_MethodReplacement
7+
import de.robv.android.xposed.XposedHelpers
8+
import de.robv.android.xposed.callbacks.XC_LoadPackage
9+
10+
class Hook : IXposedHookLoadPackage {
11+
12+
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
13+
if (lpparam.packageName != "android") return
14+
15+
val NotifierClass = XposedHelpers.findClass("com.android.server.power.Notifier", lpparam.classLoader)
16+
XposedHelpers.findAndHookMethod(NotifierClass, "isChargingFeedbackEnabled", Int::class.java, object : XC_MethodReplacement() {
17+
override fun replaceHookedMethod(param: MethodHookParam): Boolean {
18+
val userId = param.args[0] as Int
19+
val context = XposedHelpers.getObjectField(param.thisObject, "mContext") as Context
20+
// charging_sounds_enabled comes from Settings.Secure.CHARGING_SOUNDS_ENABLED which is @hide
21+
return XposedHelpers.callStaticMethod(
22+
Settings.Secure::class.java, "getIntForUser", context.contentResolver, "charging_sounds_enabled", 1, userId
23+
) != 0
24+
}
25+
})
26+
}
27+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string-array name="scope">
4+
<item>android</item>
5+
</string-array>
6+
</resources>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ A collection of small Xposed Modules.
55
<!--@formatter:off-->
66
| Module | Author | Description | Releases |
77
|-|-|-|-|
8+
| [AlwaysAllowChargingFeedback](AlwaysAllowChargingFeedback) | [@binarynoise](https://github.com/binarynoise) | Always allow charging feedback, even in DnD mode | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AlwaysAllowChargingFeedback) |
89
| [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) |
910
| [AnimationScaleMod](AnimationScaleMod) | [@programminghoch10](https://github.com/programminghoch10) | Add more animation scale multipliers | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) |
1011
| [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) |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Always allow charging feedback,
2+
even when the device is set into Do-not-Disturb mode.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Always allow charging feedback, even in DnD mode
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AlwaysAllowChargingFeedback

0 commit comments

Comments
 (0)