@Override public Object invoke(Object proxy, Method method, Object[] args)throws Throwable { Log.d(TAG, "hey, baby; you are hooked!!"); Log.d(TAG, "method:" + method.getName() + " called with args:" + Arrays.toString(args));
return method.invoke(mBase, args); } }
当IActivityManager触发调用时,invoke回调,这个时候会打印出添加的内容
1 2
10-0416:04:13.09217046-17046/cn.binea.pluginframeworkdemo D/HookHandler: hey, baby; you are hooked!! 10-0416:04:13.09317046-17046/cn.binea.pluginframeworkdemo D/HookHandler: method:activityIdle called with args:[android.os.BinderProxy@e0086ab, {1.0 310mcc260mnc [en_US] ldltr sw360dp w360dp h568dp 480dpi nrml port finger qwerty/v/v -nav/h s.6}, false]
PMS
1 2 3 4 5 6 7 8 9 10 11 12 13 14
@Override public PackageManager getPackageManager() { if (mPackageManager != null) { return mPackageManager; }
IPackageManagerpm= ActivityThread.getPackageManager(); if (pm != null) { // Doesn't matter if we make more than one instance. return (mPackageManager = newApplicationPackageManager(this, pm)); }