Skip rmdex when ART Service is in use.
There's no suitable API that can delete optimized artifacts relative to
an arbitrary APK path, so we'll rely on the ART Service file GC
instead. This means some regression as stale artifacts get deleted a
bit later than before.
Test: atest CtsCompilationTestCases
Bug: 251903639
Change-Id: Iae7ebbd891fbe58e40539ba34077320093e52924
diff --git a/services/core/java/com/android/server/pm/RemovePackageHelper.java b/services/core/java/com/android/server/pm/RemovePackageHelper.java
index e5aaddb..10673c6 100644
--- a/services/core/java/com/android/server/pm/RemovePackageHelper.java
+++ b/services/core/java/com/android/server/pm/RemovePackageHelper.java
@@ -422,15 +422,18 @@
if (instructionSets == null) {
throw new IllegalStateException("instructionSet == null");
}
- String[] dexCodeInstructionSets = getDexCodeInstructionSets(instructionSets);
- for (String codePath : allCodePaths) {
- for (String dexCodeInstructionSet : dexCodeInstructionSets) {
- // TODO(b/251903639): Call into ART Service.
- try {
- mPm.mInstaller.rmdex(codePath, dexCodeInstructionSet);
- } catch (LegacyDexoptDisabledException e) {
- throw new RuntimeException(e);
- } catch (Installer.InstallerException ignored) {
+ // TODO(b/265813358): ART Service currently doesn't support deleting optimized artifacts
+ // relative to an arbitrary APK path. Skip this and rely on its file GC instead.
+ if (!DexOptHelper.useArtService()) {
+ String[] dexCodeInstructionSets = getDexCodeInstructionSets(instructionSets);
+ for (String codePath : allCodePaths) {
+ for (String dexCodeInstructionSet : dexCodeInstructionSets) {
+ try {
+ mPm.mInstaller.rmdex(codePath, dexCodeInstructionSet);
+ } catch (LegacyDexoptDisabledException e) {
+ throw new RuntimeException(e);
+ } catch (Installer.InstallerException ignored) {
+ }
}
}
}