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

Commit 3748c5e7 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Fixing missing updates in package install sessions" into ub-launcher3-burnaby

parents 685f98b2 756adbc3
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public class IconCache {
        mIconDpi = activityManager.getLauncherLargeIconDensity();
        mIconDb = new IconDB(context);

        mWorkerHandler = new Handler(LauncherModel.sWorkerThread.getLooper());
        mWorkerHandler = new Handler(LauncherModel.getWorkerLooper());
    }

    private Drawable getFullResDefaultActivityIcon() {
@@ -388,16 +388,20 @@ public class IconCache {
        return new IconLoadRequest(request, mWorkerHandler);
    }

    private Bitmap getNonNullIcon(CacheEntry entry, UserHandleCompat user) {
        return entry.icon == null ? getDefaultIcon(user) : entry.icon;
    }

    /**
     * Fill in "application" with the icon and label for "info."
     */
    public synchronized void getTitleAndIcon(AppInfo application,
            LauncherActivityInfoCompat info, boolean useLowResIcon) {
        CacheEntry entry = cacheLocked(application.componentName, info,
                info == null ? application.user : info.getUser(),
        UserHandleCompat user = info == null ? application.user : info.getUser();
        CacheEntry entry = cacheLocked(application.componentName, info, user,
                false, useLowResIcon);
        application.title = entry.title;
        application.iconBitmap = entry.icon;
        application.iconBitmap = getNonNullIcon(entry, user);
        application.contentDescription = entry.contentDescription;
        application.usingLowResIcon = entry.isLowResIcon;
    }
@@ -445,7 +449,7 @@ public class IconCache {
            ShortcutInfo shortcutInfo, ComponentName component, LauncherActivityInfoCompat info,
            UserHandleCompat user, boolean usePkgIcon, boolean useLowResIcon) {
        CacheEntry entry = cacheLocked(component, info, user, usePkgIcon, useLowResIcon);
        shortcutInfo.setIcon(entry.icon);
        shortcutInfo.setIcon(getNonNullIcon(entry, user));
        shortcutInfo.title = entry.title;
        shortcutInfo.usingFallbackIcon = isDefaultIcon(entry.icon, user);
        shortcutInfo.usingLowResIcon = entry.isLowResIcon;
@@ -458,7 +462,7 @@ public class IconCache {
            String packageName, UserHandleCompat user, boolean useLowResIcon,
            PackageItemInfo infoOut) {
        CacheEntry entry = getEntryForPackageLocked(packageName, user, useLowResIcon);
        infoOut.iconBitmap = entry.icon;
        infoOut.iconBitmap = getNonNullIcon(entry, user);
        infoOut.title = entry.title;
        infoOut.usingLowResIcon = entry.isLowResIcon;
        infoOut.contentDescription = entry.contentDescription;
+2 −6
Original line number Diff line number Diff line
@@ -199,13 +199,9 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
                    }
                }

                final boolean exists = LauncherModel.shortcutExists(context, pendingInfo.label,
                        intent, pendingInfo.user);
                if (!exists) {
                // Generate a shortcut info to add into the model
                addShortcuts.add(pendingInfo.getShortcutInfo());
            }
            }

            // Add the new apps to the model and bind them
            if (!addShortcuts.isEmpty()) {
+14 −22
Original line number Diff line number Diff line
@@ -98,8 +98,6 @@ import com.android.launcher3.PagedView.PageSwitchListener;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherActivityInfoCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.util.Thunk;
@@ -1060,9 +1058,6 @@ public class Launcher extends Activity
        getWorkspace().reinflateWidgetsIfNecessary();
        reinflateQSBIfNecessary();

        // Process any items that were added while Launcher was away.
        InstallShortcutReceiver.disableAndFlushInstallQueue(this);

        if (DEBUG_RESUME_TIME) {
            Log.d(TAG, "Time spent in onResume: " + (System.currentTimeMillis() - startTime));
        }
@@ -1078,7 +1073,10 @@ public class Launcher extends Activity
        mWorkspace.updateInteractionForState();
        mWorkspace.onResume();

        PackageInstallerCompat.getInstance(this).onResume();
        if (!isWorkspaceLoading()) {
            // Process any items that were added while Launcher was away.
            InstallShortcutReceiver.disableAndFlushInstallQueue(this);
        }

        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onResume();
@@ -1089,7 +1087,6 @@ public class Launcher extends Activity
    protected void onPause() {
        // Ensure that items added to Launcher are queued until Launcher returns
        InstallShortcutReceiver.enableInstallQueue();
        PackageInstallerCompat.getInstance(this).onPause();

        super.onPause();
        mPaused = true;
@@ -4084,7 +4081,7 @@ public class Launcher extends Activity
            sPendingAddItem = null;
        }

        PackageInstallerCompat.getInstance(this).onFinishBind();
        InstallShortcutReceiver.disableAndFlushInstallQueue(this);

        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.finishBindingItems(false);
@@ -4236,22 +4233,17 @@ public class Launcher extends Activity
     * Implementation of the method from LauncherModel.Callbacks.
     */
    @Override
    public void updatePackageState(ArrayList<PackageInstallInfo> installInfo) {
        if (mWorkspace != null) {
            mWorkspace.updatePackageState(installInfo);
    public void bindRestoreItemsChange(final HashSet<ItemInfo> updates) {
        Runnable r = new Runnable() {
            public void run() {
                bindRestoreItemsChange(updates);
            }
        };
        if (waitUntilResume(r)) {
            return;
        }

    /**
     * Update the label and icon of all the icons in a package
     *
     * Implementation of the method from LauncherModel.Callbacks.
     */
    @Override
    public void updatePackageBadge(String packageName) {
        if (mWorkspace != null) {
            mWorkspace.updatePackageBadge(packageName, UserHandleCompat.myUserHandle());
        }
        mWorkspace.updateRestoreItems(updates);
    }

    /**
+0 −11
Original line number Diff line number Diff line
@@ -256,15 +256,4 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
    public static boolean isDogfoodBuild() {
        return getInstance().mBuildInfo.isDogfoodBuild();
    }

    public void setPackageState(ArrayList<PackageInstallInfo> installInfo) {
        mModel.setPackageState(installInfo);
    }

    /**
     * Updates the icons and label of all icons for the provided package name.
     */
    public void updatePackageBadge(String packageName) {
        mModel.updatePackageBadge(packageName);
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -42,5 +42,6 @@ public class LauncherFiles {
    // TODO: Delete these files on upgrade
    public static final List<String> OBSOLETE_FILES = Collections.unmodifiableList(Arrays.asList(
            "launches.log",
            "stats.log"));
            "stats.log",
            "com.android.launcher3.compat.PackageInstallerCompatV16.queue"));
}
Loading