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

Commit 2e5a68c3 authored by Daniel Nishi's avatar Daniel Nishi
Browse files

Add the new package stats query to wrapper.

Bug: 35754646
Test: Settings unit test
Change-Id: I4b3cb93817ab998e9508c49c1aced66f6378806c
parent 90f096f4
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;