Skip to content

Commit 894ca4a

Browse files
programminghoch10binarynoise
authored andcommitted
fix FreeNotifications for the second time
1 parent 2db616a commit 894ca4a

File tree

1 file changed

+15
-7
lines changed
  • FreeNotifications/src/main/java/de/binarynoise/freeNotifications

1 file changed

+15
-7
lines changed

FreeNotifications/src/main/java/de/binarynoise/freeNotifications/Hook.kt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package de.binarynoise.freeNotifications
22

33
import android.app.NotificationChannel
4-
import android.app.NotificationChannelGroup
54
import android.os.Build
65
import de.binarynoise.logger.Logger.log
76
import de.binarynoise.reflection.findDeclaredField
@@ -40,12 +39,21 @@ class Hook : IXposedHookLoadPackage {
4039
)
4140
}
4241

43-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
44-
hookVariable(
45-
NotificationChannelGroup::class.java,
46-
"mBlocked",
47-
false,
48-
)
42+
if (lpparam.packageName == "android" && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
43+
tryAndLog("PreferencesHelperClass lockChannelsForOEM") {
44+
val PreferencesHelperClass = Class.forName("com.android.server.notification.PreferencesHelper", false, lpparam.classLoader)
45+
XposedHelpers.findAndHookMethod(
46+
PreferencesHelperClass,
47+
"lockChannelsForOEM",
48+
Array<String>::class.java,
49+
DO_NOTHING,
50+
)
51+
}
52+
tryAndLog("NotificationManagerService NON_BLOCKABLE_DEFAULT_ROLES") {
53+
val NotificationManagerService =
54+
Class.forName("com.android.server.notification.NotificationManagerService", false, lpparam.classLoader)
55+
XposedHelpers.setStaticObjectField(NotificationManagerService, "NON_BLOCKABLE_DEFAULT_ROLES", emptyArray<String>())
56+
}
4957
}
5058
}
5159

0 commit comments

Comments
 (0)