Add smartspace as a widget to first page (implementation 2)

Flag: SMARTSPACE_AS_A_WIDGET
Test: verify that the smartspace gets replaced with a smartspace widget
Bug: 300140279
Change-Id: I42c170de5e2a9fd3d24d99bb8b09cf412c55e3a5
This commit is contained in:
fbaron
2023-09-25 11:34:56 -07:00
committed by Federico Baron
parent 94f7b53a54
commit e58aaf1802
16 changed files with 119 additions and 15 deletions

View File

@@ -29,6 +29,7 @@ import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT;
@@ -594,7 +595,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
* Initializes and binds the first page
*/
public void bindAndInitFirstWorkspaceScreen() {
if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {
if (!FeatureFlags.QSB_ON_FIRST_SCREEN
|| shouldShowFirstPageWidget()) {
return;
}
@@ -1012,7 +1014,9 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
int id = mWorkspaceScreens.keyAt(i);
CellLayout cl = mWorkspaceScreens.valueAt(i);
// FIRST_SCREEN_ID can never be removed.
if ((!FeatureFlags.QSB_ON_FIRST_SCREEN || id > FIRST_SCREEN_ID)
if (((!FeatureFlags.QSB_ON_FIRST_SCREEN
|| shouldShowFirstPageWidget())
|| id > FIRST_SCREEN_ID)
&& cl.getShortcutsAndWidgets().getChildCount() == 0) {
removeScreens.add(id);
}