diff options
| author | 2017-11-06 17:36:40 +0800 | |
|---|---|---|
| committer | 2017-12-07 15:39:08 +0800 | |
| commit | e2437036a653261aadd2b28f524386340f96b66d (patch) | |
| tree | b7eacbde5beed632a627c2ba816ea3f3fabb3af7 | |
| parent | 645cd2ad2665f422f0499d86b061d56a31926d18 (diff) | |
fix system app's abi error after uninstall updated version.
When uninstall an updated system app, we always did as
following steps. First we delete data structure by calling
deleteInstalledPackageLIF(), then enable it from disabled
system packages and re-adding to PackageSettings map by
calling addPackageLPw(). At last re-installing apps in
system partition with scanPackageTracedLI().
But if an package with sharedUserId readded failed with
exception of 'Adding duplicate shared id: xxx', then we
cann't reuse it's derived CPU Abis from settings, others
we could get CPU Abis uninitialized errors.
Test: Manual; Update an system app with sharedUserId
Test: Manual; Uninstall and ensure it run ok
Change-Id: Icfda17c5004d291c664ed80d578aca4b7cf4a975
Signed-off-by: liulvping <liulvping@xiaomi.com>
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 2b3bfc82f982..3c7b033cd818 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -10160,6 +10160,7 @@ public class PackageManagerService extends IPackageManager.Stub // them in the case where we're not upgrading or booting for the first time. String primaryCpuAbiFromSettings = null; String secondaryCpuAbiFromSettings = null; + boolean needToDeriveAbi = (scanFlags & SCAN_FIRST_BOOT_OR_UPGRADE) != 0; // writer synchronized (mPackages) { @@ -10237,11 +10238,14 @@ public class PackageManagerService extends IPackageManager.Stub } } - if ((scanFlags & SCAN_FIRST_BOOT_OR_UPGRADE) == 0) { + if (!needToDeriveAbi) { PackageSetting foundPs = mSettings.getPackageLPr(pkg.packageName); if (foundPs != null) { primaryCpuAbiFromSettings = foundPs.primaryCpuAbiString; secondaryCpuAbiFromSettings = foundPs.secondaryCpuAbiString; + } else { + // when re-adding a system package failed after uninstalling updates. + needToDeriveAbi = true; } } @@ -10446,7 +10450,7 @@ public class PackageManagerService extends IPackageManager.Stub final String cpuAbiOverride = deriveAbiOverride(pkg.cpuAbiOverride, pkgSetting); if ((scanFlags & SCAN_NEW_INSTALL) == 0) { - if ((scanFlags & SCAN_FIRST_BOOT_OR_UPGRADE) != 0) { + if (needToDeriveAbi) { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "derivePackageAbi"); final boolean extractNativeLibs = !pkg.isLibrary(); derivePackageAbi(pkg, scanFile, cpuAbiOverride, extractNativeLibs, |