summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Mortimer <sam@mortimer.me.uk>2016-05-06 18:35:15 -0700
committerSam Mortimer <sam@mortimer.me.uk>2016-08-17 20:23:17 -0700
commitd119bd8d5d6964a326c948b49895ea9488f93a9e (patch)
treebb35199af8f3178d5d9ce54e70747f6305aea186
parent6573f4decc2067acdc6a321597a7dd6fc9e21b18 (diff)
downloadframeworks_base-d119bd8d5d6964a326c948b49895ea9488f93a9e.zip
frameworks_base-d119bd8d5d6964a326c948b49895ea9488f93a9e.tar.gz
frameworks_base-d119bd8d5d6964a326c948b49895ea9488f93a9e.tar.bz2
Apps on adopted storage should stay there during update
An update to an app on adopted storage via a PackageInstaller.Session (eg gplay) will result in the app silently ending up back on internal storage if the (new) manifest sets INSTALL_LOCATION_INTERNAL_ONLY. However, the app data is not moved with it so the end result is that data looks like it's been wiped. Ideally, the app and data would be moved to internal. Next best would be that the user is informed that they need to uninstall and reinstall. For now, persist the app in the adopted storage location so that the user doesn't lose app data. Change-Id: I1f178ea361a875c6df6b3b20a2e44071124c39c4
-rw-r--r--core/java/com/android/internal/content/PackageHelper.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java
index b04ddf4..0611401 100644
--- a/core/java/com/android/internal/content/PackageHelper.java
+++ b/core/java/com/android/internal/content/PackageHelper.java
@@ -378,15 +378,6 @@ public class PackageHelper {
installLocation = PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY;
}
- // If app expresses strong desire for internal space, honor it
- if (installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY) {
- if (fitsOnInternal) {
- return null;
- } else {
- throw new IOException("Requested internal only, but not enough space");
- }
- }
-
// If app already exists somewhere, prefer to stay on that volume
if (existingInfo != null) {
if (existingInfo.volumeUuid == null && fitsOnInternal) {
@@ -397,6 +388,15 @@ public class PackageHelper {
}
}
+ // If app expresses strong desire for internal space, honor it
+ if (installLocation == PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY) {
+ if (fitsOnInternal) {
+ return null;
+ } else {
+ throw new IOException("Requested internal only, but not enough space");
+ }
+ }
+
// We're left with either preferring external or auto, so just pick
// volume with most space
if (bestCandidate != null) {