Set FLAG_UPDATED_SYSTEM_APP properly for APEX packages

An APEX package is either located in a built-in directory, in which case
it is a factory package and should be considered a system app, or it has
been updated and no longer a factory package and should be considered as
an updated-system-app.

Bug: 175872729
Test: atest StagedInstallTest#testApexSetsUpdatedSystemAppFlag
Change-Id: I9f7d7faa3a7ed6402512dc83faa112dbe2438976
This commit is contained in:
Mohammad Samiul Islam
2020-12-23 12:08:14 +00:00
parent 818939cd17
commit f17a1afc27

View File

@@ -284,8 +284,10 @@ public class PackageInfoWithoutStateUtils {
pi.applicationInfo.publicSourceDir = apexFile.getPath();
if (apexInfo.isFactory) {
pi.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM;
pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
} else {
pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_SYSTEM;
pi.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
}
if (apexInfo.isActive) {
pi.applicationInfo.flags |= ApplicationInfo.FLAG_INSTALLED;