[automerge] [RESTRICT AUTOMERGE][pm] still allow debuggable for system app downgrades 2p: 636cdf22b9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21266989

Bug: 267232653
Bug: 256202273
Change-Id: Iba1c01bf07da821a05d3439df54e811ccfdf4505
This commit is contained in:
Songchun Fan
2023-02-03 18:41:30 +00:00
committed by Presubmit Automerger Backend

View File

@@ -26891,14 +26891,18 @@ public class PackageManagerService extends IPackageManager.Stub
if (disabledPs != null) { if (disabledPs != null) {
dataOwnerPkg = disabledPs.getPkg(); dataOwnerPkg = disabledPs.getPkg();
} }
try { if (!Build.IS_DEBUGGABLE && !dataOwnerPkg.isDebuggable()) {
checkDowngrade(dataOwnerPkg, pkgLite); // Only restrict non-debuggable builds and non-debuggable version of the app
} catch (PackageManagerException e) { try {
String errorMsg = "System app: " + packageName + " cannot be downgraded to" checkDowngrade(dataOwnerPkg, pkgLite);
+ " older than its preloaded version on the system image. " } catch (PackageManagerException e) {
+ e.getMessage(); String errorMsg = "System app: " + packageName
Slog.w(TAG, errorMsg); + " cannot be downgraded to"
return PackageManager.INSTALL_FAILED_VERSION_DOWNGRADE; + " older than its preloaded version on the system image. "
+ e.getMessage();
Slog.w(TAG, errorMsg);
return PackageManager.INSTALL_FAILED_VERSION_DOWNGRADE;
}
} }
} }
} }