@@ -12,12 +12,15 @@ import de.robv.android.xposed.XposedHelpers.findClass
1212import de.robv.android.xposed.XposedHelpers.findMethodExact
1313import one.yufz.hmspush.common.ANDROID_PACKAGE_NAME
1414import one.yufz.hmspush.common.HMS_PACKAGE_NAME
15+ import one.yufz.hmspush.hook.XLog
1516import one.yufz.xposed.HookCallback
1617import one.yufz.xposed.HookContext
1718import one.yufz.xposed.hook
1819import one.yufz.xposed.hookMethod
1920
2021object NmsPermissionHooker {
22+ private const val TAG = " NmsPermissionHooker"
23+
2124 private fun fromHms () = try {
2225 Binder .getCallingUid() == getPackageUid(HMS_PACKAGE_NAME )
2326 } catch (e: Throwable ) {
@@ -108,11 +111,17 @@ object NmsPermissionHooker {
108111 }
109112 }
110113 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .UPSIDE_DOWN_CAKE ) {
111- findClass(" com.android.server.notification.PreferencesHelper" , classINotificationManager.classLoader)
112- // public boolean deleteNotificationChannel(String pkg, int uid, String channelId, int callingUid, boolean fromSystemOrSystemUi)
113- .hookMethod(" deleteNotificationChannel" , String ::class .java, Int ::class .java, String ::class .java, Int ::class .java, Boolean ::class .java,
114- callback = deleteNotificationChannelHook
115- )
114+ try {
115+ findClass(" com.android.server.notification.PreferencesHelper" , classINotificationManager.classLoader)
116+ // public boolean deleteNotificationChannel(String pkg, int uid, String channelId, int callingUid, boolean fromSystemOrSystemUi)
117+ .hookMethod(
118+ " deleteNotificationChannel" , String ::class .java, Int ::class .java, String ::class .java, Int ::class .java, Boolean ::class .java,
119+ callback = deleteNotificationChannelHook
120+ )
121+ } catch (e: NoSuchMethodError ) {
122+ // Samsung One UI 7 delete this method
123+ XLog .d(TAG , " hook deleteNotificationChannel error, NoSuchMethodError" )
124+ }
116125 } else if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
117126 findClass(" com.android.server.notification.PreferencesHelper" , classINotificationManager.classLoader)
118127 // public boolean deleteNotificationChannel(String pkg, int uid, String channelId)
0 commit comments