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

Commit 1ac09f3a authored by Evan Severson's avatar Evan Severson
Browse files

Add support for MATCH_FACTORY_ONLY to getInstalledPackages

Test: Observe factory versions are returned if available and non-system
          packages are filtered out
      atest android.content.pm.PackageManagerTests
Fixes: 161907353
Change-Id: I1aeaa7839b2a9c635f7b74143fe078888b46f665
parent 5aaec978
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -8551,6 +8551,15 @@ public class PackageManagerService extends IPackageManager.Stub
            if (listUninstalled) {
                list = new ArrayList<>(mSettings.mPackages.size());
                for (PackageSetting ps : mSettings.mPackages.values()) {
                    if (listFactory) {
                        if (!ps.isSystem()) {
                            continue;
                        }
                        PackageSetting psDisabled = mSettings.getDisabledSystemPkgLPr(ps);
                        if (psDisabled != null) {
                            ps = psDisabled;
                        }
                    }
                    if (filterSharedLibPackageLPr(ps, callingUid, userId, flags)) {
                        continue;
                    }
@@ -8565,7 +8574,16 @@ public class PackageManagerService extends IPackageManager.Stub
            } else {
                list = new ArrayList<>(mPackages.size());
                for (AndroidPackage p : mPackages.values()) {
                    final PackageSetting ps = getPackageSetting(p.getPackageName());
                    PackageSetting ps = getPackageSetting(p.getPackageName());
                    if (listFactory) {
                        if (!p.isSystem()) {
                            continue;
                        }
                        PackageSetting psDisabled = mSettings.getDisabledSystemPkgLPr(ps);
                        if (psDisabled != null) {
                            ps = psDisabled;
                        }
                    }
                    if (filterSharedLibPackageLPr(ps, callingUid, userId, flags)) {
                        continue;
                    }