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

Commit c5b8e77a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Separating apps list callback from model callback and simplifying...

Merge "Separating apps list callback from model callback and simplifying various events" into ub-launcher3-master
parents 7404f354 87dcde6d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@

package com.android.launcher3.model;

import com.android.launcher3.AllAppsList;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.model.BgDataModel.Callbacks;

import java.lang.ref.WeakReference;

+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ public class PredictionRowView extends LinearLayout implements
    }

    private List<ItemInfoWithIcon> processPredictedAppComponents(List<ComponentKeyMapper> components) {
        if (getAppsStore().getApps().isEmpty()) {
        if (getAppsStore().getApps().length == 0) {
            // Apps have not been bound yet.
            return Collections.emptyList();
        }
+1 −2
Original line number Diff line number Diff line
@@ -15,14 +15,13 @@ import android.graphics.Color;
import android.os.Process;
import android.os.UserHandle;

import com.android.launcher3.AllAppsList;
import com.android.launcher3.AppFilter;
import com.android.launcher3.AppInfo;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.model.BgDataModel.Callbacks;
import com.android.launcher3.LauncherModel.ModelUpdateTask;
import com.android.launcher3.LauncherProvider;
import com.android.launcher3.icons.IconCache;
+8 −0
Original line number Diff line number Diff line
@@ -29,11 +29,19 @@ import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageManagerHelper;

import java.util.Comparator;

/**
 * Represents an app in AllAppsView.
 */
public class AppInfo extends ItemInfoWithIcon {

    public static AppInfo[] EMPTY_ARRAY = new AppInfo[0];
    public static Comparator<AppInfo> COMPONENT_KEY_COMPARATOR = (a, b) -> {
        int uc = a.user.hashCode() - b.user.hashCode();
        return uc != 0 ? uc : a.componentName.compareTo(b.componentName);
    };

    /**
     * The intent used to start the application.
     */
+3 −18
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ import com.android.launcher3.logging.StatsLogUtils;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.model.BgDataModel.Callbacks;
import com.android.launcher3.model.ModelWriter;
import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.popup.PopupContainerWithArrow;
@@ -112,7 +113,6 @@ import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.states.InternalStateHandler;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto;
@@ -163,7 +163,7 @@ import androidx.annotation.Nullable;
 * Default launcher application.
 */
public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        LauncherModel.Callbacks, LauncherProviderChangeListener, UserEventDelegate,
        Callbacks, LauncherProviderChangeListener, UserEventDelegate,
        InvariantDeviceProfile.OnIDPChangeListener {
    public static final String TAG = "Launcher";
    static final boolean LOGD = false;
@@ -2335,7 +2335,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
     *
     * Implementation of the method from LauncherModel.Callbacks.
     */
    public void bindAllApplications(ArrayList<AppInfo> apps) {
    public void bindAllApplications(AppInfo[] apps) {
        mAppsView.getAppsStore().setApps(apps);
    }

@@ -2348,16 +2348,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        mPopupDataProvider.setDeepShortcutMap(deepShortcutMapCopy);
    }

    /**
     * A package was updated.
     *
     * Implementation of the method from LauncherModel.Callbacks.
     */
    @Override
    public void bindAppsAddedOrUpdated(ArrayList<AppInfo> apps) {
        mAppsView.getAppsStore().addOrUpdateApps(apps);
    }

    @Override
    public void bindPromiseAppProgressUpdated(PromiseAppInfo app) {
        mAppsView.getAppsStore().updatePromiseAppProgress(app);
@@ -2404,11 +2394,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        mDragController.onAppsRemoved(matcher);
    }

    @Override
    public void bindAppInfosRemoved(final ArrayList<AppInfo> appInfos) {
        mAppsView.getAppsStore().removeApps(appInfos);
    }

    @Override
    public void bindAllWidgets(final ArrayList<WidgetListRowEntry> allWidgets) {
        mPopupDataProvider.setAllWidgets(allWidgets);
Loading