From 4a31aa128840e152082364b455ed5dbef4a807ff Mon Sep 17 00:00:00 2001 From: Alex Buynytskyy Date: Mon, 4 Apr 2022 09:46:54 -0700 Subject: [PATCH] Remove mInstallLock from dexopt. Internal locking in installd should be sufficient. Bug: 165026324 Fixes: 165026324 Test: presubmit Change-Id: I6c249a2ebeb1960563f7045348d700add03712e1 --- .../com/android/server/pm/DexOptHelper.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/services/core/java/com/android/server/pm/DexOptHelper.java b/services/core/java/com/android/server/pm/DexOptHelper.java index bb2ba5cc498d1..249099d122a15 100644 --- a/services/core/java/com/android/server/pm/DexOptHelper.java +++ b/services/core/java/com/android/server/pm/DexOptHelper.java @@ -358,9 +358,7 @@ final class DexOptHelper { } final long callingId = Binder.clearCallingIdentity(); try { - synchronized (mPm.mInstallLock) { - return performDexOptInternalWithDependenciesLI(p, pkgSetting, options); - } + return performDexOptInternalWithDependenciesLI(p, pkgSetting, options); } finally { Binder.restoreCallingIdentity(callingId); } @@ -429,20 +427,18 @@ final class DexOptHelper { throw new IllegalArgumentException("Unknown package: " + packageName); } - synchronized (mPm.mInstallLock) { - Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); - // Whoever is calling forceDexOpt wants a compiled package. - // Don't use profiles since that may cause compilation to be skipped. - final int res = performDexOptInternalWithDependenciesLI(pkg, packageState, - new DexoptOptions(packageName, - getDefaultCompilerFilter(), - DexoptOptions.DEXOPT_FORCE | DexoptOptions.DEXOPT_BOOT_COMPLETE)); + // Whoever is calling forceDexOpt wants a compiled package. + // Don't use profiles since that may cause compilation to be skipped. + final int res = performDexOptInternalWithDependenciesLI(pkg, packageState, + new DexoptOptions(packageName, + getDefaultCompilerFilter(), + DexoptOptions.DEXOPT_FORCE | DexoptOptions.DEXOPT_BOOT_COMPLETE)); - Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); - if (res != PackageDexOptimizer.DEX_OPT_PERFORMED) { - throw new IllegalStateException("Failed to dexopt: " + res); - } + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); + if (res != PackageDexOptimizer.DEX_OPT_PERFORMED) { + throw new IllegalStateException("Failed to dexopt: " + res); } }