@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } return VNotificationManager.get().areNotificationsEnabledForPackage(pkg, getAppUserId()); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int enableIndex = ArrayUtils.indexOfFirst(args, Boolean.class); boolean enable = (boolean) args[enableIndex]; VNotificationManager.get().setNotificationsEnabledForPackage(pkg, enable, getAppUserId()); return 0; } }
@Override public void inject() throws Throwable { NotificationManager.sService.set(getInvocationStub().getProxyInterface()); Toast.sService.set(getInvocationStub().getProxyInterface()); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = MethodParameterUtils.replaceFirstAppPkg(args); if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } String tag = (String) args[1]; int id = (int) args[2]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[1] = tag; args[2] = id; return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class); int idIndex = ArrayUtils.indexOfFirst(args, Integer.class); int id = (int) args[idIndex]; id = VNotificationManager.get().dealNotificationId(id, pkg, null, getAppUserId()); args[idIndex] = id; Notification notification = (Notification) args[notificationIndex]; if (!VNotificationManager.get().dealNotification(id, notification, pkg)) { return 0; } VNotificationManager.get().addNotification(id, null, pkg, getAppUserId()); args[0] = getHostPkg(); return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class); int idIndex = ArrayUtils.indexOfFirst(args, Integer.class); int tagIndex = (Build.VERSION.SDK_INT >= 18 ? 2 : 1); int id = (int) args[idIndex]; String tag = (String) args[tagIndex]; id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId()); tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId()); args[idIndex] = id; args[tagIndex] = tag; //key(tag,id) Notification notification = (Notification) args[notificationIndex]; if (!VNotificationManager.get().dealNotification(id, notification, pkg)) { return 0; } VNotificationManager.get().addNotification(id, tag, pkg, getAppUserId()); args[0] = getHostPkg(); if (Build.VERSION.SDK_INT >= 18 && args[1] instanceof String) { args[1] = getHostPkg(); } return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = MethodParameterUtils.replaceFirstAppPkg(args); if (VirtualCore.get().isAppInstalled(pkg)) { VNotificationManager.get().cancelAllNotification(pkg, getAppUserId()); return 0; } return method.invoke(who, args); } }
@Override protected void onBindMethods() { super.onBindMethods(); addMethodProxy(new ReplaceCallingPkgMethodProxy("enqueueToast")); addMethodProxy(new ReplaceCallingPkgMethodProxy("cancelToast")); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { addMethodProxy(new ReplaceCallingPkgMethodProxy("removeAutomaticZenRules")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getImportance")); addMethodProxy(new ReplaceCallingPkgMethodProxy("areNotificationsEnabled")); addMethodProxy(new ReplaceCallingPkgMethodProxy("setNotificationPolicy")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getNotificationPolicy")); addMethodProxy(new ReplaceCallingPkgMethodProxy("isNotificationPolicyAccessGrantedForPackage")); } // http://androidxref.com/8.0.0_r4/xref/frameworks/base/core/java/android/app/INotificationManager.aidl if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { addMethodProxy(new ReplaceCallingPkgMethodProxy("createNotificationChannelGroups")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getNotificationChannelGroups")); addMethodProxy(new ReplaceCallingPkgMethodProxy("deleteNotificationChannelGroup")); addMethodProxy(new ReplaceCallingPkgMethodProxy("createNotificationChannels")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getNotificationChannels")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getNotificationChannel")); addMethodProxy(new ReplaceCallingPkgMethodProxy("deleteNotificationChannel")); } if (DeviceUtil.isSamsung()) { addMethodProxy(new ReplaceCallingPkgMethodProxy("removeEdgeNotification")); } }
addInjector(new ISubStub()); addInjector(new DropBoxManagerStub()); addInjector(new NotificationManagerStub()); addInjector(new LocationManagerStub()); addInjector(new WindowManagerStub());
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } return VNotificationManager.get().areNotificationsEnabledForPackage(pkg, getAppUserId()); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int enableIndex = ArrayUtils.indexOfFirst(args, Boolean.class); boolean enable = (boolean) args[enableIndex]; VNotificationManager.get().setNotificationsEnabledForPackage(pkg, enable, getAppUserId()); return 0; } }
@Override public boolean isEnvBad() { return NotificationManager.getService.call() != getInvocationStub().getProxyInterface(); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = MethodParameterUtils.replaceFirstAppPkg(args); if (VirtualCore.get().isAppInstalled(pkg)) { VNotificationManager.get().cancelAllNotification(pkg, getAppUserId()); return 0; } return method.invoke(who, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } return VNotificationManager.get().areNotificationsEnabledForPackage(pkg, getAppUserId()); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = (String) args[0]; if (getHostPkg().equals(pkg)) { return method.invoke(who, args); } int enableIndex = ArrayUtils.indexOfFirst(args, Boolean.class); boolean enable = (boolean) args[enableIndex]; VNotificationManager.get().setNotificationsEnabledForPackage(pkg, enable, getAppUserId()); return 0; } }
@Override public void inject() throws Throwable { NotificationManager.sService.set(getInvocationStub().getProxyInterface()); Toast.sService.set(getInvocationStub().getProxyInterface()); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { String pkg = MethodParameterUtils.replaceFirstAppPkg(args); if (VirtualCore.get().isAppInstalled(pkg)) { VNotificationManager.get().cancelAllNotification(pkg, getAppUserId()); return 0; } return method.invoke(who, args); } }
@Override public void inject() throws Throwable { NotificationManager.sService.set(getInvocationStub().getProxyInterface()); Toast.sService.set(getInvocationStub().getProxyInterface()); }
@Override public boolean isEnvBad() { return NotificationManager.getService.call() != getInvocationStub().getProxyInterface(); } }
@Override public boolean isEnvBad() { return NotificationManager.getService.call() != getInvocationStub().getProxyInterface(); } }