@@ -38,26 +38,26 @@ private static void hookNotificationService() {
3838 sHookService = true ;
3939 try {
4040 // 获取到 Toast 中的 getService 静态方法
41- Method getService = Toast .class .getDeclaredMethod ("getService" );
42- getService .setAccessible (true );
41+ Method getServiceMethod = Toast .class .getDeclaredMethod ("getService" );
42+ getServiceMethod .setAccessible (true );
4343 // 执行方法,会返回一个 INotificationManager$Stub$Proxy 类型的对象
44- final Object iNotificationManager = getService .invoke (null );
45- if (iNotificationManager == null ) {
44+ final Object notificationManagerSourceObject = getServiceMethod .invoke (null );
45+ if (notificationManagerSourceObject == null ) {
4646 return ;
4747 }
4848 // 如果这个对象已经被动态代理过了,并且已经 Hook 过了,则不需要重复 Hook
49- if (Proxy .isProxyClass (iNotificationManager .getClass ()) &&
50- Proxy .getInvocationHandler (iNotificationManager ) instanceof NotificationServiceProxy ) {
49+ if (Proxy .isProxyClass (notificationManagerSourceObject .getClass ()) &&
50+ Proxy .getInvocationHandler (notificationManagerSourceObject ) instanceof NotificationServiceProxy ) {
5151 return ;
5252 }
53- Object iNotificationManagerProxy = Proxy .newProxyInstance (
53+ Object notificationManagerProxyObject = Proxy .newProxyInstance (
5454 Thread .currentThread ().getContextClassLoader (),
5555 new Class []{Class .forName ("android.app.INotificationManager" )},
56- new NotificationServiceProxy (iNotificationManager ));
56+ new NotificationServiceProxy (notificationManagerSourceObject ));
5757 // 将原来的 INotificationManager$Stub$Proxy 替换掉
58- Field sService = Toast .class .getDeclaredField ("sService" );
59- sService .setAccessible (true );
60- sService .set (null , iNotificationManagerProxy );
58+ Field serviceField = Toast .class .getDeclaredField ("sService" );
59+ serviceField .setAccessible (true );
60+ serviceField .set (null , notificationManagerProxyObject );
6161 } catch (Exception e ) {
6262 e .printStackTrace ();
6363 }
0 commit comments