Skip to content

Commit

Permalink
Fix dispatchIntent signature for Android 11
Browse files Browse the repository at this point in the history
  • Loading branch information
apsun committed Mar 26, 2021
1 parent 7b48b74 commit cc80a28
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,19 @@ private void hookDispatchIntent29(XC_LoadPackage.LoadPackageParam lpparam) {
new DispatchIntentHook(4));
}

private void hookDispatchIntent30(XC_LoadPackage.LoadPackageParam lpparam) {
Xlog.i("Hooking dispatchIntent() for Android v30+");
XposedHelpers.findAndHookMethod(SMS_HANDLER_CLASS, lpparam.classLoader, "dispatchIntent",
/* intent */ Intent.class,
/* permission */ String.class,
/* appOp */ String.class,
/* opts */ Bundle.class,
/* resultReceiver */ BroadcastReceiver.class,
/* user */ UserHandle.class,
/* subId */ int.class,
new DispatchIntentHook(4));
}

private void hookConstructor(XC_LoadPackage.LoadPackageParam lpparam) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
hookConstructor30(lpparam);
Expand All @@ -351,7 +364,9 @@ private void hookConstructor(XC_LoadPackage.LoadPackageParam lpparam) {
}

private void hookDispatchIntent(XC_LoadPackage.LoadPackageParam lpparam) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
hookDispatchIntent30(lpparam);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
try {
hookDispatchIntent29(lpparam);
} catch (NoSuchMethodError e) {
Expand Down

0 comments on commit cc80a28

Please sign in to comment.