Search in sources :

Example 31 with LauncherAppState

use of com.android.launcher3.LauncherAppState in project Neo-Launcher by NeoApplications.

the class CacheDataUpdatedTask method execute.

@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
    IconCache iconCache = app.getIconCache();
    ArrayList<WorkspaceItemInfo> updatedShortcuts = new ArrayList<>();
    synchronized (dataModel) {
        for (ItemInfo info : dataModel.itemsIdMap) {
            if (info instanceof WorkspaceItemInfo && mUser.equals(info.user)) {
                WorkspaceItemInfo si = (WorkspaceItemInfo) info;
                ComponentName cn = si.getTargetComponent();
                if (si.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION && isValidShortcut(si) && cn != null && mPackages.contains(cn.getPackageName())) {
                    iconCache.getTitleAndIcon(si, si.usingLowResIcon());
                    updatedShortcuts.add(si);
                }
            }
        }
        apps.updateIconsAndLabels(mPackages, mUser);
    }
    bindUpdatedWorkspaceItems(updatedShortcuts);
    bindApplicationsIfNeeded();
}
Also used : WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo) ItemInfo(com.android.launcher3.ItemInfo) IconCache(com.android.launcher3.icons.IconCache) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo)

Example 32 with LauncherAppState

use of com.android.launcher3.LauncherAppState in project Neo-Launcher by NeoApplications.

the class AddWorkspaceItemsTask method execute.

@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
    if (mItemList.isEmpty()) {
        return;
    }
    final ArrayList<ItemInfo> addedItemsFinal = new ArrayList<>();
    final IntArray addedWorkspaceScreensFinal = new IntArray();
    synchronized (dataModel) {
        IntArray workspaceScreens = dataModel.collectWorkspaceScreens();
        List<ItemInfo> filteredItems = new ArrayList<>();
        for (Pair<ItemInfo, Object> entry : mItemList) {
            ItemInfo item = entry.first;
            if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION || item.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
                // Short-circuit this logic if the icon exists somewhere on the workspace
                if (shortcutExists(dataModel, item.getIntent(), item.user)) {
                    continue;
                }
                // b/139663018 Short-circuit this logic if the icon is a system app
                if (PackageManagerHelper.isSystemApp(app.getContext(), item.getIntent())) {
                    continue;
                }
            }
            if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
                if (item instanceof AppInfo) {
                    item = ((AppInfo) item).makeWorkspaceItem();
                }
            }
            if (item != null) {
                filteredItems.add(item);
            }
        }
        PackageInstallerCompat packageInstaller = PackageInstallerCompat.getInstance(app.getContext());
        LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(app.getContext());
        for (ItemInfo item : filteredItems) {
            // Find appropriate space for the item.
            int[] coords = findSpaceForItem(app, dataModel, workspaceScreens, addedWorkspaceScreensFinal, item.spanX, item.spanY);
            int screenId = coords[0];
            ItemInfo itemInfo;
            if (item instanceof WorkspaceItemInfo || item instanceof FolderInfo || item instanceof LauncherAppWidgetInfo) {
                itemInfo = item;
            } else if (item instanceof AppInfo) {
                itemInfo = ((AppInfo) item).makeWorkspaceItem();
            } else {
                throw new RuntimeException("Unexpected info type");
            }
            if (item instanceof WorkspaceItemInfo && ((WorkspaceItemInfo) item).isPromise()) {
                WorkspaceItemInfo workspaceInfo = (WorkspaceItemInfo) item;
                String packageName = item.getTargetComponent() != null ? item.getTargetComponent().getPackageName() : null;
                if (packageName == null) {
                    continue;
                }
                SessionInfo sessionInfo = packageInstaller.getActiveSessionInfo(item.user, packageName);
                List<LauncherActivityInfo> activities = launcherApps.getActivityList(packageName, item.user);
                boolean hasActivity = activities != null && !activities.isEmpty();
                if (sessionInfo == null) {
                    if (!hasActivity) {
                        // Session was cancelled, do not add.
                        continue;
                    }
                } else {
                    workspaceInfo.setInstallProgress((int) sessionInfo.getProgress());
                }
                if (hasActivity) {
                    // App was installed while launcher was in the background,
                    // or app was already installed for another user.
                    itemInfo = new AppInfo(app.getContext(), activities.get(0), item.user).makeWorkspaceItem();
                    if (shortcutExists(dataModel, itemInfo.getIntent(), itemInfo.user)) {
                        // Icon already exists on the workspace and should not be auto-added.
                        continue;
                    }
                    WorkspaceItemInfo wii = (WorkspaceItemInfo) itemInfo;
                    wii.title = "";
                    wii.applyFrom(app.getIconCache().getDefaultIcon(item.user));
                    app.getIconCache().getTitleAndIcon(wii, ((WorkspaceItemInfo) itemInfo).usingLowResIcon());
                }
            }
            // Add the shortcut to the db
            getModelWriter().addItemToDatabase(itemInfo, LauncherSettings.Favorites.CONTAINER_DESKTOP, screenId, coords[1], coords[2]);
            // Save the WorkspaceItemInfo for binding in the workspace
            addedItemsFinal.add(itemInfo);
        }
    }
    if (!addedItemsFinal.isEmpty()) {
        scheduleCallbackTask(new CallbackTask() {

            @Override
            public void execute(Callbacks callbacks) {
                final ArrayList<ItemInfo> addAnimated = new ArrayList<>();
                final ArrayList<ItemInfo> addNotAnimated = new ArrayList<>();
                if (!addedItemsFinal.isEmpty()) {
                    ItemInfo info = addedItemsFinal.get(addedItemsFinal.size() - 1);
                    int lastScreenId = info.screenId;
                    for (ItemInfo i : addedItemsFinal) {
                        if (i.screenId == lastScreenId) {
                            addAnimated.add(i);
                        } else {
                            addNotAnimated.add(i);
                        }
                    }
                }
                callbacks.bindAppsAdded(addedWorkspaceScreensFinal, addNotAnimated, addAnimated);
            }
        });
    }
}
Also used : LauncherAppsCompat(com.android.launcher3.compat.LauncherAppsCompat) ItemInfo(com.android.launcher3.ItemInfo) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo) ArrayList(java.util.ArrayList) SessionInfo(android.content.pm.PackageInstaller.SessionInfo) IntArray(com.android.launcher3.util.IntArray) Callbacks(com.android.launcher3.model.BgDataModel.Callbacks) PackageInstallerCompat(com.android.launcher3.compat.PackageInstallerCompat) CallbackTask(com.android.launcher3.LauncherModel.CallbackTask) LauncherAppWidgetInfo(com.android.launcher3.LauncherAppWidgetInfo) FolderInfo(com.android.launcher3.FolderInfo) AppInfo(com.android.launcher3.AppInfo) LauncherActivityInfo(android.content.pm.LauncherActivityInfo) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo)

Example 33 with LauncherAppState

use of com.android.launcher3.LauncherAppState in project Neo-Launcher by NeoApplications.

the class AddWorkspaceItemsTask method findSpaceForItem.

/**
 * Find a position on the screen for the given size or adds a new screen.
 * @return screenId and the coordinates for the item in an int array of size 3.
 */
protected int[] findSpaceForItem(LauncherAppState app, BgDataModel dataModel, IntArray workspaceScreens, IntArray addedWorkspaceScreensFinal, int spanX, int spanY) {
    LongSparseArray<ArrayList<ItemInfo>> screenItems = new LongSparseArray<>();
    // Use sBgItemsIdMap as all the items are already loaded.
    synchronized (dataModel) {
        for (ItemInfo info : dataModel.itemsIdMap) {
            if (info.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
                ArrayList<ItemInfo> items = screenItems.get(info.screenId);
                if (items == null) {
                    items = new ArrayList<>();
                    screenItems.put(info.screenId, items);
                }
                items.add(info);
            }
        }
    }
    // Find appropriate space for the item.
    int screenId = 0;
    int[] cordinates = new int[2];
    boolean found = false;
    int screenCount = workspaceScreens.size();
    // First check the preferred screen.
    int preferredScreenIndex = workspaceScreens.isEmpty() ? 0 : 1;
    if (preferredScreenIndex < screenCount) {
        screenId = workspaceScreens.get(preferredScreenIndex);
        found = findNextAvailableIconSpaceInScreen(app, screenItems.get(screenId), cordinates, spanX, spanY);
    }
    if (!found) {
        // Search on any of the screens starting from the first screen.
        for (int screen = 1; screen < screenCount; screen++) {
            screenId = workspaceScreens.get(screen);
            if (findNextAvailableIconSpaceInScreen(app, screenItems.get(screenId), cordinates, spanX, spanY)) {
                // We found a space for it
                found = true;
                break;
            }
        }
    }
    if (!found) {
        // Still no position found. Add a new screen to the end.
        screenId = LauncherSettings.Settings.call(app.getContext().getContentResolver(), LauncherSettings.Settings.METHOD_NEW_SCREEN_ID).getInt(LauncherSettings.Settings.EXTRA_VALUE);
        // Save the screen id for binding in the workspace
        workspaceScreens.add(screenId);
        addedWorkspaceScreensFinal.add(screenId);
        // If we still can't find an empty space, then God help us all!!!
        if (!findNextAvailableIconSpaceInScreen(app, screenItems.get(screenId), cordinates, spanX, spanY)) {
            throw new RuntimeException("Can't find space to add the item");
        }
    }
    return new int[] { screenId, cordinates[0], cordinates[1] };
}
Also used : LongSparseArray(android.util.LongSparseArray) ItemInfo(com.android.launcher3.ItemInfo) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo) ArrayList(java.util.ArrayList)

Example 34 with LauncherAppState

use of com.android.launcher3.LauncherAppState in project Neo-Launcher by NeoApplications.

the class PackageInstallStateChangedTask method execute.

@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
    if (mInstallInfo.state == PackageInstallerCompat.STATUS_INSTALLED) {
        try {
            // For instant apps we do not get package-add. Use setting events to update
            // any pinned icons.
            ApplicationInfo ai = app.getContext().getPackageManager().getApplicationInfo(mInstallInfo.packageName, 0);
            if (InstantAppResolver.newInstance(app.getContext()).isInstantApp(ai)) {
                app.getModel().onPackageAdded(ai.packageName, mInstallInfo.user);
            }
        } catch (PackageManager.NameNotFoundException e) {
        // Ignore
        }
        // Ignore install success events as they are handled by Package add events.
        return;
    }
    synchronized (apps) {
        PromiseAppInfo updated = apps.updatePromiseInstallInfo(mInstallInfo);
        if (updated != null) {
            scheduleCallbackTask(c -> c.bindPromiseAppProgressUpdated(updated));
        }
        bindApplicationsIfNeeded();
    }
    synchronized (dataModel) {
        final HashSet<ItemInfo> updates = new HashSet<>();
        for (ItemInfo info : dataModel.itemsIdMap) {
            if (info instanceof WorkspaceItemInfo) {
                WorkspaceItemInfo si = (WorkspaceItemInfo) info;
                ComponentName cn = si.getTargetComponent();
                if (si.hasPromiseIconUi() && (cn != null) && mInstallInfo.packageName.equals(cn.getPackageName())) {
                    si.setInstallProgress(mInstallInfo.progress);
                    if (mInstallInfo.state == PackageInstallerCompat.STATUS_FAILED) {
                        // Mark this info as broken.
                        si.status &= ~WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE;
                    }
                    updates.add(si);
                }
            }
        }
        for (LauncherAppWidgetInfo widget : dataModel.appWidgets) {
            if (widget.providerName.getPackageName().equals(mInstallInfo.packageName)) {
                widget.installProgress = mInstallInfo.progress;
                updates.add(widget);
            }
        }
        if (!updates.isEmpty()) {
            scheduleCallbackTask(new CallbackTask() {

                @Override
                public void execute(Callbacks callbacks) {
                    callbacks.bindRestoreItemsChange(updates);
                }
            });
        }
    }
}
Also used : CallbackTask(com.android.launcher3.LauncherModel.CallbackTask) ItemInfo(com.android.launcher3.ItemInfo) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo) ApplicationInfo(android.content.pm.ApplicationInfo) LauncherAppWidgetInfo(com.android.launcher3.LauncherAppWidgetInfo) PackageManager(android.content.pm.PackageManager) Callbacks(com.android.launcher3.model.BgDataModel.Callbacks) PromiseAppInfo(com.android.launcher3.PromiseAppInfo) ComponentName(android.content.ComponentName) HashSet(java.util.HashSet) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo)

Example 35 with LauncherAppState

use of com.android.launcher3.LauncherAppState in project Neo-Launcher by NeoApplications.

the class PackageUpdatedTask method execute.

@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList appsList) {
    if (TestProtocol.sDebugTracing) {
        Log.d(TestProtocol.APP_NOT_DISABLED, "PackageUpdatedTask: " + mOp + ", " + Arrays.toString(mPackages));
    }
    final Context context = app.getContext();
    final IconCache iconCache = app.getIconCache();
    final String[] packages = mPackages;
    final int N = packages.length;
    FlagOp flagOp = FlagOp.NO_OP;
    final HashSet<String> packageSet = new HashSet<>(Arrays.asList(packages));
    ItemInfoMatcher matcher = ItemInfoMatcher.ofPackages(packageSet, mUser);
    final HashSet<ComponentName> removedComponents = new HashSet<>();
    switch(mOp) {
        case OP_ADD:
            {
                for (int i = 0; i < N; i++) {
                    if (DEBUG)
                        Log.d(TAG, "mAllAppsList.addPackage " + packages[i]);
                    iconCache.updateIconsForPkg(packages[i], mUser);
                    if (FeatureFlags.LAUNCHER3_PROMISE_APPS_IN_ALL_APPS) {
                        appsList.removePackage(packages[i], mUser);
                    }
                    appsList.addPackage(context, packages[i], mUser);
                    OmegaPreferences prefs = Utilities.getOmegaPrefs(context);
                    // Automatically add homescreen icon for work profile apps for below O device.
                    if (Utilities.ATLEAST_OREO && prefs.getAutoAddInstalled() && !OmegaUtilsKt.workspaceContains(dataModel, packages[i])) {
                        SessionCommitReceiver.queueAppIconAddition(context, packages[i], mUser);
                    } else if (!Utilities.ATLEAST_OREO && !Process.myUserHandle().equals(mUser)) {
                        SessionCommitReceiver.queueAppIconAddition(context, packages[i], mUser);
                    }
                }
                flagOp = FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
                break;
            }
        case OP_UPDATE:
            try (SafeCloseable t = appsList.trackRemoves(a -> removedComponents.add(a.componentName))) {
                for (String aPackage : packages) {
                    if (DEBUG)
                        Log.d(TAG, "mAllAppsList.updatePackage " + aPackage);
                    iconCache.updateIconsForPkg(aPackage, mUser);
                    appsList.updatePackage(context, aPackage, mUser);
                    app.getWidgetCache().removePackage(aPackage, mUser);
                }
            }
            // Since package was just updated, the target must be available now.
            flagOp = FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
            break;
        case OP_REMOVE:
            {
                for (String aPackage : packages) {
                    FileLog.d(TAG, "Removing app icon" + aPackage);
                    iconCache.removeIconsForPkg(aPackage, mUser);
                }
            // Fall through
            }
        case OP_UNAVAILABLE:
            for (int i = 0; i < N; i++) {
                if (DEBUG)
                    Log.d(TAG, "mAllAppsList.removePackage " + packages[i]);
                appsList.removePackage(packages[i], mUser);
                app.getWidgetCache().removePackage(packages[i], mUser);
            }
            flagOp = FlagOp.addFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
            break;
        case OP_SUSPEND:
        case OP_UNSUSPEND:
            flagOp = mOp == OP_SUSPEND ? FlagOp.addFlag(WorkspaceItemInfo.FLAG_DISABLED_SUSPENDED) : FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_SUSPENDED);
            if (DEBUG)
                Log.d(TAG, "mAllAppsList.(un)suspend " + N);
            appsList.updateDisabledFlags(matcher, flagOp);
            break;
        case OP_USER_AVAILABILITY_CHANGE:
            flagOp = UserManagerCompat.getInstance(context).isQuietModeEnabled(mUser) ? FlagOp.addFlag(WorkspaceItemInfo.FLAG_DISABLED_QUIET_USER) : FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_QUIET_USER);
            // We want to update all packages for this user.
            matcher = ItemInfoMatcher.ofUser(mUser);
            appsList.updateDisabledFlags(matcher, flagOp);
            break;
        case OP_RELOAD:
            if (DEBUG)
                Log.d(TAG, "mAllAppsList.reloadPackages");
            appsList.reloadPackages(context, mUser);
            break;
    }
    bindApplicationsIfNeeded();
    final IntSparseArrayMap<Boolean> removedShortcuts = new IntSparseArrayMap<>();
    // Update shortcut infos
    if (mOp == OP_ADD || flagOp != FlagOp.NO_OP) {
        final ArrayList<WorkspaceItemInfo> updatedWorkspaceItems = new ArrayList<>();
        final ArrayList<LauncherAppWidgetInfo> widgets = new ArrayList<>();
        // For system apps, package manager send OP_UPDATE when an app is enabled.
        final boolean isNewApkAvailable = mOp == OP_ADD || mOp == OP_UPDATE;
        synchronized (dataModel) {
            for (ItemInfo info : dataModel.itemsIdMap) {
                if (info instanceof WorkspaceItemInfo && mUser.equals(info.user)) {
                    WorkspaceItemInfo si = (WorkspaceItemInfo) info;
                    boolean infoUpdated = false;
                    boolean shortcutUpdated = false;
                    // Update shortcuts which use iconResource.
                    if ((si.iconResource != null) && packageSet.contains(si.iconResource.packageName)) {
                        LauncherIcons li = LauncherIcons.obtain(context);
                        BitmapInfo iconInfo = li.createIconBitmap(si.iconResource);
                        li.recycle();
                        if (iconInfo != null) {
                            si.applyFrom(iconInfo);
                            infoUpdated = true;
                        }
                    }
                    ComponentName cn = si.getTargetComponent();
                    if (cn != null && matcher.matches(si, cn)) {
                        String packageName = cn.getPackageName();
                        if (si.hasStatusFlag(WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI)) {
                            removedShortcuts.put(si.id, false);
                            if (mOp == OP_REMOVE) {
                                continue;
                            }
                        }
                        if (si.isPromise() && isNewApkAvailable) {
                            boolean isTargetValid = true;
                            if (si.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
                                List<ShortcutInfo> shortcut = DeepShortcutManager.getInstance(context).queryForPinnedShortcuts(cn.getPackageName(), Arrays.asList(si.getDeepShortcutId()), mUser);
                                if (shortcut.isEmpty()) {
                                    isTargetValid = false;
                                } else {
                                    si.updateFromDeepShortcutInfo(shortcut.get(0), context);
                                    infoUpdated = true;
                                }
                            } else if (!cn.getClassName().equals(IconCache.EMPTY_CLASS_NAME)) {
                                isTargetValid = LauncherAppsCompat.getInstance(context).isActivityEnabledForProfile(cn, mUser);
                            }
                            if (si.hasStatusFlag(FLAG_RESTORED_ICON | FLAG_AUTOINSTALL_ICON)) {
                                if (updateWorkspaceItemIntent(context, si, packageName)) {
                                    infoUpdated = true;
                                } else if (si.hasPromiseIconUi()) {
                                    removedShortcuts.put(si.id, true);
                                    continue;
                                }
                            } else if (!isTargetValid) {
                                removedShortcuts.put(si.id, true);
                                FileLog.e(TAG, "Restored shortcut no longer valid " + si.intent);
                                continue;
                            } else {
                                si.status = WorkspaceItemInfo.DEFAULT;
                                infoUpdated = true;
                            }
                        } else if (isNewApkAvailable && removedComponents.contains(cn)) {
                            if (updateWorkspaceItemIntent(context, si, packageName)) {
                                infoUpdated = true;
                            }
                        }
                        if (isNewApkAvailable && si.itemType == Favorites.ITEM_TYPE_APPLICATION) {
                            iconCache.getTitleAndIcon(si, si.usingLowResIcon());
                            infoUpdated = true;
                        }
                        int oldRuntimeFlags = si.runtimeStatusFlags;
                        si.runtimeStatusFlags = flagOp.apply(si.runtimeStatusFlags);
                        if (si.runtimeStatusFlags != oldRuntimeFlags) {
                            shortcutUpdated = true;
                        }
                    }
                    if (infoUpdated || shortcutUpdated) {
                        updatedWorkspaceItems.add(si);
                    }
                    if (infoUpdated) {
                        getModelWriter().updateItemInDatabase(si);
                    }
                } else if (info instanceof LauncherAppWidgetInfo && isNewApkAvailable) {
                    LauncherAppWidgetInfo widgetInfo = (LauncherAppWidgetInfo) info;
                    if (mUser.equals(widgetInfo.user) && widgetInfo.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY) && packageSet.contains(widgetInfo.providerName.getPackageName())) {
                        widgetInfo.restoreStatus &= ~LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY & ~LauncherAppWidgetInfo.FLAG_RESTORE_STARTED;
                        // adding this flag ensures that launcher shows 'click to setup'
                        // if the widget has a config activity. In case there is no config
                        // activity, it will be marked as 'restored' during bind.
                        widgetInfo.restoreStatus |= LauncherAppWidgetInfo.FLAG_UI_NOT_READY;
                        widgets.add(widgetInfo);
                        getModelWriter().updateItemInDatabase(widgetInfo);
                    }
                }
            }
        }
        bindUpdatedWorkspaceItems(updatedWorkspaceItems);
        if (!removedShortcuts.isEmpty()) {
            deleteAndBindComponentsRemoved(ItemInfoMatcher.ofItemIds(removedShortcuts, false));
        }
        if (!widgets.isEmpty()) {
            scheduleCallbackTask(c -> c.bindWidgetsRestored(widgets));
        }
    }
    final HashSet<String> removedPackages = new HashSet<>();
    if (mOp == OP_REMOVE) {
        // Mark all packages in the broadcast to be removed
        Collections.addAll(removedPackages, packages);
    // No need to update the removedComponents as
    // removedPackages is a super-set of removedComponents
    } else if (mOp == OP_UPDATE) {
        // Mark disabled packages in the broadcast to be removed
        final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context);
        for (int i = 0; i < N; i++) {
            if (!launcherApps.isPackageEnabledForProfile(packages[i], mUser)) {
                removedPackages.add(packages[i]);
            }
        }
    }
    if (!removedPackages.isEmpty() || !removedComponents.isEmpty()) {
        ItemInfoMatcher removeMatch = ItemInfoMatcher.ofPackages(removedPackages, mUser).or(ItemInfoMatcher.ofComponents(removedComponents, mUser)).and(ItemInfoMatcher.ofItemIds(removedShortcuts, true));
        deleteAndBindComponentsRemoved(removeMatch);
        // Remove any queued items from the install queue
        InstallShortcutReceiver.removeFromInstallQueue(context, removedPackages, mUser);
    }
    if (Utilities.ATLEAST_OREO && mOp == OP_ADD) {
        // AppWidgetHost events, this is just to initialize the long-press options.
        for (int i = 0; i < N; i++) {
            dataModel.widgetsModel.update(app, new PackageUserKey(packages[i], mUser));
        }
        bindUpdatedWidgets(dataModel);
    }
}
Also used : LauncherAppsCompat(com.android.launcher3.compat.LauncherAppsCompat) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo) ItemInfo(com.android.launcher3.ItemInfo) IntSparseArrayMap(com.android.launcher3.util.IntSparseArrayMap) ArrayList(java.util.ArrayList) OmegaPreferences(com.saggitt.omega.OmegaPreferences) IconCache(com.android.launcher3.icons.IconCache) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) ComponentName(android.content.ComponentName) FlagOp(com.android.launcher3.util.FlagOp) HashSet(java.util.HashSet) Context(android.content.Context) ShortcutInfo(android.content.pm.ShortcutInfo) LauncherAppWidgetInfo(com.android.launcher3.LauncherAppWidgetInfo) PackageUserKey(com.android.launcher3.util.PackageUserKey) LauncherIcons(com.android.launcher3.icons.LauncherIcons) SafeCloseable(com.android.launcher3.util.SafeCloseable) BitmapInfo(com.android.launcher3.icons.BitmapInfo) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo)

Aggregations

ArrayList (java.util.ArrayList)62 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)56 Context (android.content.Context)39 LauncherAppState (com.android.launcher3.LauncherAppState)38 HashSet (java.util.HashSet)37 ShortcutInfo (android.content.pm.ShortcutInfo)33 List (java.util.List)33 ComponentName (android.content.ComponentName)32 ItemInfo (com.android.launcher3.model.data.ItemInfo)30 LauncherActivityInfo (android.content.pm.LauncherActivityInfo)24 Point (android.graphics.Point)24 LauncherApps (android.content.pm.LauncherApps)23 IconCache (com.android.launcher3.icons.IconCache)23 LauncherIcons (com.android.launcher3.icons.LauncherIcons)23 AppInfo (com.android.launcher3.model.data.AppInfo)22 PackageManager (android.content.pm.PackageManager)20 InvariantDeviceProfile (com.android.launcher3.InvariantDeviceProfile)20 HashMap (java.util.HashMap)20 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)19 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)19