From 2e5a68c319aaa0a19313c2f7689f2665fe74e264 Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Fri, 24 Feb 2017 10:28:31 -0800 Subject: [PATCH] Add the new package stats query to wrapper. Bug: 35754646 Test: Settings unit test Change-Id: I4b3cb93817ab998e9508c49c1aced66f6378806c --- .../applications/StorageStatsSource.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/StorageStatsSource.java b/packages/SettingsLib/src/com/android/settingslib/applications/StorageStatsSource.java index acb0650ff71e7..21835738fd692 100644 --- a/packages/SettingsLib/src/com/android/settingslib/applications/StorageStatsSource.java +++ b/packages/SettingsLib/src/com/android/settingslib/applications/StorageStatsSource.java @@ -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;