content: package top.niunaijun.blackbox.fake.service;
  
  import android.content.Context;
  import android.content.pm.ApplicationInfo;
  
  import java.lang.reflect.Method;
  
  import black.android.os.BRServiceManager;
  import black.android.view.accessibility.BRIAccessibilityManagerStub;
  import top.niunaijun.blackbox.BlackBoxCore;
  import top.niunaijun.blackbox.core.system.user.BUserHandle;
  import top.niunaijun.blackbox.fake.hook.BinderInvocationStub;
  import top.niunaijun.blackbox.fake.hook.MethodHook;
  import top.niunaijun.blackbox.fake.hook.ProxyMethods;
  
  /**
   * updated by alex5402 on 4/25/21.
   * * ∧＿∧
   * (`･ω･∥
   * 丶　つ０
   * しーＪ
   * TFNQw5HgWUS33Ke1eNmSFTwoQySGU7XNsK (USDT TRC20)
   */
  public class IAccessibilityManagerProxy extends BinderInvocationStub {
  
      public IAccessibilityManagerProxy() {
          super(BRServiceManager.get().getService(Context.ACCESSIBILITY_SERVICE));
      }
  
      @Override
      protected Object getWho() {
          return BRIAccessibilityManagerStub.get().asInterface(BRServiceManager.get().getService(Context.ACCESSIBILITY_SERVICE));
      }
  
      @Override
      protected void inject(Object baseInvocation, Object proxyInvocation) {
          replaceSystemService(Context.ACCESSIBILITY_SERVICE);
      }
  
      @Override
      public boolean isBadEnv() {
          return false;
      }
  
      @ProxyMethods({"interrupt", "sendAccessibilityEvent", "addClient",
              "getInstalledAccessibilityServiceList", "getEnabledAccessibilityServiceList",
              "addAccessibilityInteractionConnection", "getWindowToken"})
      public static class ReplaceUserId extends MethodHook {
          @Override
          protected Object hook(Object who, Method method, Object[] args) throws Throwable {
              if (args != null) {
                  int index = args.length - 1;
                  Object arg = args[index];
                  if (arg instanceof Integer) {
                      ApplicationInfo applicationInfo = BlackBoxCore.getContext().getApplicationInfo();
                      args[index] = BUserHandle.getUserId(applicationInfo.uid);
                  }
              }
              return method.invoke(who, args);
          }
      }
  }
  