From 8c61e39e042c31dd21567897c834c7c45fe7181b Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 24 Feb 2017 09:22:48 -0700 Subject: [PATCH] Block new installs into ASEC containers. ASEC containers have been deprecated since MNC, which is when we introduced the "adoptable storage" feature. Adoptable storage is a much better user experience, since we move both the APK and private app data together as a single unit, making it much easier to explain to users. Test: builds, boots Bug: 32913676 Change-Id: I97385d081a50a79fc005d4e23e09999f9ae6cfc1 --- core/java/android/content/pm/PackageManager.java | 5 +++++ .../java/com/android/server/pm/PackageInstallerService.java | 6 ++++++ .../java/com/android/server/pm/PackageManagerService.java | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 5733982315d7e..6646402ef62f1 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -624,8 +624,10 @@ public abstract class PackageManager { * should be installed as forward locked, i.e. only the app itself should * have access to its code and non-resource assets. * + * @deprecated new installs into ASEC containers are no longer supported. * @hide */ + @Deprecated public static final int INSTALL_FORWARD_LOCK = 0x00000001; /** @@ -648,8 +650,11 @@ public abstract class PackageManager { * Flag parameter for {@link #installPackage} to indicate that this package * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}. * + * @deprecated new installs into ASEC containers are no longer supported; + * use adoptable storage instead. * @hide */ + @Deprecated public static final int INSTALL_EXTERNAL = 0x00000008; /** diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java index 53765f21bb90a..a7a1683f8479b 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerService.java +++ b/services/core/java/com/android/server/pm/PackageInstallerService.java @@ -607,6 +607,12 @@ public class PackageInstallerService extends IPackageInstaller.Stub { + "to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag"); } + if ((params.installFlags & PackageManager.INSTALL_FORWARD_LOCK) != 0 + || (params.installFlags & PackageManager.INSTALL_EXTERNAL) != 0) { + throw new IllegalArgumentException( + "New installs into ASEC containers no longer supported"); + } + // Defensively resize giant app icons if (params.appIcon != null) { final ActivityManager am = (ActivityManager) mContext.getSystemService( diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 371a062c0c43f..d012c7e4ef485 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -12998,6 +12998,12 @@ public class PackageManagerService extends IPackageManager.Stub { + "to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag"); } + if ((installFlags & PackageManager.INSTALL_FORWARD_LOCK) != 0 + || (installFlags & PackageManager.INSTALL_EXTERNAL) != 0) { + throw new IllegalArgumentException( + "New installs into ASEC containers no longer supported"); + } + final File originFile = new File(originPath); final OriginInfo origin = OriginInfo.fromUntrustedFile(originFile);