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

Commit 5128b187 authored by Piyush Mehrotra's avatar Piyush Mehrotra
Browse files

Fix widget restore for pre-archived apps

Widgets which were expected to be restored, were missing for apps which were pre-archived.
The fix adds checks for archived apps when processing widgets and ensures that icon with cloud overlay is present on the widget.

Test: Flashed device with build containing this fix.
Bug: 321297173
Change-Id: Iccbaf5abbe25b13e52eb9f4d719e59676bbe2581
parent 01db1b8c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -554,6 +554,7 @@ public abstract class BaseIconCache {
     */
    @WorkerThread
    @NonNull
    @SuppressWarnings("NewApi")
    protected CacheEntry getEntryForPackageLocked(@NonNull final String packageName,
            @NonNull final UserHandle user, final boolean useLowResIcon) {
        assertWorkerThread();
@@ -567,9 +568,11 @@ public abstract class BaseIconCache {
            // Check the DB first.
            if (!getEntryFromDBLocked(cacheKey, entry, useLowResIcon)) {
                try {
                    int flags = Process.myUserHandle().equals(user) ? 0 :
                    long flags = Process.myUserHandle().equals(user) ? 0 :
                            PackageManager.GET_UNINSTALLED_PACKAGES;
                    PackageInfo info = mPackageManager.getPackageInfo(packageName, flags);
                    flags |= PackageManager.MATCH_ARCHIVED_PACKAGES;
                    PackageInfo info = mPackageManager.getPackageInfo(packageName,
                            PackageManager.PackageInfoFlags.of(flags));
                    ApplicationInfo appInfo = info.applicationInfo;
                    if (appInfo == null) {
                        throw new NameNotFoundException("ApplicationInfo is null");