@@ -1228,14 +1228,14 @@ public boolean isEnable() {
1228
1228
1229
1229
1230
1230
static class RegisterReceiver extends MethodProxy {
1231
- private static final int IDX_IIntentReceiver = Build .VERSION .SDK_INT >= Build .VERSION_CODES .ICE_CREAM_SANDWICH_MR1
1231
+ protected int mIIntentReceiverIndex = Build .VERSION .SDK_INT >= Build .VERSION_CODES .ICE_CREAM_SANDWICH_MR1
1232
1232
? 2
1233
1233
: 1 ;
1234
1234
1235
- private static final int IDX_RequiredPermission = Build .VERSION .SDK_INT >= Build .VERSION_CODES .ICE_CREAM_SANDWICH_MR1
1235
+ protected int mRequiredPermissionIndex = Build .VERSION .SDK_INT >= Build .VERSION_CODES .ICE_CREAM_SANDWICH_MR1
1236
1236
? 4
1237
1237
: 3 ;
1238
- private static final int IDX_IntentFilter = Build .VERSION .SDK_INT >= Build .VERSION_CODES .ICE_CREAM_SANDWICH_MR1
1238
+ protected int mIntentFilterIndex = Build .VERSION .SDK_INT >= Build .VERSION_CODES .ICE_CREAM_SANDWICH_MR1
1239
1239
? 3
1240
1240
: 2 ;
1241
1241
@@ -1249,11 +1249,11 @@ public String getMethodName() {
1249
1249
@ Override
1250
1250
public Object call (Object who , Method method , Object ... args ) throws Throwable {
1251
1251
MethodParameterUtils .replaceFirstAppPkg (args );
1252
- args [IDX_RequiredPermission ] = null ;
1253
- IntentFilter filter = (IntentFilter ) args [IDX_IntentFilter ];
1252
+ args [mRequiredPermissionIndex ] = null ;
1253
+ IntentFilter filter = (IntentFilter ) args [mIntentFilterIndex ];
1254
1254
SpecialComponentList .protectIntentFilter (filter );
1255
- if (args .length > IDX_IIntentReceiver && IIntentReceiver .class .isInstance (args [IDX_IIntentReceiver ])) {
1256
- final IInterface old = (IInterface ) args [IDX_IIntentReceiver ];
1255
+ if (args .length > mIIntentReceiverIndex && IIntentReceiver .class .isInstance (args [mIIntentReceiverIndex ])) {
1256
+ final IInterface old = (IInterface ) args [mIIntentReceiverIndex ];
1257
1257
if (!IIntentReceiverProxy .class .isInstance (old )) {
1258
1258
final IBinder token = old .asBinder ();
1259
1259
if (token != null ) {
@@ -1272,7 +1272,7 @@ public void binderDied() {
1272
1272
WeakReference mDispatcher = LoadedApk .ReceiverDispatcher .InnerReceiver .mDispatcher .get (old );
1273
1273
if (mDispatcher != null ) {
1274
1274
LoadedApk .ReceiverDispatcher .mIIntentReceiver .set (mDispatcher .get (), proxyIIntentReceiver );
1275
- args [IDX_IIntentReceiver ] = proxyIIntentReceiver ;
1275
+ args [mIIntentReceiverIndex ] = proxyIIntentReceiver ;
1276
1276
}
1277
1277
}
1278
1278
}
@@ -1762,4 +1762,19 @@ public GetPackageProcessState() {
1762
1762
super ("getPackageProcessState" );
1763
1763
}
1764
1764
}
1765
+
1766
+ // For Android 11
1767
+ static class RegisterReceiverWithFeature extends RegisterReceiver {
1768
+ public RegisterReceiverWithFeature () {
1769
+ // http://aospxref.com/android-11.0.0_r21/xref/frameworks/base/core/java/android/app/IActivityManager.aidl?fi=IActivityManager#124
1770
+ mIIntentReceiverIndex = 3 ;
1771
+ mIntentFilterIndex = 4 ;
1772
+ mRequiredPermissionIndex = 5 ;
1773
+ }
1774
+
1775
+ @ Override
1776
+ public String getMethodName () {
1777
+ return "registerReceiverWithFeature" ;
1778
+ }
1779
+ }
1765
1780
}
0 commit comments