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

Commit 6d5795f3 authored by Michal Karpinski's avatar Michal Karpinski
Browse files

Never generate synthetic AppInfo activity for any system app

A check was missed in one place, when the API was called with
specific packageName, which meant we were generating synthetic
AppInfo activity for gmscore.

Bug: 119097715
Test: manual, CTS for the whole feature on the way
Change-Id: I8c123eaf8ee28fca828268cf049d9c08e9e7409c
parent b1eeab34
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -316,17 +316,22 @@ public class LauncherAppsService extends SystemService {

            final int callingUid = injectBinderCallingUid();
            final ArrayList<ResolveInfo> result = new ArrayList<>(launcherActivities.getList());
            final PackageManagerInternal pmInt =
                    LocalServices.getService(PackageManagerInternal.class);
            if (packageName != null) {
                // If target package has launcher activities, then return those launcher
                // activities. Otherwise, return hidden activity that forwards user to app
                // details page.
                // If this hidden app should not be shown, return the original list.
                // Otherwise, inject hidden activity that forwards user to app details page.
                if (result.size() > 0) {
                    return launcherActivities;
                }
                ApplicationInfo appInfo = pmInt.getApplicationInfo(packageName, /*flags*/ 0,
                        callingUid, user.getIdentifier());
                if (shouldShowHiddenApp(appInfo)) {
                    ResolveInfo info = getHiddenAppActivityInfo(packageName, callingUid, user);
                    if (info != null) {
                        result.add(info);
                    }
                }
                return new ParceledListSlice<>(result);
            }

@@ -336,8 +341,6 @@ public class LauncherAppsService extends SystemService {
                for (ResolveInfo info : result) {
                    visiblePackages.add(info.activityInfo.packageName);
                }
                final PackageManagerInternal pmInt =
                        LocalServices.getService(PackageManagerInternal.class);
                List<ApplicationInfo> installedPackages = pmInt.getInstalledApplications(0,
                        user.getIdentifier(), callingUid);
                for (ApplicationInfo applicationInfo : installedPackages) {