Loading services/core/java/com/android/server/pm/ApexManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,18 @@ class ApexManager { } } /** * Whether the current device supports the management of APEX packages. * * @return true if APEX packages can be managed on this device, false otherwise. */ boolean isApexSupported() { // There is no system-wide property available to check if APEX are flattened and hence can't // be updated. In absence of such property, we assume that if we didn't index APEX packages // since they were flattened, no APEX management should be possible. return !mActivePackagesCache.isEmpty(); } /** * Dumps various state information to the provided {@link PrintWriter} object. * Loading services/core/java/com/android/server/pm/PackageInstallerService.java +13 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements private final Context mContext; private final PackageManagerService mPm; private final ApexManager mApexManager; private final StagingManager mStagingManager; private final PermissionManagerServiceInternal mPermissionManager; Loading Loading @@ -204,6 +205,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements mSessionsDir = new File(Environment.getDataSystemDirectory(), "install_sessions"); mSessionsDir.mkdirs(); mApexManager = am; mStagingManager = new StagingManager(pm, this, am); } Loading Loading @@ -485,6 +487,17 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG); } if ((params.installFlags & PackageManager.INSTALL_APEX) != 0) { if (!mApexManager.isApexSupported()) { throw new IllegalArgumentException( "This device doesn't support the installation of APEX files"); } if (!params.isStaged) { throw new IllegalArgumentException( "APEX files can only be installed as part of a staged session."); } } if (!params.isMultiPackage) { // Only system components can circumvent runtime permissions when installing. if ((params.installFlags & PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS) != 0 Loading Loading
services/core/java/com/android/server/pm/ApexManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,18 @@ class ApexManager { } } /** * Whether the current device supports the management of APEX packages. * * @return true if APEX packages can be managed on this device, false otherwise. */ boolean isApexSupported() { // There is no system-wide property available to check if APEX are flattened and hence can't // be updated. In absence of such property, we assume that if we didn't index APEX packages // since they were flattened, no APEX management should be possible. return !mActivePackagesCache.isEmpty(); } /** * Dumps various state information to the provided {@link PrintWriter} object. * Loading
services/core/java/com/android/server/pm/PackageInstallerService.java +13 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements private final Context mContext; private final PackageManagerService mPm; private final ApexManager mApexManager; private final StagingManager mStagingManager; private final PermissionManagerServiceInternal mPermissionManager; Loading Loading @@ -204,6 +205,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements mSessionsDir = new File(Environment.getDataSystemDirectory(), "install_sessions"); mSessionsDir.mkdirs(); mApexManager = am; mStagingManager = new StagingManager(pm, this, am); } Loading Loading @@ -485,6 +487,17 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG); } if ((params.installFlags & PackageManager.INSTALL_APEX) != 0) { if (!mApexManager.isApexSupported()) { throw new IllegalArgumentException( "This device doesn't support the installation of APEX files"); } if (!params.isStaged) { throw new IllegalArgumentException( "APEX files can only be installed as part of a staged session."); } } if (!params.isMultiPackage) { // Only system components can circumvent runtime permissions when installing. if ((params.installFlags & PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS) != 0 Loading