@@ -2,11 +2,8 @@ package de.binarynoise.freeNotifications
22
33import android.app.NotificationChannel
44import android.app.NotificationChannelGroup
5- import android.app.role.RoleManager
65import android.content.Context
76import android.content.pm.ApplicationInfo
8- import android.content.pm.PackageInfo
9- import android.content.pm.PackageManager
107import android.os.Build
118import de.robv.android.xposed.IXposedHookLoadPackage
129import de.robv.android.xposed.XC_MethodHook
@@ -123,23 +120,6 @@ class SettingsHook : IXposedHookLoadPackage {
123120 )
124121 }
125122 }
126- tryAndLog(" recordCanBeBlocked" ) {
127- XposedHelpers .findAndHookMethod(
128- NotificationBackendClass ,
129- " recordCanBeBlocked" ,
130- Context ::class .java,
131- PackageManager ::class .java,
132- RoleManager ::class .java,
133- PackageInfo ::class .java,
134- AppRowClass ,
135- object : XC_MethodHook () {
136- override fun afterHookedMethod (param : MethodHookParam ) {
137- val row = param.args[4 ]
138- XposedHelpers .setBooleanField(row, " systemApp" , false )
139- }
140- },
141- )
142- }
143123 tryAndLog(" markAppRowWithBlockables" ) {
144124 XposedHelpers .findAndHookMethod(
145125 NotificationBackendClass ,
@@ -156,6 +136,17 @@ class SettingsHook : IXposedHookLoadPackage {
156136 )
157137 }
158138 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
139+ tryAndLog(" recordCanBeBlocked" ) {
140+ XposedBridge .hookMethod(
141+ NotificationBackendClass .declaredMethods.single { it.name == " recordCanBeBlocked" },
142+ object : XC_MethodHook () {
143+ override fun afterHookedMethod (param : MethodHookParam ) {
144+ val row = param.args.last()
145+ XposedHelpers .setBooleanField(row, " systemApp" , false )
146+ }
147+ },
148+ )
149+ }
159150 tryAndLog(" isSystemApp" ) {
160151 XposedHelpers .findAndHookMethod(
161152 NotificationBackendClass ,
0 commit comments