// Path: app/src/main/java/com/google/android/diskusage/datasource/AppStatsCallback.java
// public interface AppStatsCallback {
//    void onGetStatsCompleted(AppStats stats, boolean succeeded);
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/DataSource.java
// public abstract class DataSource {
//   private static DataSource currentDataSource = new DefaultDataSource();
// 
//   public static DataSource get() {
//     return currentDataSource;
//   }
// 
//   public static void override(DataSource dataSource) {
//     LoadableActivity.resetStoredStates();
//     currentDataSource = dataSource;
//   }
// 
//   public abstract int getAndroidVersion();
// 
//   public abstract List<PkgInfo> getInstalledPackages(PackageManager pm);
// 
//   public abstract StatFsSource statFs(String mountPoint);
// 
//   @TargetApi(Build.VERSION_CODES.FROYO)
//   public abstract PortableFile getExternalFilesDir(Context context);
//   @TargetApi(Build.VERSION_CODES.KITKAT)
//   public abstract PortableFile[] getExternalFilesDirs(Context context);
// 
//   public abstract PortableFile getExternalStorageDirectory();
// 
//   public abstract InputStream createNativeScanner(
//       Context context, String path,
//       boolean rootRequired) throws IOException, InterruptedException;
// 
//   public abstract boolean isDeviceRooted();
// 
//   public abstract LegacyFile createLegacyScanFile(String root);
// 
//   public final BufferedReader getProcReader() throws IOException {
//     return new BufferedReader(new InputStreamReader(getProc()));
//   }
// 
//   public abstract InputStream getProc() throws IOException;
// 
//   public abstract void getPackageSizeInfo(
//       PkgInfo pkgInfo,
//       Method getPackageSizeInfo,
//       PackageManager pm,
//       AppStatsCallback callback) throws Exception;
// 
//   public abstract PortableFile getParentFile(PortableFile file);
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/LegacyFile.java
// public interface LegacyFile {
//   String getName();
//   String getCannonicalPath() throws IOException;
// 
//   boolean isLink();
//   boolean isFile();
//   long length();
// 
//   LegacyFile[] listFiles();
//   String[] list();
// 
//   LegacyFile getChild(String string);
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/PkgInfo.java
// public interface PkgInfo {
//   String getPackageName();
//   AppInfo getApplicationInfo();
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/PortableFile.java
// public interface PortableFile {
//   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
//   boolean isExternalStorageEmulated();
//   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
//   boolean isExternalStorageRemovable();
// 
//   /** Retries with getAbsolutePath() on IOException */
//   String getCanonicalPath();
//   String getAbsolutePath();
// 
//   @TargetApi(Build.VERSION_CODES.GINGERBREAD)
//   long getTotalSpace();
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/StatFsSource.java
// public interface StatFsSource {
// 
//   @Deprecated
//   int getAvailableBlocks();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getAvailableBlocksLong();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getAvailableBytes();
// 
//   @Deprecated
//   public int getBlockCount();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getBlockCountLong();
// 
//   @Deprecated
//   public int getBlockSize();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getBlockSizeLong();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getFreeBytes();
// 
//   @Deprecated
//   public int getFreeBlocks();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getFreeBlocksLong();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getTotalBytes();
// }


import com.google.android.diskusage.datasource.AppStatsCallback;
import com.google.android.diskusage.datasource.DataSource;
import com.google.android.diskusage.datasource.LegacyFile;
import com.google.android.diskusage.datasource.PkgInfo;
import com.google.android.diskusage.datasource.PortableFile;
import com.google.android.diskusage.datasource.StatFsSource;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageStats;
import android.os.Build;
import android.os.Environment;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
  }

  @Override
  public boolean isDeviceRooted() {
    String pathEnv = System.getenv("PATH");
    if (pathEnv != null) {
      String[] searchPaths = pathEnv.split(":");
      for (String path : searchPaths) {
        if (path.length() == 0) {
          continue;
        }
        String suPath = path + "/su";
        File suFile = new File(suPath);
        if (suFile.exists() && !suFile.isDirectory()) {
          return true;
        }
      }
    }

    return new File("/system/bin/su").isFile()
        || new File("/system/xbin/su").isFile();
  }

  @Override
  public LegacyFile createLegacyScanFile(String root) {
    return LegacyFileImpl.createRoot(root);
  }

  @Override
  public void getPackageSizeInfo(
// Path: app/src/main/java/com/google/android/diskusage/datasource/AppStatsCallback.java
// public interface AppStatsCallback {
//    void onGetStatsCompleted(AppStats stats, boolean succeeded);
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/DataSource.java
// public abstract class DataSource {
//   private static DataSource currentDataSource = new DefaultDataSource();
// 
//   public static DataSource get() {
//     return currentDataSource;
//   }
// 
//   public static void override(DataSource dataSource) {
//     LoadableActivity.resetStoredStates();
//     currentDataSource = dataSource;
//   }
// 
//   public abstract int getAndroidVersion();
// 
//   public abstract List<PkgInfo> getInstalledPackages(PackageManager pm);
// 
//   public abstract StatFsSource statFs(String mountPoint);
// 
//   @TargetApi(Build.VERSION_CODES.FROYO)
//   public abstract PortableFile getExternalFilesDir(Context context);
//   @TargetApi(Build.VERSION_CODES.KITKAT)
//   public abstract PortableFile[] getExternalFilesDirs(Context context);
// 
//   public abstract PortableFile getExternalStorageDirectory();
// 
//   public abstract InputStream createNativeScanner(
//       Context context, String path,
//       boolean rootRequired) throws IOException, InterruptedException;
// 
//   public abstract boolean isDeviceRooted();
// 
//   public abstract LegacyFile createLegacyScanFile(String root);
// 
//   public final BufferedReader getProcReader() throws IOException {
//     return new BufferedReader(new InputStreamReader(getProc()));
//   }
// 
//   public abstract InputStream getProc() throws IOException;
// 
//   public abstract void getPackageSizeInfo(
//       PkgInfo pkgInfo,
//       Method getPackageSizeInfo,
//       PackageManager pm,
//       AppStatsCallback callback) throws Exception;
// 
//   public abstract PortableFile getParentFile(PortableFile file);
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/LegacyFile.java
// public interface LegacyFile {
//   String getName();
//   String getCannonicalPath() throws IOException;
// 
//   boolean isLink();
//   boolean isFile();
//   long length();
// 
//   LegacyFile[] listFiles();
//   String[] list();
// 
//   LegacyFile getChild(String string);
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/PkgInfo.java
// public interface PkgInfo {
//   String getPackageName();
//   AppInfo getApplicationInfo();
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/PortableFile.java
// public interface PortableFile {
//   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
//   boolean isExternalStorageEmulated();
//   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
//   boolean isExternalStorageRemovable();
// 
//   /** Retries with getAbsolutePath() on IOException */
//   String getCanonicalPath();
//   String getAbsolutePath();
// 
//   @TargetApi(Build.VERSION_CODES.GINGERBREAD)
//   long getTotalSpace();
// }
// 
// Path: app/src/main/java/com/google/android/diskusage/datasource/StatFsSource.java
// public interface StatFsSource {
// 
//   @Deprecated
//   int getAvailableBlocks();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getAvailableBlocksLong();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getAvailableBytes();
// 
//   @Deprecated
//   public int getBlockCount();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getBlockCountLong();
// 
//   @Deprecated
//   public int getBlockSize();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getBlockSizeLong();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getFreeBytes();
// 
//   @Deprecated
//   public int getFreeBlocks();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getFreeBlocksLong();
// 
//   @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
//   public long getTotalBytes();
// }


// Path: app/src/main/java/com/google/android/diskusage/datasource/fast/DefaultDataSource.java
import com.google.android.diskusage.datasource.AppStatsCallback;
import com.google.android.diskusage.datasource.DataSource;
import com.google.android.diskusage.datasource.LegacyFile;
import com.google.android.diskusage.datasource.PkgInfo;
import com.google.android.diskusage.datasource.PortableFile;
import com.google.android.diskusage.datasource.StatFsSource;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageStats;
import android.os.Build;
import android.os.Environment;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

  }

  @Override
  public boolean isDeviceRooted() {
    String pathEnv = System.getenv("PATH");
    if (pathEnv != null) {
      String[] searchPaths = pathEnv.split(":");
      for (String path : searchPaths) {
        if (path.length() == 0) {
          continue;
        }
        String suPath = path + "/su";
        File suFile = new File(suPath);
        if (suFile.exists() && !suFile.isDirectory()) {
          return true;
        }
      }
    }

    return new File("/system/bin/su").isFile()
        || new File("/system/xbin/su").isFile();
  }

  @Override
  public LegacyFile createLegacyScanFile(String root) {
    return LegacyFileImpl.createRoot(root);
  }

  @Override
  public void getPackageSizeInfo(
      PkgInfo pkgInfo,