Follow storage API polishing.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 37325923, 35812899, 35806020
Change-Id: I4965b7391018354157f0683a643a14c5e9cd338d
This commit is contained in:
Jeff Sharkey
2017-04-17 09:31:33 -06:00
parent 339d117b46
commit b80f1ddaf0
7 changed files with 32 additions and 11 deletions

View File

@@ -23,6 +23,7 @@ import static android.content.pm.ApplicationInfo.CATEGORY_VIDEO;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.UserInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.UserHandle;
import android.util.Log;
import android.util.SparseArray;
@@ -32,6 +33,7 @@ import com.android.settings.applications.UserManagerWrapper;
import com.android.settings.utils.AsyncLoader;
import com.android.settingslib.applications.StorageStatsSource;
import java.io.IOException;
import java.util.List;
/**
@@ -83,7 +85,7 @@ public class StorageAsyncLoader
StorageStatsSource.AppStorageStats stats;
try {
stats = mStatsManager.getStatsForPackage(mUuid, app.packageName, myUser);
} catch (IllegalStateException e) {
} catch (NameNotFoundException | IOException e) {
// This may happen if the package was removed during our calculation.
Log.w("App unexpectedly not found", e);
continue;
@@ -122,7 +124,11 @@ public class StorageAsyncLoader
}
Log.d(TAG, "Loading external stats");
result.externalStats = mStatsManager.getExternalStorageStats(mUuid, UserHandle.of(userId));
try {
result.externalStats = mStatsManager.getExternalStorageStats(mUuid, UserHandle.of(userId));
} catch (IOException e) {
Log.w(TAG, e);
}
Log.d(TAG, "Obtaining result completed");
return result;
}