diff --git a/services/core/java/com/android/server/pm/RemovePackageHelper.java b/services/core/java/com/android/server/pm/RemovePackageHelper.java index e5aaddbf57f82..10673c6f2dd24 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 @@ final class RemovePackageHelper { 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) { + } } } }