Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AlwaysAllowChargingFeedback/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# AlwaysAllowChargingFeedback

Always allow charging feedback,
even when the device is in Do-not-Disturb mode.
15 changes: 15 additions & 0 deletions AlwaysAllowChargingFeedback/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
alias(libs.plugins.buildlogic.android.application)
alias(libs.plugins.buildlogic.kotlin.android)
}

android {
namespace = "de.binarynoise.AlwaysAllowChargingFeedback"

defaultConfig {
minSdk = 28
targetSdk = 36
}
}

dependencies {}
24 changes: 24 additions & 0 deletions AlwaysAllowChargingFeedback/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android">

<application android:label="AlwaysAllowChargingFeedback">
<meta-data
android:name="xposedmodule"
android:value="true"
/>
<meta-data
android:name="xposeddescription"
android:value="Always allow charging feedback, even in DnD mode."
/>
<meta-data
android:name="xposedminversion"
android:value="53"
/>
<meta-data
android:name="xposedscope"
android:resource="@array/scope"
/>
</application>

</manifest>
1 change: 1 addition & 0 deletions AlwaysAllowChargingFeedback/src/main/assets/xposed_init
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
de.binarynoise.AlwaysAllowChargingFeedback.Hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package de.binarynoise.AlwaysAllowChargingFeedback

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) {
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 {
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
}
})
}
}
6 changes: 6 additions & 0 deletions AlwaysAllowChargingFeedback/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="scope">
<item>android</item>
</string-array>
</resources>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A collection of small Xposed Modules.
<!--@formatter:off-->
| Module | Author | Description | Releases |
|-|-|-|-|
| [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) |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Always allow charging feedback,
even when the device is set into Do-not-Disturb mode.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Always allow charging feedback, even in DnD mode
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AlwaysAllowChargingFeedback
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencyResolutionManagement {
rootProject.name = "XposedModulets"

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
include(":AlwaysAllowChargingFeedback")
include(":AlwaysAllowMultiInstanceSplit")
include(":AnimationScaleMod")
include(":AntiBrightnessChange")
Expand Down