content: package top.niunaijun.blackbox.core.system.os;
  
  import android.net.Uri;
  import android.os.Process;
  import android.os.RemoteException;
  import android.os.storage.StorageVolume;
  
  import java.io.File;
  
  import black.android.os.storage.BRStorageManager;
  import black.android.os.storage.BRStorageVolume;
  import top.niunaijun.blackbox.BlackBoxCore;
  import top.niunaijun.blackbox.core.env.BEnvironment;
  import top.niunaijun.blackbox.core.system.ISystemService;
  import top.niunaijun.blackbox.core.system.user.BUserHandle;
  import top.niunaijun.blackbox.fake.provider.FileProvider;
  import top.niunaijun.blackbox.proxy.ProxyManifest;
  import top.niunaijun.blackbox.utils.compat.BuildCompat;
  
  /**
   * updated by alex5402 on 4/10/21.
   * * ∧＿∧
   * (`･ω･∥
   * 丶　つ０
   * しーＪ
   * TFNQw5HgWUS33Ke1eNmSFTwoQySGU7XNsK (USDT TRC20)
   */
  public class BStorageManagerService extends IBStorageManagerService.Stub implements ISystemService {
      private static final BStorageManagerService sService = new BStorageManagerService();
  
      public static BStorageManagerService get() {
          return sService;
      }
  
      public BStorageManagerService() {
      }
  
      @Override
      public StorageVolume[] getVolumeList(int uid, String packageName, int flags, int userId) throws RemoteException {
          if (BRStorageManager.get().getVolumeList(0, 0) == null) {
              return null;
          }
          try {
              StorageVolume[] storageVolumes = BRStorageManager.get().getVolumeList(BUserHandle.getUserId(Process.myUid()), 0);
              if (storageVolumes == null)
                  return null;
              for (StorageVolume storageVolume : storageVolumes) {
                  BRStorageVolume.get(storageVolume)._set_mPath(BEnvironment.getExternalUserDir(userId));
                  if (BuildCompat.isPie()) {
                      BRStorageVolume.get(storageVolume)._set_mInternalPath(BEnvironment.getExternalUserDir(userId));
                  }
              }
              return storageVolumes;
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  
      @Override
      public Uri getUriForFile(String file) throws RemoteException {
          return FileProvider.getUriForFile(BlackBoxCore.getContext(), ProxyManifest.getProxyFileProvider(), new File(file));
      }
  
      @Override
      public void systemReady() {
  
      }
  }
  