content: package top.niunaijun.blackbox.fake.service;
  
  import android.app.ActivityManager;
  
  import java.lang.reflect.Method;
  
  import black.android.app.BRActivityTaskManager;
  import black.android.app.BRIActivityTaskManagerStub;
  import black.android.os.BRServiceManager;
  import black.android.util.BRSingleton;
  import top.niunaijun.blackbox.fake.hook.BinderInvocationStub;
  import top.niunaijun.blackbox.fake.hook.MethodHook;
  import top.niunaijun.blackbox.fake.hook.ProxyMethod;
  import top.niunaijun.blackbox.fake.hook.ScanClass;
  import top.niunaijun.blackbox.utils.compat.TaskDescriptionCompat;
  
  /**
   * updated by alex5402 on 3/31/21.
   * * ∧＿∧
   * (`･ω･∥
   * 丶　つ０
   * しーＪ
   * TFNQw5HgWUS33Ke1eNmSFTwoQySGU7XNsK (USDT TRC20)
   */
  @ScanClass(ActivityManagerCommonProxy.class)
  public class IActivityTaskManagerProxy extends BinderInvocationStub {
      public static final String TAG = "ActivityTaskManager";
  
      public IActivityTaskManagerProxy() {
          super(BRServiceManager.get().getService("activity_task"));
      }
  
      @Override
      protected Object getWho() {
          return BRIActivityTaskManagerStub.get().asInterface(BRServiceManager.get().getService("activity_task"));
      }
  
      @Override
      protected void inject(Object baseInvocation, Object proxyInvocation) {
          replaceSystemService("activity_task");
          BRActivityTaskManager.get().getService();
          Object o = BRActivityTaskManager.get().IActivityTaskManagerSingleton();
          BRSingleton.get(o)._set_mInstance(BRIActivityTaskManagerStub.get().asInterface(this));
      }
  
      @Override
      public boolean isBadEnv() {
          return false;
      }
  
      // for >= Android 10 && < Android 12
      @ProxyMethod("setTaskDescription")
      public static class SetTaskDescription extends MethodHook {
          @Override
          protected Object hook(Object who, Method method, Object[] args) throws Throwable {
              ActivityManager.TaskDescription td = (ActivityManager.TaskDescription) args[1];
              args[1] = TaskDescriptionCompat.fix(td);
              return method.invoke(who, args);
          }
      }
  }
  