private static File findFirstApkFile(File file) {
    if (isApkFile(file)) return file;
    if (!file.isDirectory()) return null;
    final File[] files = file.listFiles();
    if (files == null || files.length == 0) {
      return null;
    }
    for (File f : files) {
      if (isApkFile(f)) return f;
    }
    return null;
  }
Directory where installed applications are stored
android/android_framework/patch-magisk/bridge/src/main/java/github/tornaco/android/thanox/magisk/bridge/util/PackageUtils.java