diff options
| author | 2023-07-13 01:37:21 +0000 | |
|---|---|---|
| committer | 2023-07-13 01:37:21 +0000 | |
| commit | 76f260fa1de738da2af215eac155b7ea699fab21 (patch) | |
| tree | 7cf6ad110be19749ab4f49e69897542c823123a9 | |
| parent | a3029f02bab053ae3d4cb9c0fe2dcf58baede74b (diff) | |
| parent | 57f6a6d7fa98eb88fa6bcaa8ebd1ae5c08643665 (diff) | |
Merge changes Ie97c4815,Id104a400,Ib983354f,Id565986a into main
* changes:
Remove ununsed com.android.sysprop.apex dependency
Remove ro.apex.updatable check
Revert "Treat allowlists differently for flattened apex"
Remove ApexManagerFlattenedApex
5 files changed, 3 insertions, 231 deletions
diff --git a/Android.bp b/Android.bp index 93d6f53cf238..be589b2857b4 100644 --- a/Android.bp +++ b/Android.bp @@ -246,7 +246,6 @@ java_library { "android.system.suspend.control.internal-java", "devicepolicyprotosnano", - "com.android.sysprop.apex", "com.android.sysprop.init", "com.android.sysprop.localization", "PlatformProperties", diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java index bca2d60761d1..caf16849de28 100644 --- a/services/core/java/com/android/server/SystemConfig.java +++ b/services/core/java/com/android/server/SystemConfig.java @@ -35,7 +35,6 @@ import android.os.VintfRuntimeInfo; import android.os.incremental.IncrementalManager; import android.os.storage.StorageManager; import android.permission.PermissionManager.SplitPermissionInfo; -import android.sysprop.ApexProperties; import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArraySet; @@ -1208,8 +1207,7 @@ public class SystemConfig { boolean systemExt = permFile.toPath().startsWith( Environment.getSystemExtDirectory().toPath() + "/"); boolean apex = permFile.toPath().startsWith( - Environment.getApexDirectory().toPath() + "/") - && ApexProperties.updatable().orElse(false); + Environment.getApexDirectory().toPath() + "/"); if (vendor) { readPrivAppPermissions(parser, mPermissionAllowlist.getVendorPrivilegedAppAllowlist()); diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java index 5e62b56c7bcd..2206eacb8232 100644 --- a/services/core/java/com/android/server/pm/ApexManager.java +++ b/services/core/java/com/android/server/pm/ApexManager.java @@ -35,7 +35,6 @@ import android.os.Environment; import android.os.RemoteException; import android.os.ServiceManager; import android.os.Trace; -import android.sysprop.ApexProperties; import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArraySet; @@ -82,18 +81,12 @@ public abstract class ApexManager { new Singleton<ApexManager>() { @Override protected ApexManager create() { - if (ApexProperties.updatable().orElse(false)) { - return new ApexManagerImpl(); - } else { - return new ApexManagerFlattenedApex(); - } + return new ApexManagerImpl(); } }; /** - * Returns an instance of either {@link ApexManagerImpl} or {@link ApexManagerFlattenedApex} - * depending on whether this device supports APEX, i.e. {@link ApexProperties#updatable()} - * evaluates to {@code true}. + * Returns an instance of {@link ApexManagerImpl} * @hide */ public static ApexManager getInstance() { @@ -991,203 +984,4 @@ public abstract class ApexManager { } } } - - /** - * An implementation of {@link ApexManager} that should be used in case device does not support - * updating APEX packages. - */ - @VisibleForTesting - static final class ApexManagerFlattenedApex extends ApexManager { - @Override - ApexInfo[] getAllApexInfos() { - return null; - } - - @Override - void notifyScanResult(List<ScanResult> scanResults) { - // No-op - } - - @Override - public List<ActiveApexInfo> getActiveApexInfos() { - // There is no apexd running in case of flattened apex - // We look up the /apex directory and identify the active APEX modules from there. - // As "preinstalled" path, we just report /system since in the case of flattened APEX - // the /apex directory is just a symlink to /system/apex. - List<ActiveApexInfo> result = new ArrayList<>(); - File apexDir = Environment.getApexDirectory(); - if (apexDir.isDirectory()) { - File[] files = apexDir.listFiles(); - // listFiles might be null if system server doesn't have permission to read - // a directory. - if (files != null) { - for (File file : files) { - if (file.isDirectory() && !file.getName().contains("@") - // In flattened configuration, init special-cases the art directory - // and bind-mounts com.android.art.debug to com.android.art. - && !file.getName().equals("com.android.art.debug")) { - result.add( - new ActiveApexInfo(file, Environment.getRootDirectory(), file)); - } - } - } - } - return result; - } - - @Override - @Nullable - public String getActiveApexPackageNameContainingPackage( - @NonNull String containedPackageName) { - Objects.requireNonNull(containedPackageName); - - return null; - } - - @Override - ApexSessionInfo getStagedSessionInfo(int sessionId) { - throw new UnsupportedOperationException(); - } - - @Override - SparseArray<ApexSessionInfo> getSessions() { - return new SparseArray<>(0); - } - - @Override - ApexInfoList submitStagedSession(ApexSessionParams params) - throws PackageManagerException { - throw new PackageManagerException(PackageManager.INSTALL_FAILED_INTERNAL_ERROR, - "Device doesn't support updating APEX"); - } - - @Override - ApexInfo[] getStagedApexInfos(ApexSessionParams params) { - throw new UnsupportedOperationException(); - } - - @Override - void markStagedSessionReady(int sessionId) { - throw new UnsupportedOperationException(); - } - - @Override - void markStagedSessionSuccessful(int sessionId) { - throw new UnsupportedOperationException(); - } - - @Override - boolean isApexSupported() { - return false; - } - - @Override - boolean revertActiveSessions() { - throw new UnsupportedOperationException(); - } - - @Override - boolean abortStagedSession(int sessionId) { - throw new UnsupportedOperationException(); - } - - @Override - boolean uninstallApex(String apexPackagePath) { - throw new UnsupportedOperationException(); - } - - @Override - void registerApkInApex(AndroidPackage pkg) { - // No-op - } - - @Override - void reportErrorWithApkInApex(String scanDirPath, String errorMsg) { - // No-op - } - - @Override - @Nullable - String getApkInApexInstallError(String apexPackageName) { - return null; - } - - @Override - List<String> getApksInApex(String apexPackageName) { - return Collections.emptyList(); - } - - @Override - @Nullable - public String getApexModuleNameForPackageName(String apexPackageName) { - return null; - } - - @Override - @Nullable - public String getActivePackageNameForApexModuleName(String apexModuleName) { - return null; - } - - @Override - public boolean snapshotCeData(int userId, int rollbackId, String apexPackageName) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean restoreCeData(int userId, int rollbackId, String apexPackageName) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean destroyDeSnapshots(int rollbackId) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean destroyCeSnapshots(int userId, int rollbackId) { - return true; - } - - @Override - public boolean destroyCeSnapshotsNotSpecified(int userId, int[] retainRollbackIds) { - return true; - } - - @Override - public void markBootCompleted() { - // No-op - } - - @Override - public long calculateSizeForCompressedApex(CompressedApexInfoList infoList) { - throw new UnsupportedOperationException(); - } - - @Override - public void reserveSpaceForCompressedApex(CompressedApexInfoList infoList) { - throw new UnsupportedOperationException(); - } - - @Override - ApexInfo installPackage(File apexFile) { - throw new UnsupportedOperationException("APEX updates are not supported"); - } - - @Override - public List<ApexSystemServiceInfo> getApexSystemServices() { - // TODO(satayev): we can't really support flattened apex use case, and need to migrate - // the manifest entries into system's manifest asap. - return Collections.emptyList(); - } - - @Override - void dump(PrintWriter pw) { - } - - @Override - public File getBackingApexFile(File file) { - return null; - } - } } diff --git a/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java b/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java index 86c49850aefc..375ef6150830 100644 --- a/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java +++ b/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java @@ -52,7 +52,6 @@ import android.os.ServiceManager; import android.os.ShellCallback; import android.os.SystemProperties; import android.provider.DeviceConfig; -import android.sysprop.ApexProperties; import android.util.ArrayMap; import android.util.ArraySet; import android.util.FastImmutableArraySet; @@ -921,10 +920,6 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo return rebootWithLskfImpl(packageName, reason, slotSwitch); } - public static boolean isUpdatableApexSupported() { - return ApexProperties.updatable().orElse(false); - } - // Metadata should be no more than few MB, if it's larger than 100MB something is wrong. private static final long APEX_INFO_SIZE_LIMIT = 24 * 1024 * 100; @@ -975,11 +970,6 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo @Override public boolean allocateSpaceForUpdate(String packageFile) { allocateSpaceForUpdate_enforcePermission(); - if (!isUpdatableApexSupported()) { - Log.i(TAG, "Updatable Apex not supported, " - + "allocateSpaceForUpdate does nothing."); - return true; - } final long token = Binder.clearCallingIdentity(); try { CompressedApexInfoList apexInfoList = getCompressedApexInfoList(packageFile); diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java b/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java index 5b0e2f3800c3..1ae91241efd6 100644 --- a/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java @@ -474,15 +474,6 @@ public class ApexManagerTest { } @Test - public void testGetBackingApexFiles_flattenedApex() { - ApexManager flattenedApexManager = new ApexManager.ApexManagerFlattenedApex(); - final File backingApexFile = flattenedApexManager.getBackingApexFile( - new File(mMockSystem.system().getApexDirectory(), - "com.android.apex.cts.shim/app/CtsShim/CtsShim.apk")); - assertThat(backingApexFile).isNull(); - } - - @Test public void testActiveApexChanged() throws RemoteException { ApexInfo apex1 = createApexInfo( "com.apex1", 37, true, true, new File("/data/apex/active/com.apex@37.apex")); |