Merge "Finish recents animation for app-icon tap" into sc-v2-dev
diff --git a/Android.bp b/Android.bp
index d04dca0..8b7eb54 100644
--- a/Android.bp
+++ b/Android.bp
@@ -278,16 +278,15 @@
srcs: [
":launcher-src-no-build-config",
],
- resource_dirs: [
- "quickstep/res",
- ],
+ resource_dirs: [],
libs: [
"framework-statsd",
],
static_libs: [
+ "QuickstepResLib",
"SystemUI-statsd",
"SystemUISharedLib",
- "Launcher3CommonDepsLib"
+ "Launcher3CommonDepsLib",
],
manifest: "quickstep/AndroidManifest.xml",
platform_apis: true,
diff --git a/quickstep/res/drawable/task_menu_item_bg.xml b/quickstep/res/drawable/task_menu_item_bg.xml
index b6a8b90..16c13eb 100644
--- a/quickstep/res/drawable/task_menu_item_bg.xml
+++ b/quickstep/res/drawable/task_menu_item_bg.xml
@@ -15,7 +15,8 @@
limitations under the License.
-->
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="?android:attr/colorPrimary"/>
- <corners android:radius="@dimen/task_menu_item_corner_radius"/>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <solid android:color="?androidprv:attr/colorSurface" />
+ <corners android:radius="@dimen/task_menu_item_corner_radius" />
</shape>
diff --git a/quickstep/res/layout/task_menu_with_arrow.xml b/quickstep/res/layout/task_menu_with_arrow.xml
new file mode 100644
index 0000000..38573fd
--- /dev/null
+++ b/quickstep/res/layout/task_menu_with_arrow.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.android.quickstep.views.TaskMenuViewWithArrow
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:animateLayoutChanges="true"
+ android:background="@drawable/task_menu_bg"
+ android:orientation="vertical"
+ android:visibility="invisible">
+
+ <LinearLayout
+ android:id="@+id/menu_option_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:showDividers="middle" />
+
+</com.android.quickstep.views.TaskMenuViewWithArrow>
\ No newline at end of file
diff --git a/quickstep/res/layout/task_view_menu_option.xml b/quickstep/res/layout/task_view_menu_option.xml
index 5978b97..8a8fc36 100644
--- a/quickstep/res/layout/task_view_menu_option.xml
+++ b/quickstep/res/layout/task_view_menu_option.xml
@@ -18,7 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="vertical"
+ android:orientation="horizontal"
android:paddingTop="@dimen/task_card_menu_option_vertical_padding"
android:paddingBottom="@dimen/task_card_menu_option_vertical_padding"
android:background="@drawable/task_menu_item_bg"
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 0b534e3..e48c9e8 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -27,7 +27,7 @@
<dimen name="task_menu_corner_radius">22dp</dimen>
<dimen name="task_menu_item_corner_radius">4dp</dimen>
<dimen name="task_menu_spacing">2dp</dimen>
- <dimen name="task_menu_width_grid">200dp</dimen>
+ <dimen name="task_menu_width_grid">234dp</dimen>
<dimen name="overview_proactive_row_height">48dp</dimen>
<dimen name="overview_proactive_row_bottom_margin">16dp</dimen>
@@ -91,7 +91,7 @@
<dimen name="task_menu_vertical_padding">8dp</dimen>
<dimen name="task_card_margin">8dp</dimen>
<dimen name="task_card_menu_shadow_height">3dp</dimen>
- <dimen name="task_menu_option_start_margin">12dp</dimen>
+ <dimen name="task_menu_option_start_margin">16dp</dimen>
<!-- Copied from framework resource:
docked_stack_divider_thickness - 2 * docked_stack_divider_insets -->
<dimen name="multi_window_task_divider_size">10dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index a2e4c22..cc83431 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -61,7 +61,6 @@
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
-import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.SettingsCache;
@@ -108,6 +107,8 @@
private final boolean mIsSafeModeEnabled;
private final boolean mIsUserSetupComplete;
private boolean mIsDestroyed = false;
+ // The flag to know if the window is excluded from magnification region computation.
+ private boolean mIsExcludeFromMagnificationRegion = false;
public TaskbarActivityContext(Context windowContext, DeviceProfile dp,
TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider
@@ -520,4 +521,25 @@
protected boolean isUserSetupComplete() {
return mIsUserSetupComplete;
}
+
+ /**
+ * Called when we determine the touchable region.
+ *
+ * @param exclude {@code true} then the magnification region computation will omit the window.
+ */
+ public void excludeFromMagnificationRegion(boolean exclude) {
+ if (mIsExcludeFromMagnificationRegion == exclude) {
+ return;
+ }
+
+ mIsExcludeFromMagnificationRegion = exclude;
+ if (exclude) {
+ mWindowLayoutParams.privateFlags |=
+ WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;
+ } else {
+ mWindowLayoutParams.privateFlags &=
+ ~WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;
+ }
+ mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams);
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
index cec892f..8c6185c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
@@ -137,12 +137,14 @@
// Always have nav buttons be touchable
mControllers.navbarButtonsViewController.addVisibleButtonsRegion(
mTaskbarDragLayer, insetsInfo.touchableRegion);
+ boolean insetsIsTouchableRegion = true;
if (mTaskbarDragLayer.getAlpha() < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
} else if (mControllers.navbarButtonsViewController.isImeVisible()) {
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_CONTENT);
+ insetsIsTouchableRegion = false;
} else if (!mControllers.uiController.isTaskbarTouchable()) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
@@ -151,9 +153,11 @@
// Taskbar has some touchable elements, take over the full taskbar area
insetsInfo.setTouchableInsets(mActivity.isTaskbarWindowFullscreen()
? TOUCHABLE_INSETS_FRAME : TOUCHABLE_INSETS_CONTENT);
+ insetsIsTouchableRegion = false;
} else {
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
}
+ mActivity.excludeFromMagnificationRegion(insetsIsTouchableRegion);
}
/**
diff --git a/quickstep/src/com/android/quickstep/KtR.java b/quickstep/src/com/android/quickstep/KtR.java
new file mode 100644
index 0000000..57dad08
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/KtR.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.quickstep;
+
+import com.android.launcher3.R;
+
+/**
+ * Bridge class to allow using resources in Kotlin.
+ * <br/>
+ * TODO(b/204069723) Can't use resources directly in Kotlin
+ */
+public class KtR {
+ public static final class id {
+ public static int menu_option_layout = R.id.menu_option_layout;
+ }
+
+ public static final class dimen {
+ public static int task_menu_spacing = R.dimen.task_menu_spacing;
+ }
+
+ public static final class layout {
+ public static int task_menu_with_arrow = R.layout.task_menu_with_arrow;
+ public static int task_view_menu_option = R.layout.task_view_menu_option;
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
index ae81573..eace227 100644
--- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
+++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
@@ -119,7 +119,11 @@
}
protected boolean showTaskMenuWithContainer(IconView iconView) {
- return TaskMenuView.showForTask(mTaskIdAttributeContainer[iconView == mIconView ? 0 : 1]);
+ if (mActivity.getDeviceProfile().overviewShowAsGrid) {
+ return TaskMenuViewWithArrow.Companion.showForTask(mTaskIdAttributeContainer[0]);
+ } else {
+ return TaskMenuView.showForTask(mTaskIdAttributeContainer[0]);
+ }
}
public void updateSplitBoundsConfig(StagedSplitBounds stagedSplitBounds) {
diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
index 77ac373..d55b89c 100644
--- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
@@ -34,7 +34,6 @@
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver.OnScrollChangedListener;
import android.widget.LinearLayout;
@@ -270,15 +269,9 @@
BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams();
int padding = getResources()
.getDimensionPixelSize(R.dimen.task_menu_vertical_padding);
- if (deviceProfile.overviewShowAsGrid) {
- // TODO(b/193432925) temporary so it doesn't look terrible on large screen
- params.width =
- getContext().getResources().getDimensionPixelSize(R.dimen.task_menu_width_grid);
- } else {
- params.width = orientationHandler
- .getTaskMenuWidth(taskContainer.getThumbnailView(),
- deviceProfile) - (2 * padding);
- }
+ params.width = orientationHandler
+ .getTaskMenuWidth(taskContainer.getThumbnailView(),
+ deviceProfile) - (2 * padding);
// Gravity set to Left instead of Start as sTempRect.left measures Left distance not Start
params.gravity = Gravity.LEFT;
setLayoutParams(params);
@@ -349,13 +342,4 @@
return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);
}
- public View findMenuItemByText(String text) {
- for (int i = mOptionLayout.getChildCount() - 1; i >= 0; --i) {
- final ViewGroup menuOptionView = (ViewGroup) mOptionLayout.getChildAt(i);
- if (text.equals(menuOptionView.<TextView>findViewById(R.id.text).getText())) {
- return menuOptionView;
- }
- }
- return null;
- }
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt b/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt
index 9b86c73..5059f8b 100644
--- a/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt
@@ -1,14 +1,167 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.android.quickstep.views
-import android.util.Log
+import android.animation.AnimatorSet
+import android.animation.ObjectAnimator
+import android.content.Context
+import android.graphics.Rect
+import android.graphics.drawable.ShapeDrawable
+import android.graphics.drawable.shapes.RectShape
+import android.util.AttributeSet
+import android.view.MotionEvent
+import android.view.View
+import android.view.ViewGroup
+import android.widget.LinearLayout
+import com.android.launcher3.BaseDraggingActivity
+import com.android.launcher3.DeviceProfile
+import com.android.launcher3.R
+import com.android.launcher3.popup.ArrowPopup
+import com.android.launcher3.popup.SystemShortcut
+import com.android.launcher3.util.Themes
+import com.android.quickstep.KtR
+import com.android.quickstep.TaskOverlayFactory
+import com.android.quickstep.views.TaskView.TaskIdAttributeContainer
-// TODO(http://b/193432925)
-class TaskMenuViewWithArrow {
+class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
companion object {
const val TAG = "TaskMenuViewWithArrow"
- fun logSomething() {
- Log.d(TAG, "It worked!")
+ fun showForTask(taskContainer: TaskIdAttributeContainer): Boolean {
+ val activity = BaseDraggingActivity
+ .fromContext<BaseDraggingActivity>(taskContainer.taskView.context)
+ val taskMenuViewWithArrow = activity.layoutInflater
+ .inflate(KtR.layout.task_menu_with_arrow, activity.dragLayer, false) as TaskMenuViewWithArrow<*>
+
+ return taskMenuViewWithArrow.populateAndShowForTask(taskContainer)
}
}
+
+ constructor(context: Context) : super(context)
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
+ constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
+
+ init {
+ clipToOutline = true
+ }
+
+ private val menuWidth = context.resources.getDimensionPixelSize(R.dimen.task_menu_width_grid)
+
+ private lateinit var taskView: TaskView
+ private lateinit var optionLayout: LinearLayout
+ private lateinit var taskContainer: TaskIdAttributeContainer
+
+ override fun isOfType(type: Int): Boolean = type and TYPE_TASK_MENU != 0
+
+ override fun getTargetObjectLocation(outPos: Rect?) {
+ popupContainer.getDescendantRectRelativeToSelf(taskView.iconView, outPos)
+ }
+
+ override fun onControllerInterceptTouchEvent(ev: MotionEvent?): Boolean {
+ if (ev?.action == MotionEvent.ACTION_DOWN) {
+ if (!popupContainer.isEventOverView(this, ev)) {
+ close(true)
+ return true
+ }
+ }
+ return false
+ }
+
+ override fun onFinishInflate() {
+ super.onFinishInflate()
+ optionLayout = findViewById(KtR.id.menu_option_layout)
+ }
+
+ private fun populateAndShowForTask(taskContainer: TaskIdAttributeContainer): Boolean {
+ if (isAttachedToWindow) {
+ return false
+ }
+
+ taskView = taskContainer.taskView
+ this.taskContainer = taskContainer
+ if (!populateMenu()) return false
+ show()
+ return true
+ }
+
+ /** @return true if successfully able to populate task view menu, false otherwise
+ */
+ private fun populateMenu(): Boolean {
+ // Icon may not be loaded
+ if (taskContainer.task.icon == null) return false
+
+ addMenuOptions()
+ return true
+ }
+
+ private fun addMenuOptions() {
+ // Add the options
+ TaskOverlayFactory
+ .getEnabledShortcuts(taskView, mActivityContext.deviceProfile, taskContainer)
+ .forEach { this.addMenuOption(it) }
+
+ // Add the spaces between items
+ val divider = ShapeDrawable(RectShape())
+ divider.paint.color = resources.getColor(android.R.color.transparent)
+ val dividerSpacing = resources.getDimension(KtR.dimen.task_menu_spacing).toInt()
+ optionLayout.showDividers = SHOW_DIVIDER_MIDDLE
+
+ // Set the orientation, which makes the menu show
+ val recentsView: RecentsView<*, *> = mActivityContext.getOverviewPanel()
+ val orientationHandler = recentsView.pagedOrientationHandler
+ val deviceProfile: DeviceProfile = mActivityContext.deviceProfile
+ orientationHandler.setTaskOptionsMenuLayoutOrientation(
+ deviceProfile,
+ optionLayout,
+ dividerSpacing,
+ divider
+ )
+ }
+
+ private fun addMenuOption(menuOption: SystemShortcut<*>) {
+ val menuOptionView = mActivityContext.layoutInflater.inflate(
+ KtR.layout.task_view_menu_option, this, false
+ ) as LinearLayout
+ menuOption.setIconAndLabelFor(
+ menuOptionView.findViewById(R.id.icon),
+ menuOptionView.findViewById(R.id.text)
+ )
+ val lp = menuOptionView.layoutParams as LayoutParams
+ lp.width = menuWidth
+ menuOptionView.setOnClickListener { view: View? -> menuOption.onClick(view) }
+ optionLayout.addView(menuOptionView)
+ }
+
+ override fun assignMarginsAndBackgrounds(viewGroup: ViewGroup) {
+ assignMarginsAndBackgrounds(this, Themes.getAttrColor(context, com.android.internal.R.attr.colorSurface))
+ }
+
+ override fun onCreateOpenAnimation(anim: AnimatorSet) {
+ anim.play(
+ ObjectAnimator.ofFloat(
+ taskContainer.thumbnailView, TaskThumbnailView.DIM_ALPHA,
+ TaskView.MAX_PAGE_SCRIM_ALPHA
+ )
+ )
+ }
+
+ override fun onCreateCloseAnimation(anim: AnimatorSet) {
+ anim.play(
+ ObjectAnimator.ofFloat(taskContainer.thumbnailView, TaskThumbnailView.DIM_ALPHA, 0f)
+ )
+ }
}
\ No newline at end of file
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index a8c2bc3..62aa73d 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -95,7 +95,6 @@
import com.android.quickstep.util.LauncherSplitScreenListener;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.TaskCornerRadius;
-import com.android.quickstep.util.TaskViewSimulator;
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
import com.android.systemui.shared.recents.model.Task;
@@ -838,9 +837,11 @@
}
protected boolean showTaskMenuWithContainer(IconView iconView) {
- // TODO(http://b/193432925)
- if (DEBUG) TaskMenuViewWithArrow.Companion.logSomething();
- return TaskMenuView.showForTask(mTaskIdAttributeContainer[0]);
+ if (mActivity.getDeviceProfile().overviewShowAsGrid) {
+ return TaskMenuViewWithArrow.Companion.showForTask(mTaskIdAttributeContainer[0]);
+ } else {
+ return TaskMenuView.showForTask(mTaskIdAttributeContainer[0]);
+ }
}
protected void setIcon(IconView iconView, Drawable icon) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 8d92bf2..8154168 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -154,6 +154,7 @@
import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.pm.PinRequestHelper;
import com.android.launcher3.pm.UserCache;
+import com.android.launcher3.popup.ArrowPopup;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.popup.SystemShortcut;
@@ -3032,4 +3033,13 @@
public StatsLogManager getStatsLogManager() {
return super.getStatsLogManager().withDefaultInstanceId(mAllAppsSessionLogId);
}
+
+ /**
+ * Returns the current popup for testing, if any.
+ */
+ @VisibleForTesting
+ @Nullable
+ public ArrowPopup<?> getOptionsPopup() {
+ return findViewById(R.id.popup_container);
+ }
}
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index d987212..8b7bebc 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -518,7 +518,10 @@
LAUNCHER_TASKBAR_LONGPRESS_HIDE(896),
@UiEvent(doc = "User long pressed on the taskbar gesture handle to show the taskbar")
- LAUNCHER_TASKBAR_LONGPRESS_SHOW(897);
+ LAUNCHER_TASKBAR_LONGPRESS_SHOW(897),
+
+ @UiEvent(doc = "User clicks on the search icon on header to launch search in app.")
+ LAUNCHER_ALLAPPS_SEARCHINAPP_LAUNCH(913);
// ADD MORE
diff --git a/src/com/android/launcher3/model/data/SearchActionItemInfo.java b/src/com/android/launcher3/model/data/SearchActionItemInfo.java
index 293c095..c6e5e8a 100644
--- a/src/com/android/launcher3/model/data/SearchActionItemInfo.java
+++ b/src/com/android/launcher3/model/data/SearchActionItemInfo.java
@@ -46,6 +46,7 @@
public static final int FLAG_PRIMARY_ICON_FROM_TITLE = 1 << 4;
public static final int FLAG_BADGE_WITH_COMPONENT_NAME = 1 << 5;
public static final int FLAG_ALLOW_PINNING = 1 << 6;
+ public static final int FLAG_SEARCH_IN_APP = 1 << 7;
private String mFallbackPackageName;
private int mFlags = 0;
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index 2230914..5a1e4bf 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -234,7 +234,7 @@
* @param backgroundColor When Color.TRANSPARENT, we get color from {@link #mColorIds}.
* Otherwise, we will use this color for all child views.
*/
- private void assignMarginsAndBackgrounds(ViewGroup viewGroup, int backgroundColor) {
+ protected void assignMarginsAndBackgrounds(ViewGroup viewGroup, int backgroundColor) {
int[] colors = null;
if (backgroundColor == Color.TRANSPARENT) {
// Lazily get the colors so they match the current wallpaper colors.
@@ -445,7 +445,7 @@
animateOpen();
}
- private void setupForDisplay() {
+ protected void setupForDisplay() {
setVisibility(View.INVISIBLE);
mIsOpen = true;
getPopupContainer().addView(this);
@@ -482,7 +482,7 @@
mArrow.setVisibility(show && shouldAddArrow() ? VISIBLE : INVISIBLE);
}
- private void addArrow() {
+ protected void addArrow() {
getPopupContainer().addView(mArrow);
mArrow.setX(getX() + getArrowLeft());
@@ -686,12 +686,13 @@
return getChildCount() > 0 ? getChildAt(0) : this;
}
- private void animateOpen() {
+ protected void animateOpen() {
setVisibility(View.VISIBLE);
mOpenCloseAnimator = getOpenCloseAnimator(true, OPEN_DURATION, OPEN_FADE_START_DELAY,
OPEN_FADE_DURATION, OPEN_CHILD_FADE_START_DELAY, OPEN_CHILD_FADE_DURATION,
DECELERATED_EASE);
+ onCreateOpenAnimation(mOpenCloseAnimator);
mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -785,6 +786,11 @@
}
/**
+ * Called when creating the open transition allowing subclass can add additional animations.
+ */
+ protected void onCreateOpenAnimation(AnimatorSet anim) { }
+
+ /**
* Called when creating the close transition allowing subclass can add additional animations.
*/
protected void onCreateCloseAnimation(AnimatorSet anim) { }
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index 5e907a4..8d57d69 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -17,6 +17,7 @@
import static com.android.launcher3.Launcher.REQUEST_BIND_PENDING_APPWIDGET;
import static com.android.launcher3.Launcher.REQUEST_RECONFIGURE_APPWIDGET;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SEARCHINAPP_LAUNCH;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_BY_PUBLISHER;
@@ -286,7 +287,13 @@
Toast.LENGTH_SHORT).show();
}
}
- launcher.getStatsLogManager().logger().withItemInfo(itemInfo).log(LAUNCHER_APP_LAUNCH_TAP);
+ if (itemInfo.hasFlags(SearchActionItemInfo.FLAG_SEARCH_IN_APP)) {
+ launcher.getStatsLogManager().logger().withItemInfo(itemInfo).log(
+ LAUNCHER_ALLAPPS_SEARCHINAPP_LAUNCH);
+ } else {
+ launcher.getStatsLogManager().logger().withItemInfo(itemInfo).log(
+ LAUNCHER_APP_LAUNCH_TAP);
+ }
}
private static void startAppShortcutOrInfoActivity(View v, ItemInfo item, Launcher launcher) {
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 9774c46..fc8b4b7 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -37,7 +37,6 @@
import android.widget.Toast;
import androidx.annotation.Nullable;
-import androidx.annotation.VisibleForTesting;
import androidx.core.content.ContextCompat;
import com.android.launcher3.AbstractFloatingView;
@@ -176,11 +175,6 @@
return children;
}
- @VisibleForTesting
- public static ArrowPopup getOptionsPopup(Launcher launcher) {
- return launcher.findViewById(R.id.popup_container);
- }
-
/**
* Returns the list of supported actions
*/
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index f29ac23..a9bcd67 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -38,7 +38,6 @@
import com.android.launcher3.tapl.FolderIcon;
import com.android.launcher3.tapl.Widgets;
import com.android.launcher3.tapl.Workspace;
-import com.android.launcher3.views.OptionsPopupView;
import com.android.launcher3.widget.picker.WidgetsFullSheet;
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
@@ -102,8 +101,8 @@
mDevice.pressMenu();
mDevice.waitForIdle();
executeOnLauncher(
- launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu",
- OptionsPopupView.getOptionsPopup(launcher) != null));
+ launcher -> assertNotNull("Launcher internal state didn't switch to Showing Menu",
+ launcher.getOptionsPopup()));
// Check that pressHome works when the menu is shown.
mLauncher.pressHome();
}
@@ -286,7 +285,7 @@
}
private boolean isOptionsPopupVisible(Launcher launcher) {
- final ArrowPopup popup = OptionsPopupView.getOptionsPopup(launcher);
+ final ArrowPopup<?> popup = launcher.getOptionsPopup();
return popup != null && popup.isShown();
}