Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03b74909 authored by wangmingming1's avatar wangmingming1 Committed by Todd Kennedy
Browse files

Prevent system app upgrading from multi-arch to single-arch



We should not let user to manully upgrade a system app which supports
multi-arch to a newer version which supports only one cpu abi. Take
webview as an example, if the user upgraded the webview to a version
supports only armeabi-v7a on Nexus 5X by mistake, then any app supports
only arm64-v8a and uses webview to display web contents would not work
properly then as loading a 32bit native lib inside a 64bit mode process
is not allowed.

Test: Manual

Change-Id: I567be7707fc18421ff686c1e8b1110dec517e06d
Signed-off-by: default avatarwangmingming1 <wangmingming1@xiaomi.com>
parent db122f90
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -17225,6 +17225,15 @@ public class PackageManagerService extends IPackageManager.Stub
                return;
            }
            // check if the new package supports all of the abis which the old package supports
            boolean oldPkgSupportMultiArch = oldPackage.applicationInfo.secondaryCpuAbi != null;
            boolean newPkgSupportMultiArch = pkg.applicationInfo.secondaryCpuAbi != null;
            if (isSystemApp(oldPackage) && oldPkgSupportMultiArch && !newPkgSupportMultiArch) {
                res.setError(INSTALL_FAILED_UPDATE_INCOMPATIBLE,
                        "Update to package " + pkgName + " doesn't support multi arch");
                return;
            }
            // In case of rollback, remember per-user/profile install state
            allUsers = sUserManager.getUserIds();
            installedUsers = ps.queryInstalledUsers(allUsers, true);