Exemplo n.º 1
0
 @Override
 public Object onHook(Object who, Method method, Object... args) throws Throwable {
   HookUtils.replaceFirstAppPkg(args);
   args[IDX_RequiredPermission] = null;
   IntentFilter filter = (IntentFilter) args[IDX_IntentFilter];
   modifyIntentFilter(filter);
   if (args.length > IDX_IIntentReceiver
       && IIntentReceiver.class.isInstance(args[IDX_IIntentReceiver])) {
     final IInterface old = (IInterface) args[IDX_IIntentReceiver];
     if (!ProxyIIntentReceiver.class.isInstance(old)) {
       final IBinder token = old.asBinder();
       if (token != null) {
         token.linkToDeath(
             new IBinder.DeathRecipient() {
               @Override
               public void binderDied() {
                 token.unlinkToDeath(this, 0);
                 mProxyIIntentReceiver.remove(token);
               }
             },
             0);
         IIntentReceiver proxyIIntentReceiver = mProxyIIntentReceiver.get(token);
         if (proxyIIntentReceiver == null) {
           proxyIIntentReceiver = new ProxyIIntentReceiver(old);
           mProxyIIntentReceiver.put(token, proxyIIntentReceiver);
         }
         WeakReference mDispatcher =
             LoadedApk.ReceiverDispatcher.InnerReceiver.mDispatcher.get(old);
         LoadedApk.ReceiverDispatcher.mIIntentReceiver.set(
             mDispatcher.get(), proxyIIntentReceiver);
         args[IDX_IIntentReceiver] = proxyIIntentReceiver;
       }
     }
   }
   return method.invoke(who, args);
 }
Exemplo n.º 2
0
 @Override
 public Object onHook(Object who, Method method, Object... args) throws Throwable {
   HookUtils.replaceFirstAppPkg(args);
   return method.invoke(who, args);
 }