diff options
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d79230f8b..75d48eedf 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -20,6 +20,8 @@ import static android.content.pm.ActivityInfo.CONFIG_LOCALE; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE; +import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; +import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherState.ALL_APPS; @@ -77,6 +79,8 @@ import android.view.accessibility.AccessibilityEvent; import android.view.animation.OvershootInterpolator; import android.widget.Toast; +import androidx.annotation.Nullable; + import com.android.launcher3.DropTarget.DragObject; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.allapps.AllAppsContainerView; @@ -92,8 +96,8 @@ import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragView; import com.android.launcher3.folder.Folder; +import com.android.launcher3.folder.FolderGridOrganizer; import com.android.launcher3.folder.FolderIcon; -import com.android.launcher3.folder.FolderIconPreviewVerifier; import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.icons.IconCache; import com.android.launcher3.keyboard.CustomActionsPopup; @@ -103,14 +107,13 @@ 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; 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; @@ -156,13 +159,11 @@ import java.util.HashSet; import java.util.List; import java.util.function.Predicate; -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; @@ -603,10 +604,9 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, if (info.container >= 0) { View folderIcon = getWorkspace().getHomescreenIconByItemId(info.container); if (folderIcon instanceof FolderIcon && folderIcon.getTag() instanceof FolderInfo) { - FolderIconPreviewVerifier verifier = - new FolderIconPreviewVerifier(getDeviceProfile().inv); - verifier.setFolderInfo((FolderInfo) folderIcon.getTag()); - if (verifier.isItemInPreview(info.rank)) { + if (new FolderGridOrganizer(getDeviceProfile().inv) + .setFolderInfo((FolderInfo) folderIcon.getTag()) + .isItemInPreview(info.rank)) { folderIcon.invalidate(); } } @@ -1435,9 +1435,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, outState.remove(RUNTIME_STATE_WIDGET_PANEL); } - // We close any open folders and shortcut containers since they will not be re-opened, + // We close any open folders and shortcut containers that are not safe for rebind, // and we need to make sure this state is reflected. - AbstractFloatingView.closeAllOpenViews(this, false); + AbstractFloatingView.closeOpenViews(this, false, TYPE_ALL & ~TYPE_REBIND_SAFE); + finishAutoCancelActionMode(); if (mPendingRequestArgs != null) { outState.putParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS, mPendingRequestArgs); @@ -1722,8 +1723,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, return true; } - - @Override public boolean dispatchKeyEvent(KeyEvent event) { return (event.getKeyCode() == KeyEvent.KEYCODE_HOME) || super.dispatchKeyEvent(event); @@ -1922,8 +1921,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, // Floating panels (except the full widget sheet) are associated with individual icons. If // we are starting a fresh bind, close all such panels as all the icons are about // to go away. - AbstractFloatingView.closeOpenViews(this, true, - AbstractFloatingView.TYPE_ALL & ~AbstractFloatingView.TYPE_REBIND_SAFE); + AbstractFloatingView.closeOpenViews(this, true, TYPE_ALL & ~TYPE_REBIND_SAFE); setWorkspaceLoading(true); @@ -2344,7 +2342,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); } @@ -2357,16 +2355,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); @@ -2414,11 +2402,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, } @Override - public void bindAppInfosRemoved(final ArrayList<AppInfo> appInfos) { - mAppsView.getAppsStore().removeApps(appInfos); - } - - @Override public void bindAllWidgets(final ArrayList<WidgetListRowEntry> allWidgets) { mPopupDataProvider.setAllWidgets(allWidgets); } @@ -2577,6 +2560,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, return (Launcher) fromContext(context); } + @Override + public void returnToHomescreen() { + super.returnToHomescreen(); + getStateManager().goToState(LauncherState.NORMAL); + } + /** * Just a wrapper around the type cast to allow easier tracking of calls. */ |