Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c998b7f7 authored by Daniel Nishi's avatar Daniel Nishi Committed by Android (Google) Code Review
Browse files

Merge "Add the new package stats query to wrapper."

parents 18d62bec 2e5a68c3
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.usage.StorageStats;
import android.app.usage.StorageStatsManager;
import android.content.Context;
import android.os.UserHandle;
import android.support.annotation.VisibleForTesting;

/**
 * StorageStatsSource wraps the StorageStatsManager for testability purposes.
@@ -40,6 +41,12 @@ public class StorageStatsSource {
        return new StorageStatsSource.AppStorageStatsImpl(mStorageStatsManager.queryStatsForUid(volumeUuid, uid));
    }

    public StorageStatsSource.AppStorageStats getStatsForPackage(
            String volumeUuid, String packageName, UserHandle user) {
        return new StorageStatsSource.AppStorageStatsImpl(
                mStorageStatsManager.queryStatsForPackage(volumeUuid, packageName, user));
    }

    /**
     * Static class that provides methods for querying the amount of external storage available as
     * well as breaking it up into several media types.
@@ -50,11 +57,10 @@ public class StorageStatsSource {
        public long videoBytes;
        public long imageBytes;

        /**
         * Convenience method for testing.
         */
        public ExternalStorageStats(long totalBytes, long audioBytes, long videoBytes,
                long imageBytes) {
        /** Convenience method for testing. */
        @VisibleForTesting
        public ExternalStorageStats(
                long totalBytes, long audioBytes, long videoBytes, long imageBytes) {
            this.totalBytes = totalBytes;
            this.audioBytes = audioBytes;
            this.videoBytes = videoBytes;