From 226843cde1456755f90ab20c406376556f8cb17c Mon Sep 17 00:00:00 2001 From: "sfufa@google.com" Date: Tue, 9 Nov 2021 15:56:11 -0800 Subject: [PATCH 1/8] [Search] Introduce notifyEvent api in OneSearch plugin Bug: 204243851 Test: presubmit Change-Id: Idba665419038f743f3d977602dab44d270f94642 --- .../com/android/systemui/plugins/OneSearch.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src_plugins/com/android/systemui/plugins/OneSearch.java b/src_plugins/com/android/systemui/plugins/OneSearch.java index 29826c39e3..13a956bd80 100644 --- a/src_plugins/com/android/systemui/plugins/OneSearch.java +++ b/src_plugins/com/android/systemui/plugins/OneSearch.java @@ -28,7 +28,7 @@ import java.util.ArrayList; @ProvidesInterface(action = OneSearch.ACTION, version = OneSearch.VERSION) public interface OneSearch extends Plugin { String ACTION = "com.android.systemui.action.PLUGIN_ONE_SEARCH"; - int VERSION = 4; + int VERSION = 5; /** * Get the content provider warmed up. @@ -37,10 +37,18 @@ public interface OneSearch extends Plugin { /** * Get the suggest search target list for the query. + * * @param query The query to get the search suggests for. */ ArrayList getSuggests(Parcelable query); /** Get image bitmap with the URL. */ Parcelable getImageBitmap(String imageUrl); + + /** + * Notifies search events to plugin + * + * @param event the SearchTargetEvent event created due to user action + */ + void notifyEvent(Parcelable event); } From afe8fadc150b024ace70b0d8966d64f052604a9c Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Tue, 9 Nov 2021 16:11:58 -0800 Subject: [PATCH 2/8] Add FeatureFlag to enable two line label inside all apps Bug: 201388851 Test: screenshot on the bug Change-Id: Id01d6f9f9e25b98cad8368ac0faf671addf793f8 --- res/layout/all_apps_icon_twoline.xml | 25 +++++++++++++++++++ res/values/dimens.xml | 3 ++- .../launcher3/allapps/AllAppsGridAdapter.java | 11 +++++++- .../launcher3/config/FeatureFlags.java | 3 +++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 res/layout/all_apps_icon_twoline.xml diff --git a/res/layout/all_apps_icon_twoline.xml b/res/layout/all_apps_icon_twoline.xml new file mode 100644 index 0000000000..54c714734c --- /dev/null +++ b/res/layout/all_apps_icon_twoline.xml @@ -0,0 +1,25 @@ + + + + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 4d137c84b5..f685f01329 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -104,8 +104,9 @@ 2dp 128dp 150dp - 8dp + 6dp + 2dp 2dp diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index 874fe80ef0..6951562cde 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -41,6 +41,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.BubbleTextView; import com.android.launcher3.R; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.util.PackageManagerHelper; @@ -273,6 +274,8 @@ public class AllAppsGridAdapter extends // The intent to send off to the market app, updated each time the search query changes. private Intent mMarketSearchIntent; + private final int mExtraHeight; + public AllAppsGridAdapter(BaseDraggingActivity launcher, LayoutInflater inflater, AlphabeticalAppsList apps, BaseAdapterProvider[] adapterProviders) { Resources res = launcher.getResources(); @@ -288,6 +291,7 @@ public class AllAppsGridAdapter extends mAdapterProviders = adapterProviders; setAppsPerRow(mLauncher.getDeviceProfile().numShownAllAppsColumns); + mExtraHeight = launcher.getResources().getDimensionPixelSize(R.dimen.all_apps_height_extra); } public void setAppsPerRow(int appsPerRow) { @@ -347,14 +351,19 @@ public class AllAppsGridAdapter extends public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_ICON: + int layout = !FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() ? R.layout.all_apps_icon + : R.layout.all_apps_icon_twoline; BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate( - R.layout.all_apps_icon, parent, false); + layout, parent, false); icon.setLongPressTimeoutFactor(1f); icon.setOnFocusChangeListener(mIconFocusListener); icon.setOnClickListener(mOnIconClickListener); icon.setOnLongClickListener(mOnIconLongClickListener); // Ensure the all apps icon height matches the workspace icons in portrait mode. icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx; + if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) { + icon.getLayoutParams().height += mExtraHeight; + } return new ViewHolder(icon); case VIEW_TYPE_EMPTY_SEARCH: return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search, diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 13583874b9..f298ad58b6 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -94,6 +94,9 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_ONE_SEARCH = new DeviceFlag("ENABLE_ONE_SEARCH", false, "Use homescreen search box to complete allApps searches"); + public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag( + "ENABLE_TWOLINE_ALLAPPS", false, "Enables two line label inside all apps."); + public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = new DeviceFlag( "ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", true, "Allows on device search in all apps logging"); From b498b648aec5d1d95fc51c6dd3dc2f43b3efa100 Mon Sep 17 00:00:00 2001 From: Fedor Kudasov Date: Wed, 10 Nov 2021 14:26:00 +0000 Subject: [PATCH 3/8] Annotate AttributeSet with @Nullable Bug: 205828770 Test: m LauncherGoResLib Change-Id: Ib8584e1bbcc7061aef2eb4813a8f6aa41d3c7362 (cherry picked from commit 96f8792c04d3bb8154d4699c88d73d006cce9c21) --- .../src/com/android/quickstep/views/FloatingTaskView.java | 6 ++++-- .../src/com/android/quickstep/views/FloatingWidgetView.java | 6 ++++-- .../com/android/quickstep/views/LauncherRecentsView.java | 6 ++++-- .../src/com/android/quickstep/views/TaskThumbnailView.java | 5 +++-- quickstep/src/com/android/quickstep/views/TaskView.java | 4 ++-- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index 5a86464498..e2ffa18315 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -15,6 +15,8 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; +import androidx.annotation.Nullable; + import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAnimUtils; @@ -51,11 +53,11 @@ public class FloatingTaskView extends FrameLayout { this(context, null); } - public FloatingTaskView(Context context, AttributeSet attrs) { + public FloatingTaskView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } - public FloatingTaskView(Context context, AttributeSet attrs, int defStyleAttr) { + public FloatingTaskView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mLauncher = Launcher.getLauncher(context); mIsRtl = Utilities.isRtl(getResources()); diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java index 88b11a0884..463ed4bd9c 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java @@ -30,6 +30,8 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.widget.FrameLayout; +import androidx.annotation.Nullable; + import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.Utilities; @@ -68,11 +70,11 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener, this(context, null); } - public FloatingWidgetView(Context context, AttributeSet attrs) { + public FloatingWidgetView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } - public FloatingWidgetView(Context context, AttributeSet attrs, int defStyleAttr) { + public FloatingWidgetView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mLauncher = Launcher.getLauncher(context); mListenerView = new ListenerView(context, attrs); diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index 715d30e4af..5d6b6563f7 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -30,6 +30,8 @@ import android.util.AttributeSet; import android.view.MotionEvent; import android.view.Surface; +import androidx.annotation.Nullable; + import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.LauncherState; import com.android.launcher3.statehandlers.DepthController; @@ -49,11 +51,11 @@ public class LauncherRecentsView extends RecentsView Date: Thu, 11 Nov 2021 11:20:04 -0800 Subject: [PATCH 4/8] Update Split Overview menu strings Bug: 181704764 Change-Id: Icaf51a702d529e20a0e65c4708fc7bc833e5eeeb --- res/values/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index e215c20311..5f53d4e24a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -40,9 +40,9 @@ Split screen - Pin to top - Pin to left - Pin to right + Split top + Split left + Split right From 80836f637fcc5a0a75d1a5a128fca82c3650eb10 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 11 Nov 2021 19:38:25 +0000 Subject: [PATCH 5/8] Update corner radius of both snapshot in app pair Fix: 206002609 Test: manual Change-Id: I6af28c6948769eac53326d61e84ac39196bd840f --- .../src/com/android/quickstep/views/GroupedTaskView.java | 7 ++++++- quickstep/src/com/android/quickstep/views/TaskView.java | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index eace227c5c..ba74b0dc61 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -14,7 +14,6 @@ import androidx.annotation.Nullable; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.util.RunnableList; -import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds; import com.android.launcher3.util.TransformingTouchDelegate; import com.android.quickstep.RecentsModel; @@ -241,4 +240,10 @@ public class GroupedTaskView extends TaskView { taskIconHeight, mPrimaryTempRect, mSecondaryTempRect, isRtl, deviceProfile, mSplitBoundsConfig); } + + @Override + protected void updateSnapshotRadius() { + super.updateSnapshotRadius(); + mSnapshotView2.setFullscreenParams(mCurrentFullscreenParams); + } } diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 62aa73db5b..fab383763c 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -92,7 +92,6 @@ import com.android.quickstep.TaskThumbnailCache; import com.android.quickstep.TaskUtils; import com.android.quickstep.TaskViewUtils; import com.android.quickstep.util.CancellableTask; -import com.android.quickstep.util.LauncherSplitScreenListener; import com.android.quickstep.util.RecentsOrientedState; import com.android.quickstep.util.TaskCornerRadius; import com.android.quickstep.util.TransformParams; @@ -369,7 +368,7 @@ public class TaskView extends FrameLayout implements Reusable { private float mGridProgress; private float mNonGridScale = 1; private float mDismissScale = 1; - private final FullscreenDrawParams mCurrentFullscreenParams; + protected final FullscreenDrawParams mCurrentFullscreenParams; protected final StatefulActivity mActivity; // Various causes of changing primary translation, which we aggregate to setTranslationX/Y(). @@ -1374,7 +1373,7 @@ public class TaskView extends FrameLayout implements Reusable { invalidateOutline(); } - void updateSnapshotRadius() { + protected void updateSnapshotRadius() { updateCurrentFullscreenParams(mSnapshotView.getPreviewPositionHelper()); mSnapshotView.setFullscreenParams(mCurrentFullscreenParams); } From 1e5b621a50ee5ba23dbd9cb4fe93b572dc68806a Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Wed, 10 Nov 2021 20:32:55 -0800 Subject: [PATCH 6/8] Address AppEventProducer to correctly send search-result location on AppTargetEvent Bug: 191362091 Test: logcat printout 11-10 20:27:02.290 32215 32237 D QuickstepModelDelegate: notifyAppTargetEvent action=1launchLocation=search-results Change-Id: I16ef7679116e397a8a108cc291f5741febf2e453 --- .../android/launcher3/model/AppEventProducer.java | 13 ++++++++++--- .../launcher3/model/QuickstepModelDelegate.java | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/model/AppEventProducer.java b/quickstep/src/com/android/launcher3/model/AppEventProducer.java index 1305bbc7b2..7c29c5b4c6 100644 --- a/quickstep/src/com/android/launcher3/model/AppEventProducer.java +++ b/quickstep/src/com/android/launcher3/model/AppEventProducer.java @@ -271,9 +271,6 @@ public class AppEventProducer implements StatsLogConsumer { case ALL_APPS_CONTAINER: { return "all-apps"; } - case SEARCH_RESULT_CONTAINER: { - return "search-results"; - } case PREDICTED_HOTSEAT_CONTAINER: { return "predictions/hotseat"; } @@ -293,6 +290,16 @@ public class AppEventProducer implements StatsLogConsumer { } return "folder"; } + case SEARCH_RESULT_CONTAINER: + return "search-results"; + case EXTENDED_CONTAINERS: { + switch(ci.getExtendedContainers().getContainerCase()) { + case DEVICE_SEARCH_RESULT_CONTAINER: + case CORRECTED_DEVICE_SEARCH_RESULT_CONTAINER: + return "search-results"; + } + } + default: // fall out } return ""; } diff --git a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java index 7794d27d26..e82c900734 100644 --- a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java +++ b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java @@ -329,6 +329,8 @@ public class QuickstepModelDelegate extends ModelDelegate { } if (state.predictor != null) { state.predictor.notifyAppTargetEvent(event); + Log.d(TAG, "notifyAppTargetEvent action=" + event.getAction() + + " launchLocation=" + event.getLaunchLocation()); } } From d0e6c8b2e706c2a0329df60a78eba0d53ba971fd Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 12 Nov 2021 05:39:30 +0000 Subject: [PATCH 7/8] Freeze task list if requested when launching split tasks Bug: 206000278 Test: Quickswitch from app pair and back Change-Id: I76af1396145e121e7f66f9e6b97f21a85c075e8e --- .../util/SplitSelectStateController.java | 16 ++++++++++++---- .../android/quickstep/views/GroupedTaskView.java | 5 +++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java index e1afa97f6f..b32c4e5550 100644 --- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java @@ -21,8 +21,10 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT; +import android.app.ActivityOptions; import android.app.ActivityThread; import android.graphics.Rect; +import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.view.RemoteAnimationAdapter; @@ -78,14 +80,15 @@ public class SplitSelectStateController { */ public void setSecondTaskId(Task taskView, Consumer callback) { mSecondTask = taskView; - launchTasks(mInitialTask, mSecondTask, mStagePosition, callback); + launchTasks(mInitialTask, mSecondTask, mStagePosition, callback, + false /* freezeTaskList */); } /** * @param stagePosition representing location of task1 */ public void launchTasks(Task task1, Task task2, @StagePosition int stagePosition, - Consumer callback) { + Consumer callback, boolean freezeTaskList) { // Assume initial task is for top/left part of screen final int[] taskIds = stagePosition == STAGE_POSITION_TOP_OR_LEFT ? new int[]{task1.key.id, task2.key.id} @@ -105,8 +108,13 @@ public class SplitSelectStateController { 300, 150, ActivityThread.currentActivityThread().getApplicationThread()); - mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], null /* mainOptions */, - taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, adapter); + ActivityOptions mainOpts = ActivityOptions.makeBasic(); + if (freezeTaskList) { + mainOpts.setFreezeRecentTasksReordering(); + } + mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], mainOpts.toBundle(), + taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, + adapter); } } diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index eace227c5c..c0b66f403b 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -157,14 +157,15 @@ public class GroupedTaskView extends TaskView { @Override public RunnableList launchTaskAnimated() { getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask, - STAGE_POSITION_TOP_OR_LEFT, null /*callback*/); + STAGE_POSITION_TOP_OR_LEFT, null /*callback*/, + false /* freezeTaskList */); return null; } @Override public void launchTask(@NonNull Consumer callback, boolean freezeTaskList) { getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask, - STAGE_POSITION_TOP_OR_LEFT, callback); + STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList); } @Override From f75725830a32ed25129e09bf54bc0f22cd43e8f3 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 11 Nov 2021 17:54:39 +0000 Subject: [PATCH 8/8] Fix launch animation from grid - Fixed calculateGridTaskSize to algin to taskRect instead of gridRect - Extracted end of grid's scroll diff calculation to getOffsetFromScrollPosition to accurately calculate end of grid task's offset between its scroll and visual position (End of grid task's scroll is all the same at the position where ClearAllButton is just invisible) - Extracted isGridTask in TaskView so TaskViewSimualtor can use the correct task size depedning if it's grid task or not Bug: 200813202 Test: manual Change-Id: I11a980345aee2680abf1c2563baadd9718a40192 --- .../quickstep/BaseActivityInterface.java | 8 +- .../com/android/quickstep/TaskViewUtils.java | 1 + .../quickstep/util/TaskViewSimulator.java | 21 ++++- .../android/quickstep/views/RecentsView.java | 92 +++++++++++++------ .../com/android/quickstep/views/TaskView.java | 10 +- 5 files changed, 96 insertions(+), 36 deletions(-) diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index f9b749ee14..e15aa92cf1 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -322,11 +322,11 @@ public abstract class BaseActivityInterface