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

Commit 720e0d2c authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Allow for uninstalled apps in ShortcutManager

In split system/user devices, user 0 will not have
several of the system apps installed by default. So
system services that are doing package queries need
to consider uninstalled packages as well in some cases.

Bug: 27388370
Change-Id: If6f4b20f60d36743c76ef307e0ac74112b2ca69e
parent e7f82ec5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -138,14 +138,16 @@ class ShortcutManager {
                    ComponentName componentName = new ComponentName(packageName, className);
                    try {
                        info = packageManager.getActivityInfo(componentName,
                                PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE);
                                PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE
                                | PackageManager.MATCH_UNINSTALLED_PACKAGES);
                    } catch (PackageManager.NameNotFoundException e) {
                        String[] packages = packageManager.canonicalToCurrentPackageNames(
                                new String[] { packageName });
                        componentName = new ComponentName(packages[0], className);
                        try {
                            info = packageManager.getActivityInfo(componentName,
                                    PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE);
                                    PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE
                                    | PackageManager.MATCH_UNINSTALLED_PACKAGES);
                        } catch (PackageManager.NameNotFoundException e1) {
                            Log.w(TAG, "Unable to add bookmark: " + packageName
                                    + "/" + className, e);