[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) {
dataOwnerPkg = disabledPs.getPkg();
}
try {
checkDowngrade(dataOwnerPkg, pkgLite);
} catch (PackageManagerException e) {
String errorMsg = "System app: " + packageName + " cannot be downgraded to"
+ " older than its preloaded version on the system image. "
+ e.getMessage();
Slog.w(TAG, errorMsg);
return PackageManager.INSTALL_FAILED_VERSION_DOWNGRADE;
if (!Build.IS_DEBUGGABLE && !dataOwnerPkg.isDebuggable()) {
// Only restrict non-debuggable builds and non-debuggable version of the app
try {
checkDowngrade(dataOwnerPkg, pkgLite);
} catch (PackageManagerException e) {
String errorMsg = "System app: " + packageName
+ " cannot be downgraded to"
+ " older than its preloaded version on the system image. "
+ e.getMessage();
Slog.w(TAG, errorMsg);
return PackageManager.INSTALL_FAILED_VERSION_DOWNGRADE;
}
}
}
}