content: package top.niunaijun.blackbox.core.system;
  
  import android.os.IBinder;
  
  import java.util.HashMap;
  import java.util.Map;
  
  import top.niunaijun.blackbox.BlackBoxCore;
  import top.niunaijun.blackbox.core.system.accounts.BAccountManagerService;
  import top.niunaijun.blackbox.core.system.am.BActivityManagerService;
  import top.niunaijun.blackbox.core.system.am.BJobManagerService;
  import top.niunaijun.blackbox.core.system.location.BLocationManagerService;
  import top.niunaijun.blackbox.core.system.notification.BNotificationManagerService;
  import top.niunaijun.blackbox.core.system.os.BStorageManagerService;
  import top.niunaijun.blackbox.core.system.pm.BPackageManagerService;
  import top.niunaijun.blackbox.core.system.pm.BXposedManagerService;
  import top.niunaijun.blackbox.core.system.user.BUserManagerService;
  
  /**
   * updated by alex5402 on 3/31/21.
   * * ∧＿∧
   * (`･ω･∥
   * 丶　つ０
   * しーＪ
   * TFNQw5HgWUS33Ke1eNmSFTwoQySGU7XNsK (USDT TRC20)
   */
  public class ServiceManager {
      private static ServiceManager sServiceManager = null;
      public static final String ACTIVITY_MANAGER = "activity_manager";
      public static final String JOB_MANAGER = "job_manager";
      public static final String PACKAGE_MANAGER = "package_manager";
      public static final String STORAGE_MANAGER = "storage_manager";
      public static final String USER_MANAGER = "user_manager";
      public static final String XPOSED_MANAGER = "xposed_manager";
      public static final String ACCOUNT_MANAGER = "account_manager";
      public static final String LOCATION_MANAGER = "location_manager";
      public static final String NOTIFICATION_MANAGER = "notification_manager";
  
      private final Map<String, IBinder> mCaches = new HashMap<>();
  
      public static ServiceManager get() {
          if (sServiceManager == null) {
              synchronized (ServiceManager.class) {
                  if (sServiceManager == null) {
                      sServiceManager = new ServiceManager();
                  }
              }
          }
          return sServiceManager;
      }
  
      public static IBinder getService(String name) {
          return get().getServiceInternal(name);
      }
  
      private ServiceManager() {
          mCaches.put(ACTIVITY_MANAGER, BActivityManagerService.get());
          mCaches.put(JOB_MANAGER, BJobManagerService.get());
          mCaches.put(PACKAGE_MANAGER, BPackageManagerService.get());
          mCaches.put(STORAGE_MANAGER, BStorageManagerService.get());
          mCaches.put(USER_MANAGER, BUserManagerService.get());
          mCaches.put(XPOSED_MANAGER, BXposedManagerService.get());
          mCaches.put(ACCOUNT_MANAGER, BAccountManagerService.get());
          mCaches.put(LOCATION_MANAGER, BLocationManagerService.get());
          mCaches.put(NOTIFICATION_MANAGER, BNotificationManagerService.get());
      }
  
      public IBinder getServiceInternal(String name) {
          return mCaches.get(name);
      }
  
      public static void initBlackManager() {
          BlackBoxCore.get().getService(ACTIVITY_MANAGER);
          BlackBoxCore.get().getService(JOB_MANAGER);
          BlackBoxCore.get().getService(PACKAGE_MANAGER);
          BlackBoxCore.get().getService(STORAGE_MANAGER);
          BlackBoxCore.get().getService(USER_MANAGER);
          BlackBoxCore.get().getService(XPOSED_MANAGER);
          BlackBoxCore.get().getService(ACCOUNT_MANAGER);
          BlackBoxCore.get().getService(LOCATION_MANAGER);
          BlackBoxCore.get().getService(NOTIFICATION_MANAGER);
      }
  }
  