Пример #1
0
 @Override
 public Object call(Object who, Method method, Object... args) throws Throwable {
   if (cacheIndex == -1) {
     cacheIndex = ArrayUtils.indexOfFirst(args, WindowManager.LayoutParams.class);
   }
   if (cacheIndex != -1) {
     WindowManager.LayoutParams attrs = (WindowManager.LayoutParams) args[cacheIndex];
     if (attrs != null) {
       attrs.packageName = getHostPkg();
     }
   }
   return method.invoke(who, args);
 }
 @Override
 public Object call(Object who, Method method, Object... args) throws Throwable {
   String pkg = (String) args[0];
   int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class);
   Notification notification = (Notification) args[notificationIndex];
   NotificationHandler.Result result =
       NotificationHandler.getInstance().dealNotification(getHostContext(), notification, pkg);
   if (result.code == NotificationHandler.RES_NOT_SHOW) {
     return 0;
   } else if (result.code == NotificationHandler.RES_REPLACE) {
     args[notificationIndex] = result.notification;
   }
   args[0] = getHostPkg();
   if (getName().endsWith("WithTag") && Build.VERSION.SDK_INT >= 18 && args[1] instanceof String) {
     args[1] = getHostPkg();
   }
   return method.invoke(who, args);
 }