diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-05-10 14:53:34 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2015-05-10 14:53:37 -0700 |
commit | fced534dec1088bdd7da1495d76b73996dc8a1a1 (patch) | |
tree | d4e1456e1811affe05ec7a2e2a0182e25aa380ce /core | |
parent | a2e26b49539af04ea9d13eb3178f710b496e88bc (diff) | |
download | frameworks_base-fced534dec1088bdd7da1495d76b73996dc8a1a1.zip frameworks_base-fced534dec1088bdd7da1495d76b73996dc8a1a1.tar.gz frameworks_base-fced534dec1088bdd7da1495d76b73996dc8a1a1.tar.bz2 |
Fix devices with primary physical storage.
Always assume the factory-reset default primary storage before parsing
storage settings. Without this, we'd always default to picking
internal emulated storage during first boot or upgrade.
Bump version code to re-evaluate this for devices that default to
physical storage as primary.
Also restrict available move targets when storage is physical, since
we can't really translate between multi-user and non-multi-user aware
storage.
Bug: 20836019
Change-Id: I186ded1aa3dd9cea67497a4f53b0973031174ccd
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/ApplicationPackageManager.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 90293a4..07eee12 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -1571,9 +1571,15 @@ final class ApplicationPackageManager extends PackageManager { final VolumeInfo currentVol = getPrimaryStorageCurrentVolume(); final List<VolumeInfo> vols = storage.getVolumes(); final List<VolumeInfo> candidates = new ArrayList<>(); - for (VolumeInfo vol : vols) { - if (Objects.equals(vol, currentVol) || isPrimaryStorageCandidateVolume(vol)) { - candidates.add(vol); + if (Objects.equals(StorageManager.UUID_PRIMARY_PHYSICAL, + storage.getPrimaryStorageUuid()) && currentVol != null) { + // TODO: support moving primary physical to emulated volume + candidates.add(currentVol); + } else { + for (VolumeInfo vol : vols) { + if (Objects.equals(vol, currentVol) || isPrimaryStorageCandidateVolume(vol)) { + candidates.add(vol); + } } } return candidates; @@ -1590,12 +1596,7 @@ final class ApplicationPackageManager extends PackageManager { return false; } - // We can move to public volumes on legacy devices - if ((vol.getType() == VolumeInfo.TYPE_PUBLIC) && vol.getDisk().isDefaultPrimary()) { - return true; - } - - // Otherwise we can move to any private volume + // We can move to any private volume return (vol.getType() == VolumeInfo.TYPE_PRIVATE); } |