Merge "Follow storage API polishing." into oc-dev am: e398a84199
am: 4ecbc32b48
Change-Id: Ie47474e46fa6ebfffdddad04ab8c99b332c4f8cc
This commit is contained in:
@@ -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.
|
||||
continue;
|
||||
}
|
||||
@@ -121,7 +123,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user