diff options
author | 2017-03-14 11:02:33 -0600 | |
---|---|---|
committer | 2017-03-14 11:03:09 -0600 | |
commit | 6bb5d0fabbe9dfce3d1da8ae94bc1de470e01bb0 (patch) | |
tree | b7800697f4af8b47bacd1c787fe0e0755058c1eb | |
parent | b94427d2855c4fc5b62890fdb99ceca140b5034d (diff) |
Allow querying for apps on adopted storage.
Apps that live on adopted storage devices appear to be uninstalled
while ejected. They're technically still valid apps, with allocated
UIDs, so use MATCH_UNINSTALLED_PACKAGES when querying for their
details.
Test: builds, boots
Bug: 36177795
Change-Id: Ia7ed5f0462b1f47609ea8e1ace6fa145e0b5602c
-rw-r--r-- | services/usage/java/com/android/server/usage/StorageStatsService.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/services/usage/java/com/android/server/usage/StorageStatsService.java b/services/usage/java/com/android/server/usage/StorageStatsService.java index ebd4b019790a..ecc2b7f0577a 100644 --- a/services/usage/java/com/android/server/usage/StorageStatsService.java +++ b/services/usage/java/com/android/server/usage/StorageStatsService.java @@ -208,7 +208,8 @@ public class StorageStatsService extends IStorageStatsManager.Stub { final ApplicationInfo appInfo; try { - appInfo = mPackage.getApplicationInfoAsUser(packageName, 0, userId); + appInfo = mPackage.getApplicationInfoAsUser(packageName, + PackageManager.MATCH_UNINSTALLED_PACKAGES, userId); } catch (NameNotFoundException e) { throw new IllegalStateException(e); } @@ -251,8 +252,8 @@ public class StorageStatsService extends IStorageStatsManager.Stub { for (int i = 0; i < packageNames.length; i++) { try { - codePaths[i] = mPackage.getApplicationInfoAsUser(packageNames[i], 0, - userId).getCodePath(); + codePaths[i] = mPackage.getApplicationInfoAsUser(packageNames[i], + PackageManager.MATCH_UNINSTALLED_PACKAGES, userId).getCodePath(); } catch (NameNotFoundException e) { throw new IllegalStateException(e); } @@ -284,7 +285,8 @@ public class StorageStatsService extends IStorageStatsManager.Stub { } int[] appIds = null; - for (ApplicationInfo app : mPackage.getInstalledApplicationsAsUser(0, userId)) { + for (ApplicationInfo app : mPackage.getInstalledApplicationsAsUser( + PackageManager.MATCH_UNINSTALLED_PACKAGES, userId)) { final int appId = UserHandle.getAppId(app.uid); if (!ArrayUtils.contains(appIds, appId)) { appIds = ArrayUtils.appendInt(appIds, appId); |