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

Commit dcb56764 authored by Songchun Fan's avatar Songchun Fan
Browse files

[pm] fix getInstalledApplications

ag/16176950 introduced a regression where duplicated results were
included in getInstalledApplications by mistake because packageState()
might include uninstalled packages. This CL reverts that.

BUG: 208768731
Test: manual and verified that wellbeing doesn't crash
Change-Id: Ica00a47b77d84d9669cc3062332b0d9948ef20e6
parent edcc5a96
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -4629,9 +4629,9 @@ public class ComputerEngine implements Computer {
            }
        } else {
            list = new ArrayList<>(mPackages.size());
            for (PackageStateInternal packageState : packageStates.values()) {
                final AndroidPackage pkg = packageState.getPkg();
                if (pkg == null) {
            for (AndroidPackage p : mPackages.values()) {
                final PackageStateInternal packageState = packageStates.get(p.getPackageName());
                if (packageState == null) {
                    continue;
                }
                if (filterSharedLibPackage(packageState, Binder.getCallingUid(), userId, flags)) {
@@ -4640,10 +4640,10 @@ public class ComputerEngine implements Computer {
                if (shouldFilterApplication(packageState, callingUid, userId)) {
                    continue;
                }
                ApplicationInfo ai = PackageInfoUtils.generateApplicationInfo(pkg, flags,
                ApplicationInfo ai = PackageInfoUtils.generateApplicationInfo(p, flags,
                        packageState.getUserStateOrDefault(userId), userId, packageState);
                if (ai != null) {
                    ai.packageName = resolveExternalPackageName(pkg);
                    ai.packageName = resolveExternalPackageName(p);
                    list.add(ai);
                }
            }