Merge "Add test to long press icon on home screen" into udc-qpr-dev
diff --git a/quickstep/res/layout/taskbar_divider_popup_menu.xml b/quickstep/res/layout/taskbar_divider_popup_menu.xml
index 195443e..00e47c9 100644
--- a/quickstep/res/layout/taskbar_divider_popup_menu.xml
+++ b/quickstep/res/layout/taskbar_divider_popup_menu.xml
@@ -32,7 +32,7 @@
android:clickable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
- android:background="@drawable/top_rounded_popup_ripple"
+ android:background="@drawable/rounded_popup_ripple"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:theme="@style/PopupItem">
@@ -59,40 +59,4 @@
android:text="@string/always_show_taskbar" />
</LinearLayout>
-
- <LinearLayout
- android:id="@+id/navigation_mode_switch_option"
- android:layout_width="match_parent"
- android:layout_height="52dp"
- android:layout_gravity="center_vertical"
- android:elevation="2dp"
- android:clickable="true"
- android:focusable="true"
- android:background="@drawable/bottom_rounded_popup_ripple"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingEnd="10dp"
- android:paddingStart="10dp"
- android:theme="@style/PopupItem">
-
- <View
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:layout_margin="4dp"
- android:background="@drawable/ic_touch"
- android:backgroundTint="?android:attr/textColorPrimary" />
-
- <com.android.launcher3.BubbleTextView
- style="@style/BaseIcon"
- android:id="@+id/change_navigation_mode_text"
- android:gravity="start|center_vertical"
- android:textAlignment="viewStart"
- android:paddingStart="12dp"
- android:singleLine="true"
- android:ellipsize="end"
- android:textSize="14sp"
- android:textColor="?android:attr/textColorPrimary"
- android:text="@string/change_navigation_mode" />
-
- </LinearLayout>
</com.android.launcher3.taskbar.TaskbarDividerPopupView>
\ No newline at end of file
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 9fe0c00..0b83a88 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -306,6 +306,9 @@
// Initialize controllers after all are constructed.
mControllers.init(sharedState);
+ // This may not be necessary and can be reverted once we move towards recreating all
+ // controllers without re-creating the window
+ mControllers.rotationButtonController.onNavigationModeChanged(mNavMode.resValue);
updateSysuiStateFlags(sharedState.sysuiStateFlags, true /* fromInit */);
disableNavBarElements(sharedState.disableNavBarDisplayId, sharedState.disableNavBarState1,
sharedState.disableNavBarState2, false /* animate */);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
index a347908..b0d2c3c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
@@ -17,7 +17,6 @@
import android.annotation.SuppressLint
import android.content.Context
-import android.content.Intent
import android.graphics.Rect
import android.graphics.drawable.GradientDrawable
import android.util.AttributeSet
@@ -44,9 +43,6 @@
companion object {
private const val TAG = "TaskbarDividerPopupView"
private const val DIVIDER_POPUP_CLOSING_DELAY = 500L
- private const val SETTINGS_PACKAGE_NAME = "com.android.settings"
- private const val CHANGE_NAVIGATION_MODE_ACTION =
- "com.android.settings.NAVIGATION_MODE_SETTINGS"
@JvmStatic
fun createAndPopulate(
@@ -103,21 +99,12 @@
super.onFinishInflate()
val taskbarSwitchOption = findViewById<LinearLayout>(R.id.taskbar_switch_option)
val alwaysShowTaskbarSwitch = findViewById<Switch>(R.id.taskbar_pinning_switch)
- val navigationModeChangeOption =
- findViewById<LinearLayout>(R.id.navigation_mode_switch_option)
alwaysShowTaskbarSwitch.isChecked = alwaysShowTaskbarOn
taskbarSwitchOption.setOnClickListener {
alwaysShowTaskbarSwitch.isClickable = true
alwaysShowTaskbarSwitch.isChecked = !alwaysShowTaskbarOn
onClickAlwaysShowTaskbarSwitchOption()
}
- navigationModeChangeOption.setOnClickListener {
- context.startActivity(
- Intent(CHANGE_NAVIGATION_MODE_ACTION)
- .setPackage(SETTINGS_PACKAGE_NAME)
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
- )
- }
}
/** Orient object as usual and then center object horizontally. */
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index a935bac..c51a7ec 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -15,6 +15,7 @@
*/
package com.android.launcher3.taskbar
+import android.inputmethodservice.InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR
import android.graphics.Insets
import android.graphics.Region
import android.os.Binder
@@ -43,6 +44,7 @@
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.launcher3.util.DisplayController
import java.io.PrintWriter
+import kotlin.jvm.optionals.getOrNull
/** Handles the insets that Taskbar provides to underlying apps and the IME. */
class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTaskbarController {
@@ -198,16 +200,22 @@
val imeInsetsSize = getInsetsForGravity(taskbarHeightForIme, gravity)
val imeInsetsSizeOverride =
- arrayOf(
- InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
- )
+ if (!ENABLE_HIDE_IME_CAPTION_BAR) {
+ arrayOf(
+ InsetsFrameProvider.InsetsSizeOverride(
+ TYPE_INPUT_METHOD,
+ imeInsetsSize
+ ),
+ )
+ } else {
+ arrayOf()
+ }
// Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled.
val visInsetsSizeForTappableElement =
if (context.isGestureNav) getInsetsForGravity(0, gravity)
else getInsetsForGravity(tappableHeight, gravity)
val insetsSizeOverrideForTappableElement =
- arrayOf(
- InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
+ imeInsetsSizeOverride + arrayOf(
InsetsFrameProvider.InsetsSizeOverride(
TYPE_VOICE_INTERACTION,
visInsetsSizeForTappableElement
@@ -216,7 +224,7 @@
if ((context.isGestureNav || TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
&& provider.type == tappableElement()) {
provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement
- } else if (provider.type != systemGestures()) {
+ } else if (provider.type != systemGestures() && imeInsetsSizeOverride.isNotEmpty()) {
// We only override insets at the bottom of the screen
provider.insetsSizeOverrides = imeInsetsSizeOverride
}
@@ -283,9 +291,24 @@
controllers.uiController.isInOverview &&
DisplayController.isTransientTaskbar(context)
) {
- insetsInfo.touchableRegion.set(
+ val region =
controllers.taskbarActivityContext.dragLayer.lastDrawnTransientRect.toRegion()
- )
+ val bubbleBarBounds =
+ controllers.bubbleControllers.getOrNull()?.let { bubbleControllers ->
+ if (!bubbleControllers.bubbleStashController.isBubblesShowingOnOverview) {
+ return@let null
+ }
+ if (!bubbleControllers.bubbleBarViewController.isBubbleBarVisible) {
+ return@let null
+ }
+ bubbleControllers.bubbleBarViewController.bubbleBarBounds
+ }
+
+ // Include the bounds of the bubble bar in the touchable region if they exist.
+ if (bubbleBarBounds != null) {
+ region.op(bubbleBarBounds, Region.Op.UNION)
+ }
+ insetsInfo.touchableRegion.set(region)
} else {
insetsInfo.touchableRegion.set(touchableRegion)
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java
index 0ff0469..41c3dec 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java
@@ -17,7 +17,6 @@
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
-import android.os.SystemProperties;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -43,10 +42,6 @@
public class BubbleDismissController {
private static final String TAG = BubbleDismissController.class.getSimpleName();
private static final float FLING_TO_DISMISS_MIN_VELOCITY = 6000f;
- // LINT.IfChange
- private static final boolean ENABLE_FLING_TO_DISMISS_BUBBLE =
- SystemProperties.getBoolean("persist.wm.debug.fling_to_dismiss_bubble", true);
- // LINT.ThenChange(com/android/wm/shell/bubbles/BubbleStackView.java)
private final TaskbarActivityContext mActivity;
private final TaskbarDragLayer mDragLayer;
@Nullable
@@ -182,7 +177,6 @@
};
mMagnetizedObject.setHapticsEnabled(true);
- mMagnetizedObject.setFlingToTargetEnabled(ENABLE_FLING_TO_DISMISS_BUBBLE);
mMagnetizedObject.setFlingToTargetMinVelocity(FLING_TO_DISMISS_MIN_VELOCITY);
if (mMagneticTarget != null) {
mMagnetizedObject.addTarget(mMagneticTarget);
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
index 00c2ca1..a5ea5a9 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java
@@ -197,6 +197,11 @@
}
}
+ /** Whether bubbles are showing on Overview. */
+ public boolean isBubblesShowingOnOverview() {
+ return mBubblesShowingOnOverview;
+ }
+
/** Called when sysui locked state changes, when locked, bubble bar is stashed. */
public void onSysuiLockedStateChange(boolean isSysuiLocked) {
if (isSysuiLocked != mIsSysuiLocked) {
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index d74a13b..b444b49 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -34,7 +34,6 @@
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE;
-import static com.android.launcher3.config.FeatureFlags.RECEIVE_UNFOLD_EVENTS_FROM_SYSUI;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
@@ -58,7 +57,6 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
-import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
@@ -68,8 +66,6 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.RectF;
-import android.hardware.SensorManager;
-import android.hardware.devicestate.DeviceStateManager;
import android.hardware.display.DisplayManager;
import android.media.permission.SafeCloseable;
import android.os.Build;
@@ -157,7 +153,6 @@
import com.android.quickstep.TouchInteractionService.TISBinder;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.LauncherUnfoldAnimationController;
-import com.android.quickstep.util.ProxyScreenStatusProvider;
import com.android.quickstep.util.QuickstepOnboardingPrefs;
import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.util.SplitToWorkspaceController;
@@ -171,14 +166,11 @@
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.unfold.RemoteUnfoldSharedComponent;
-import com.android.systemui.unfold.UnfoldSharedComponent;
import com.android.systemui.unfold.UnfoldTransitionFactory;
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
import com.android.systemui.unfold.config.ResourceUnfoldTransitionConfig;
import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.unfold.progress.RemoteUnfoldTransitionReceiver;
-import com.android.systemui.unfold.system.ActivityManagerActivityTypeProvider;
-import com.android.systemui.unfold.system.DeviceStateManagerFoldProvider;
import com.android.systemui.unfold.updates.RotationChangeProvider;
import java.io.FileDescriptor;
@@ -465,10 +457,7 @@
public void onDestroy() {
mAppTransitionManager.onActivityDestroyed();
if (mUnfoldTransitionProgressProvider != null) {
- if (FeatureFlags.RECEIVE_UNFOLD_EVENTS_FROM_SYSUI.get()) {
- SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null);
- }
-
+ SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null);
mUnfoldTransitionProgressProvider.destroy();
}
@@ -482,6 +471,10 @@
mDesktopVisibilityController.unregisterSystemUiListener();
}
+ if (mSplitSelectStateController != null) {
+ mSplitSelectStateController.onDestroy();
+ }
+
super.onDestroy();
mHotseatPredictionController.destroy();
mSplitWithKeyboardShortcutController.onDestroy();
@@ -905,43 +898,10 @@
private void initUnfoldTransitionProgressProvider() {
final UnfoldTransitionConfig config = new ResourceUnfoldTransitionConfig();
if (config.isEnabled()) {
- if (RECEIVE_UNFOLD_EVENTS_FROM_SYSUI.get()) {
- initRemotelyCalculatedUnfoldAnimation(config);
- } else {
- initLocallyCalculatedUnfoldAnimation(config);
- }
-
+ initRemotelyCalculatedUnfoldAnimation(config);
}
}
- /** Registers hinge angle listener and calculates the animation progress in this process. */
- private void initLocallyCalculatedUnfoldAnimation(UnfoldTransitionConfig config) {
- UnfoldSharedComponent unfoldComponent =
- UnfoldTransitionFactory.createUnfoldSharedComponent(
- /* context= */ this,
- config,
- ProxyScreenStatusProvider.INSTANCE,
- new DeviceStateManagerFoldProvider(
- getSystemService(DeviceStateManager.class), /* context= */ this),
- new ActivityManagerActivityTypeProvider(
- getSystemService(ActivityManager.class)),
- getSystemService(SensorManager.class),
- getMainThreadHandler(),
- getMainExecutor(),
- /* backgroundExecutor= */ UI_HELPER_EXECUTOR,
- /* tracingTagPrefix= */ "launcher",
- getSystemService(DisplayManager.class)
- );
-
- mUnfoldTransitionProgressProvider = unfoldComponent.getUnfoldTransitionProvider()
- .orElseThrow(() -> new IllegalStateException(
- "Trying to create UnfoldTransitionProgressProvider when the "
- + "transition is disabled"));
-
- initUnfoldAnimationController(mUnfoldTransitionProgressProvider,
- unfoldComponent.getRotationChangeProvider());
- }
-
/** Receives animation progress from sysui process. */
private void initRemotelyCalculatedUnfoldAnimation(UnfoldTransitionConfig config) {
RemoteUnfoldSharedComponent unfoldComponent =
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 68828fd..1ef4039 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -193,6 +193,7 @@
ActiveGestureLog.INSTANCE.addLog("Launcher destroyed", LAUNCHER_DESTROYED);
mRecentsView = null;
mActivity = null;
+ mStateCallback.clearState(STATE_LAUNCHER_PRESENT);
}
};
@@ -517,20 +518,22 @@
// Set up a entire animation lifecycle callback to notify the current recents view when
// the animation is canceled
mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> {
- HashMap<Integer, ThumbnailData> snapshots =
- mGestureState.consumeRecentsAnimationCanceledSnapshot();
- if (snapshots != null) {
- mRecentsView.switchToScreenshot(snapshots, () -> {
- if (mRecentsAnimationController != null) {
- mRecentsAnimationController.cleanupScreenshot();
- } else if (mDeferredCleanupRecentsAnimationController != null) {
- mDeferredCleanupRecentsAnimationController.cleanupScreenshot();
- mDeferredCleanupRecentsAnimationController = null;
- }
- });
- mRecentsView.onRecentsAnimationComplete();
- }
- });
+ if (mRecentsView == null) return;
+
+ HashMap<Integer, ThumbnailData> snapshots =
+ mGestureState.consumeRecentsAnimationCanceledSnapshot();
+ if (snapshots != null) {
+ mRecentsView.switchToScreenshot(snapshots, () -> {
+ if (mRecentsAnimationController != null) {
+ mRecentsAnimationController.cleanupScreenshot();
+ } else if (mDeferredCleanupRecentsAnimationController != null) {
+ mDeferredCleanupRecentsAnimationController.cleanupScreenshot();
+ mDeferredCleanupRecentsAnimationController = null;
+ }
+ });
+ mRecentsView.onRecentsAnimationComplete();
+ }
+ });
setupRecentsViewUi();
mRecentsView.runOnPageScrollsInitialized(this::linkRecentsViewScroll);
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index 2e1a62c..72439de 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -37,6 +37,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Trace;
+import android.util.Log;
import android.view.Display;
import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationTarget;
@@ -59,7 +60,6 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.compat.AccessibilityManagerCompat;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory;
@@ -67,6 +67,7 @@
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.taskbar.FallbackTaskbarUIController;
import com.android.launcher3.taskbar.TaskbarManager;
+import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.util.ActivityTracker;
import com.android.launcher3.util.RunnableList;
@@ -393,7 +394,7 @@
super.onDestroy();
ACTIVITY_TRACKER.onActivityDestroyed(this);
mActivityLaunchAnimationRunner = null;
-
+ mSplitSelectStateController.onDestroy();
mTISBindHelper.onDestroy();
}
@@ -404,6 +405,7 @@
}
public void startHome() {
+ Log.d(TestProtocol.INCORRECT_HOME_STATE, "start home from recents activity");
RecentsView recentsView = getOverviewPanel();
recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true,
this::startHomeInternal));
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 6dbb5bf..0b5a070 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -38,6 +38,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.TopTaskTracker.CachedTaskInfo;
import com.android.quickstep.util.ActiveGestureLog;
@@ -179,6 +180,9 @@
RecentsView recentsView =
activityInterface.getCreatedActivity().getOverviewPanel();
if (recentsView != null) {
+ Log.d(TestProtocol.INCORRECT_HOME_STATE,
+ "finish recents animation on "
+ + compat.taskInfo.description);
recentsView.finishRecentsAnimation(true, null);
}
return;
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 7a9f88a..22aca25 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -70,6 +70,7 @@
import android.os.SystemClock;
import android.util.Log;
import android.view.Choreographer;
+import android.view.InputDevice;
import android.view.InputEvent;
import android.view.MotionEvent;
import android.view.SurfaceControl;
@@ -116,7 +117,6 @@
import com.android.quickstep.inputconsumers.TrackpadStatusBarInputConsumer;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.ActiveGestureLog.CompoundString;
-import com.android.quickstep.util.ProxyScreenStatusProvider;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -302,24 +302,6 @@
@BinderThread
@Override
- public void onScreenTurnedOn() {
- MAIN_EXECUTOR.execute(ProxyScreenStatusProvider.INSTANCE::onScreenTurnedOn);
- }
-
- @BinderThread
- @Override
- public void onScreenTurningOn() {
- MAIN_EXECUTOR.execute(ProxyScreenStatusProvider.INSTANCE::onScreenTurningOn);
- }
-
- @BinderThread
- @Override
- public void onScreenTurningOff() {
- MAIN_EXECUTOR.execute(ProxyScreenStatusProvider.INSTANCE::onScreenTurningOff);
- }
-
- @BinderThread
- @Override
public void enterStageSplitFromRunningApp(boolean leftOrTop) {
executeForTouchInteractionService(tis -> {
StatefulActivity activity =
@@ -771,7 +753,7 @@
if (mGestureState.isTrackpadGesture() && (action == ACTION_POINTER_DOWN
|| action == ACTION_POINTER_UP)) {
// Skip ACTION_POINTER_DOWN and ACTION_POINTER_UP events from trackpad.
- } else if (event.isHoverEvent()) {
+ } else if (isCursorHoverEvent(event)) {
mUncheckedConsumer.onHoverEvent(event);
} else {
mUncheckedConsumer.onMotionEvent(event);
@@ -783,6 +765,11 @@
traceToken.close();
}
+ // Talkback generates hover events on touch, which we do not want to consume.
+ private boolean isCursorHoverEvent(MotionEvent event) {
+ return event.isHoverEvent() && event.getSource() == InputDevice.SOURCE_MOUSE;
+ }
+
private InputConsumer tryCreateAssistantInputConsumer(
GestureState gestureState, MotionEvent motionEvent) {
return tryCreateAssistantInputConsumer(
@@ -914,7 +901,8 @@
base = new TaskbarUnstashInputConsumer(this, base, mInputMonitorCompat, tac,
mOverviewCommandHelper);
}
- } else if (canStartSystemGesture && FeatureFlags.ENABLE_LONG_PRESS_NAV_HANDLE.get()) {
+ } else if (canStartSystemGesture && FeatureFlags.ENABLE_LONG_PRESS_NAV_HANDLE.get()
+ && !previousGestureState.isRecentsAnimationRunning()) {
base = new NavHandleLongPressInputConsumer(this, base, mInputMonitorCompat);
}
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java
index 4b13cd1..0e90e50 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarUnstashInputConsumer.java
@@ -15,7 +15,6 @@
*/
package com.android.quickstep.inputconsumers;
-import static android.view.MotionEvent.ACTION_BUTTON_RELEASE;
import static android.view.MotionEvent.INVALID_POINTER_ID;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent;
@@ -29,6 +28,7 @@
import android.graphics.Rect;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
+import android.view.InputDevice;
import android.view.MotionEvent;
import androidx.annotation.Nullable;
@@ -130,8 +130,8 @@
public void onMotionEvent(MotionEvent ev) {
mLongPressDetector.onTouchEvent(ev);
if (mState != STATE_ACTIVE) {
- boolean isStashedTaskbarHovered =
- isStashedTaskbarHovered((int) ev.getX(), (int) ev.getY());
+ boolean isStashedTaskbarHovered = isMouseEvent(ev)
+ && isStashedTaskbarHovered((int) ev.getX(), (int) ev.getY());
if (!isStashedTaskbarHovered) {
mDelegate.onMotionEvent(ev);
}
@@ -229,7 +229,7 @@
mHasPassedTaskbarNavThreshold = false;
mIsInBubbleBarArea = false;
break;
- case ACTION_BUTTON_RELEASE:
+ case MotionEvent.ACTION_BUTTON_RELEASE:
if (isStashedTaskbarHovered) {
mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_HOME);
}
@@ -342,4 +342,8 @@
dp.heightPx);
return mStashedTaskbarHandleBounds.contains(x, y);
}
+
+ private boolean isMouseEvent(MotionEvent event) {
+ return event.getSource() == InputDevice.SOURCE_MOUSE;
+ }
}
diff --git a/quickstep/src/com/android/quickstep/util/ProxyScreenStatusProvider.java b/quickstep/src/com/android/quickstep/util/ProxyScreenStatusProvider.java
deleted file mode 100644
index 8f79ccf..0000000
--- a/quickstep/src/com/android/quickstep/util/ProxyScreenStatusProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.util;
-
-import androidx.annotation.NonNull;
-
-import com.android.systemui.unfold.updates.screen.ScreenStatusProvider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Screen status provider implementation that exposes methods to provide screen
- * status updates to listeners. It is used to receive screen turned on event from
- * SystemUI to Launcher.
- */
-public class ProxyScreenStatusProvider implements ScreenStatusProvider {
-
- public static final ProxyScreenStatusProvider INSTANCE = new ProxyScreenStatusProvider();
- private final List<ScreenListener> mListeners = new ArrayList<>();
-
- /**
- * Called when the screen is on and ready (windows are drawn and screen blocker is removed)
- */
- public void onScreenTurnedOn() {
- mListeners.forEach(ScreenListener::onScreenTurnedOn);
- }
-
- /** Called when the screen is starting to turn on. */
- public void onScreenTurningOn() {
- mListeners.forEach(ScreenListener::onScreenTurningOn);
- }
-
- /** Called when the screen is starting to turn off. */
- public void onScreenTurningOff() {
- mListeners.forEach(ScreenListener::onScreenTurningOff);
- }
-
- @Override
- public void addCallback(@NonNull ScreenListener listener) {
- mListeners.add(listener);
- }
-
- @Override
- public void removeCallback(@NonNull ScreenListener listener) {
- mListeners.remove(listener);
- }
-}
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index 0c89766..6d5aa16 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -113,7 +113,7 @@
public class SplitSelectStateController {
private static final String TAG = "SplitSelectStateCtor";
- private final Context mContext;
+ private Context mContext;
private final Handler mHandler;
private final RecentsModel mRecentTasksModel;
private final SplitAnimationController mSplitAnimationController;
@@ -157,6 +157,10 @@
mSplitSelectDataHolder = new SplitSelectDataHolder(mContext);
}
+ public void onDestroy() {
+ mContext = null;
+ }
+
/**
* @param alreadyRunningTask if set to {@link android.app.ActivityTaskManager#INVALID_TASK_ID}
* then @param intent will be used to launch the initial task
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 4b8741d..cb5b457 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -5296,6 +5296,8 @@
cleanupRemoteTargets();
if (mRecentsAnimationController == null) {
+ Log.d(TestProtocol.INCORRECT_HOME_STATE, "finish recents animation but recents "
+ + "animation controller was null. returning.");
if (onFinishComplete != null) {
onFinishComplete.run();
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 9d188ed..40d0ac7 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -18,6 +18,8 @@
import static com.android.launcher3.testing.shared.TestProtocol.FLAKY_QUICK_SWITCH_TO_PREVIOUS_APP;
import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName;
+import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
+import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;
import static org.junit.Assert.assertEquals;
@@ -50,6 +52,7 @@
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
+import com.android.launcher3.util.rule.TestStabilityRule;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import com.android.quickstep.views.RecentsView;
@@ -320,6 +323,7 @@
@Test
@ScreenRecord // b/242163205
@PlatinumTest(focusArea = "launcher")
+ @TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/286084688
public void testQuickSwitchToPreviousAppForTablet() throws Exception {
assumeTrue(mLauncher.isTablet());
startTestActivity(2);
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java b/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java
index dc7cb9d..1aa7ab6 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java
@@ -16,6 +16,9 @@
package com.android.quickstep;
+import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
+import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -27,6 +30,7 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.ui.TaplTestsLauncher3;
+import com.android.launcher3.util.rule.TestStabilityRule;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import org.junit.After;
@@ -71,6 +75,7 @@
@Test
@PortraitLandscape
@TaskbarModeSwitch
+ @TestStabilityRule.Stability(flavors = PLATFORM_POSTSUBMIT | LOCAL) // b/295225524
public void testSplitAppFromHomeWithItself() throws Exception {
// Currently only tablets have Taskbar in Overview, so test is only active on tablets
assumeTrue(mLauncher.isTablet());
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java
index 86695ca..4ff2f9c 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java
@@ -15,8 +15,6 @@
*/
package com.android.quickstep;
-import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
-import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static com.android.quickstep.TaplTestsTaskbar.TaskbarMode.PERSISTENT;
import static com.android.quickstep.TaplTestsTaskbar.TaskbarMode.TRANSIENT;
@@ -24,7 +22,6 @@
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
-import com.android.launcher3.util.rule.TestStabilityRule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -137,7 +134,6 @@
@Test
@ScreenRecord // b/231615831
@PortraitLandscape
- @TestStabilityRule.Stability(flavors = PLATFORM_POSTSUBMIT | LOCAL) // b/295225524
public void testLaunchAppInSplitscreen_fromTaskbarAllApps() {
getTaskbar().openAllApps()
.getAppIcon(TEST_APP_NAME)
diff --git a/res/drawable/all_apps_tabs_background.xml b/res/drawable/all_apps_tabs_background.xml
index 8471cd4..1e7cff2 100644
--- a/res/drawable/all_apps_tabs_background.xml
+++ b/res/drawable/all_apps_tabs_background.xml
@@ -30,7 +30,7 @@
android:state_selected="false">
<shape android:shape="rectangle">
<corners android:radius="@dimen/all_apps_header_pill_corner_radius" />
- <solid android:color="@color/all_apps_tabs_background" />
+ <solid android:color="@color/material_color_surface_bright" />
</shape>
</item>
@@ -39,7 +39,7 @@
android:state_selected="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/all_apps_header_pill_corner_radius" />
- <solid android:color="@color/all_apps_tab_background_selected" />
+ <solid android:color="@color/material_color_primary" />
</shape>
</item>
</selector>
diff --git a/res/drawable/bottom_rounded_popup_ripple.xml b/res/drawable/bottom_rounded_popup_ripple.xml
deleted file mode 100644
index 739833a..0000000
--- a/res/drawable/bottom_rounded_popup_ripple.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2023 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.
--->
-<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="?android:attr/colorControlHighlight">
- <item android:id="@android:id/mask">
- <shape android:shape="rectangle">
- <solid android:color="#FFFFFFFF"/>
- <corners android:bottomLeftRadius="@dimen/dialogCornerRadius"
- android:bottomRightRadius="@dimen/dialogCornerRadius"
- android:topLeftRadius="0dp"
- android:topRightRadius="0dp"/>
- </shape>
- </item>
-</ripple>
\ No newline at end of file
diff --git a/res/drawable/top_rounded_popup_ripple.xml b/res/drawable/rounded_popup_ripple.xml
similarity index 80%
rename from res/drawable/top_rounded_popup_ripple.xml
rename to res/drawable/rounded_popup_ripple.xml
index 7468480..b0dcc80 100644
--- a/res/drawable/top_rounded_popup_ripple.xml
+++ b/res/drawable/rounded_popup_ripple.xml
@@ -18,10 +18,7 @@
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#FFFFFFFF"/>
- <corners android:bottomLeftRadius="0dp"
- android:bottomRightRadius="0dp"
- android:topLeftRadius="@dimen/dialogCornerRadius"
- android:topRightRadius="@dimen/dialogCornerRadius"/>
+ <corners android:radius="@dimen/dialogCornerRadius" />
</shape>
</item>
</ripple>
\ No newline at end of file
diff --git a/res/layout/work_apps_paused.xml b/res/layout/work_apps_paused.xml
index 52c5a49..695270e 100644
--- a/res/layout/work_apps_paused.xml
+++ b/res/layout/work_apps_paused.xml
@@ -15,7 +15,7 @@
<com.android.launcher3.allapps.WorkPausedCard xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="@dimen/work_edu_card_margin"
+ android:padding="@dimen/all_apps_tabs_margin_top"
android:orientation="vertical"
android:gravity="center_horizontal">
@@ -25,7 +25,6 @@
android:id="@+id/work_apps_paused_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="40dp"
android:text="@string/work_apps_paused_title"
android:textAlignment="center"
android:textSize="18sp" />
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1695c58..4cb6414 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -32,7 +32,8 @@
<style name="LauncherTheme" parent="@style/BaseLauncherTheme">
<item name="android:textColorSecondary">#DE000000</item>
<item name="allAppsScrimColor">?attr/materialColorSurfaceDim</item>
- <item name="allappsHeaderProtectionColor">@color/popup_color_tertiary_light</item>
+ <item name="allappsHeaderProtectionColor">
+ @color/material_color_surface_container_highest</item>
<item name="allAppsNavBarScrimColor">#66FFFFFF</item>
<item name="popupColorPrimary">@color/popup_color_primary_light</item>
<item name="popupColorSecondary">@color/popup_color_secondary_light</item>
@@ -149,6 +150,7 @@
<item name="android:colorControlHighlight">#19FFFFFF</item>
<item name="android:colorPrimary">#FF212121</item>
<item name="allAppsScrimColor">?attr/materialColorSurfaceDim</item>
+ <item name="allappsHeaderProtectionColor">@color/material_color_surface_container_low</item>
<item name="allAppsNavBarScrimColor">#80000000</item>
<item name="popupColorPrimary">@color/popup_color_primary_dark</item>
<item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index 8876a1b..808cf70 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -17,12 +17,7 @@
package com.android.launcher3;
import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION;
-import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
-import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
-import android.app.WallpaperColors;
-import android.app.WallpaperManager;
-import android.app.WallpaperManager.OnColorsChangedListener;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Point;
@@ -32,6 +27,7 @@
import android.view.Display;
import android.view.View;
+import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -41,9 +37,11 @@
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
import com.android.launcher3.util.DisplayController.Info;
+import com.android.launcher3.util.OnColorHintListener;
import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.TraceHelper;
+import com.android.launcher3.util.WallpaperColorHints;
import com.android.launcher3.util.WindowBounds;
/**
@@ -51,7 +49,7 @@
*/
@SuppressWarnings("NewApi")
public abstract class BaseDraggingActivity extends BaseActivity
- implements OnColorsChangedListener, DisplayInfoChangeListener {
+ implements OnColorHintListener, DisplayInfoChangeListener {
private static final String TAG = "BaseDraggingActivity";
@@ -63,8 +61,7 @@
protected boolean mIsSafeModeEnabled;
private Runnable mOnStartCallback;
- private RunnableList mOnResumeCallbacks = new RunnableList();
-
+ private final RunnableList mOnResumeCallbacks = new RunnableList();
private int mThemeRes = R.style.AppTheme;
@Override
@@ -76,10 +73,7 @@
DisplayController.INSTANCE.get(this).addChangeListener(this);
// Update theme
- if (Utilities.ATLEAST_P) {
- THREAD_POOL_EXECUTOR.execute(() -> getSystemService(WallpaperManager.class)
- .addOnColorsChangedListener(this, MAIN_EXECUTOR.getHandler()));
- }
+ WallpaperColorHints.get(this).registerOnColorHintsChangedListener(this);
int themeRes = Themes.getActivityThemeRes(this);
if (themeRes != mThemeRes) {
mThemeRes = themeRes;
@@ -97,8 +91,9 @@
mOnResumeCallbacks.add(callback);
}
+ @MainThread
@Override
- public void onColorsChanged(WallpaperColors wallpaperColors, int which) {
+ public void onColorHintsChanged(int colorHints) {
updateTheme();
}
@@ -175,10 +170,8 @@
@Override
protected void onDestroy() {
super.onDestroy();
- if (Utilities.ATLEAST_P) {
- getSystemService(WallpaperManager.class).removeOnColorsChangedListener(this);
- }
DisplayController.INSTANCE.get(this).removeChangeListener(this);
+ WallpaperColorHints.get(this).unregisterOnColorsChangedListener(this);
}
public void runOnceOnStart(Runnable action) {
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 360e060..abf84dd 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -16,6 +16,7 @@
package com.android.launcher3;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES;
import static com.android.launcher3.config.FeatureFlags.ENABLE_DOWNLOAD_APP_UX_V2;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ICON_LABEL_AUTO_SCALING;
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
@@ -152,7 +153,7 @@
private final CheckLongPressHelper mLongPressHelper;
- private final boolean mLayoutHorizontal;
+ private boolean mLayoutHorizontal;
private final boolean mIsRtl;
private final int mIconSize;
@@ -197,6 +198,7 @@
public BubbleTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mActivity = ActivityContext.lookupContext(context);
+ FastBitmapDrawable.setFlagHoverEnabled(ENABLE_CURSOR_HOVER_STATES.get());
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.BubbleTextView, defStyle, 0);
@@ -666,6 +668,18 @@
}
/**
+ * Sets whether the layout is horizontal.
+ */
+ public void setLayoutHorizontal(boolean layoutHorizontal) {
+ if (mLayoutHorizontal == layoutHorizontal) {
+ return;
+ }
+
+ mLayoutHorizontal = layoutHorizontal;
+ applyCompoundDrawables(getIconOrTransparentColor());
+ }
+
+ /**
* Sets whether to vertically center the content.
*/
public void setCenterVertically(boolean centerVertically) {
@@ -991,10 +1005,14 @@
if (!mIsIconVisible) {
resetIconScale();
}
- Drawable icon = visible ? mIcon : new ColorDrawable(Color.TRANSPARENT);
+ Drawable icon = getIconOrTransparentColor();
applyCompoundDrawables(icon);
}
+ private Drawable getIconOrTransparentColor() {
+ return mIsIconVisible ? mIcon : new ColorDrawable(Color.TRANSPARENT);
+ }
+
/** Sets the icon visual state to disabled or not. */
public void setIconDisabled(boolean isDisabled) {
if (mIcon != null) {
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 4674401..08e5def 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -245,6 +245,7 @@
// the user where a dragged item will land when dropped.
setWillNotDraw(false);
setClipToPadding(false);
+ setClipChildren(false);
mActivity = ActivityContext.lookupContext(context);
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 7ece9a4..a48c928 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -1134,10 +1134,11 @@
* This method calculates the space between the icons to achieve a certain width.
*/
private int calculateHotseatBorderSpace(float hotseatWidthPx, int numExtraBorder) {
+ int numBorders = (numShownHotseatIcons - 1 + numExtraBorder);
+ if (numBorders <= 0) return 0;
+
float hotseatIconsTotalPx = iconSizePx * numShownHotseatIcons;
- int hotseatBorderSpacePx =
- (int) (hotseatWidthPx - hotseatIconsTotalPx)
- / (numShownHotseatIcons - 1 + numExtraBorder);
+ int hotseatBorderSpacePx = (int) (hotseatWidthPx - hotseatIconsTotalPx) / numBorders;
return Math.min(hotseatBorderSpacePx, mMaxHotseatIconSpacePx);
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 4e7a884..ffb8b82 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -198,6 +198,7 @@
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.ActivityResultInfo;
import com.android.launcher3.util.ActivityTracker;
+import com.android.launcher3.util.CannedAnimationCoordinator;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
@@ -421,6 +422,9 @@
private StartupLatencyLogger mStartupLatencyLogger;
private CellPosMapper mCellPosMapper = CellPosMapper.DEFAULT;
+ private final CannedAnimationCoordinator mAnimationCoordinator =
+ new CannedAnimationCoordinator(this);
+
@Override
@TargetApi(Build.VERSION_CODES.S)
protected void onCreate(Bundle savedInstanceState) {
@@ -2343,13 +2347,37 @@
mWorkspace.unlockWallpaperFromDefaultPageOnNextLayout();
}
+ /**
+ * Remove odd number because they are already included when isTwoPanels and add the pair screen
+ * if not present.
+ */
+ private IntArray filterTwoPanelScreenIds(IntArray orderedScreenIds) {
+ IntSet screenIds = IntSet.wrap(orderedScreenIds);
+ orderedScreenIds.forEach(screenId -> {
+ if (screenId % 2 == 1) {
+ screenIds.remove(screenId);
+ // In case the pair is not added, add it
+ if (!mWorkspace.containsScreenId(screenId - 1)) {
+ screenIds.add(screenId - 1);
+ }
+ }
+ });
+ return screenIds.getArray();
+ }
+
private void bindAddScreens(IntArray orderedScreenIds) {
+
if (mDeviceProfile.isTwoPanels) {
- // Some empty pages might have been removed while the phone was in a single panel
- // mode, so we want to add those empty pages back.
- IntSet screenIds = IntSet.wrap(orderedScreenIds);
- orderedScreenIds.forEach(screenId -> screenIds.add(mWorkspace.getScreenPair(screenId)));
- orderedScreenIds = screenIds.getArray();
+ if (FOLDABLE_SINGLE_PAGE.get()) {
+ orderedScreenIds = filterTwoPanelScreenIds(orderedScreenIds);
+ } else {
+ // Some empty pages might have been removed while the phone was in a single panel
+ // mode, so we want to add those empty pages back.
+ IntSet screenIds = IntSet.wrap(orderedScreenIds);
+ orderedScreenIds.forEach(
+ screenId -> screenIds.add(mWorkspace.getScreenPair(screenId)));
+ orderedScreenIds = screenIds.getArray();
+ }
}
int count = orderedScreenIds.size();
@@ -3398,4 +3426,11 @@
public void launchAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) {
// Overridden
}
+
+ /**
+ * Returns the animation coordinator for playing one-off animations
+ */
+ public CannedAnimationCoordinator getAnimationCoordinator() {
+ return mAnimationCoordinator;
+ }
}
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 07b71b3..f0fea61 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -66,6 +66,7 @@
mActivity = ActivityContext.lookupContext(context);
mWallpaperManager = WallpaperManager.getInstance(context);
mContainerType = containerType;
+ setClipChildren(false);
}
public void setCellDimensions(int cellWidth, int cellHeight, int countX, int countY,
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index adaf20f..8be8fed 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -731,6 +731,14 @@
});
}
+
+ /**
+ * Returns if the given screenId is already in the Workspace
+ */
+ public boolean containsScreenId(int screenId) {
+ return this.mWorkspaceScreens.containsKey(screenId);
+ }
+
/**
* Inserts extra empty pages to the end of the existing workspaces.
* Usually we add one extra empty screen, but when two panel home is enabled we add
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 8da0e9e..9bc2a0a 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -238,7 +238,7 @@
"COLLECT_SEARCH_HISTORY", DISABLED, "Allow launcher to collect search history for log");
public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(270390937,
- "ENABLE_TWOLINE_ALLAPPS", ENABLED, "Enables two line label inside all apps.");
+ "ENABLE_TWOLINE_ALLAPPS", DISABLED, "Enables two line label inside all apps.");
public static final BooleanFlag IME_STICKY_SNACKBAR_EDU = getDebugFlag(270391693,
"IME_STICKY_SNACKBAR_EDU", ENABLED, "Show sticky IME edu in AllApps");
@@ -297,11 +297,6 @@
"ENABLE_APP_ICON_IN_INLINE_SHORTCUTS", DISABLED, "Show app icon for inline shortcut");
// TODO(Block 22): Clean up flags
- public static final BooleanFlag RECEIVE_UNFOLD_EVENTS_FROM_SYSUI = getDebugFlag(270397209,
- "RECEIVE_UNFOLD_EVENTS_FROM_SYSUI", ENABLED,
- "Enables receiving unfold animation events from sysui instead of calculating "
- + "them in launcher process using hinge sensor values.");
-
public static final BooleanFlag ENABLE_WIDGET_TRANSITION_FOR_RESIZING = getDebugFlag(268553314,
"ENABLE_WIDGET_TRANSITION_FOR_RESIZING", DISABLED,
"Enable widget transition animation when resizing the widgets");
@@ -414,12 +409,12 @@
// TODO(Block 33): Clean up flags
public static final BooleanFlag ENABLE_ALL_APPS_RV_PREINFLATION = getDebugFlag(288161355,
- "ENABLE_ALL_APPS_RV_PREINFLATION", DISABLED,
+ "ENABLE_ALL_APPS_RV_PREINFLATION", ENABLED,
"Enables preinflating all apps icons to avoid scrolling jank.");
// TODO(Block 34): Clean up flags
public static final BooleanFlag ALL_APPS_GONE_VISIBILITY = getDebugFlag(291651514,
- "ALL_APPS_GONE_VISIBILITY", DISABLED,
+ "ALL_APPS_GONE_VISIBILITY", ENABLED,
"Set all apps container view's hidden visibility to GONE instead of INVISIBLE.");
// TODO(Block 35): Empty block
diff --git a/src/com/android/launcher3/graphics/DragPreviewProvider.java b/src/com/android/launcher3/graphics/DragPreviewProvider.java
index 7457f30..b51373c 100644
--- a/src/com/android/launcher3/graphics/DragPreviewProvider.java
+++ b/src/com/android/launcher3/graphics/DragPreviewProvider.java
@@ -21,10 +21,12 @@
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.InsetDrawable;
import android.view.View;
import androidx.annotation.Nullable;
+import com.android.launcher3.BubbleTextView;
import com.android.launcher3.R;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.icons.BitmapRenderer;
@@ -37,7 +39,6 @@
* A utility class to generate preview bitmap for dragging.
*/
public class DragPreviewProvider {
-
private final Rect mTempRect = new Rect();
protected final View mView;
@@ -99,6 +100,14 @@
height = mView.getHeight();
}
+ if (mView instanceof BubbleTextView) {
+ FastBitmapDrawable icon = ((BubbleTextView) mView).getIcon();
+ Drawable drawable = icon.getConstantState().newDrawable();
+ float xInset = (float) blurSizeOutline / (float) (width + blurSizeOutline);
+ float yInset = (float) blurSizeOutline / (float) (height + blurSizeOutline);
+ return new InsetDrawable(drawable, xInset / 2, yInset / 2, xInset / 2, yInset / 2);
+ }
+
return new FastBitmapDrawable(
BitmapRenderer.createHardwareBitmap(width + blurSizeOutline,
height + blurSizeOutline, (c) -> drawDragView(c, scale)));
diff --git a/src/com/android/launcher3/util/CannedAnimationCoordinator.kt b/src/com/android/launcher3/util/CannedAnimationCoordinator.kt
new file mode 100644
index 0000000..18f8339
--- /dev/null
+++ b/src/com/android/launcher3/util/CannedAnimationCoordinator.kt
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2023 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.launcher3.util
+
+import android.animation.AnimatorSet
+import android.animation.ValueAnimator
+import android.util.Log
+import android.view.ViewTreeObserver.OnGlobalLayoutListener
+import androidx.core.view.OneShotPreDrawListener
+import com.android.app.animation.Interpolators.LINEAR
+import com.android.launcher3.anim.AnimatorListeners
+import com.android.launcher3.anim.AnimatorPlaybackController
+import com.android.launcher3.anim.PendingAnimation
+import com.android.launcher3.statemanager.StatefulActivity
+import java.util.function.Consumer
+
+private const val TAG = "CannedAnimCoordinator"
+
+/**
+ * Utility class to run a canned animation on Launcher.
+ *
+ * This class takes care to registering animations with stateManager and ensures that only one
+ * animation is playing at a time.
+ */
+class CannedAnimationCoordinator(private val activity: StatefulActivity<*>) {
+
+ private val launcherLayoutListener = OnGlobalLayoutListener { scheduleRecreateAnimOnPreDraw() }
+ private var recreatePending = false
+
+ private var animationProvider: Any? = null
+
+ private var animationDuration: Long = 0L
+ private var animationFactory: Consumer<PendingAnimation>? = null
+ private var animationController: AnimatorPlaybackController? = null
+
+ private var currentAnim: AnimatorPlaybackController? = null
+
+ /**
+ * Sets the current animation cancelling any previously set animation.
+ *
+ * Callers can control the animation using {@link #getPlaybackController}. The state is
+ * automatically cleared when the playback controller ends. The animation is automatically
+ * recreated when any layout change happens. Callers can also ask for recreation by calling
+ * {@link #recreateAnimation}
+ */
+ fun setAnimation(provider: Any, factory: Consumer<PendingAnimation>, duration: Long) {
+ if (provider != animationProvider) {
+ Log.e(TAG, "Trying to play two animations together, $provider and $animationProvider")
+ }
+
+ // Cancel any previously running animation
+ endCurrentAnimation(false)
+ animationController?.dispatchOnCancel()?.dispatchOnEnd()
+
+ animationProvider = provider
+ animationFactory = factory
+ animationDuration = duration
+
+ // Setup a new controller and link it with launcher state animation
+ val anim = AnimatorSet()
+ anim.play(
+ ValueAnimator.ofFloat(0f, 1f).apply {
+ interpolator = LINEAR
+ this.duration = duration
+ addUpdateListener { anim -> currentAnim?.setPlayFraction(anim.animatedFraction) }
+ }
+ )
+ val controller = AnimatorPlaybackController.wrap(anim, duration)
+ anim.addListener(
+ AnimatorListeners.forEndCallback { success ->
+ if (animationController != controller) {
+ return@forEndCallback
+ }
+
+ endCurrentAnimation(success)
+ animationController = null
+ animationFactory = null
+ animationProvider = null
+
+ activity.rootView.viewTreeObserver.apply {
+ if (isAlive) {
+ removeOnGlobalLayoutListener(launcherLayoutListener)
+ }
+ }
+ }
+ )
+
+ // Recreate animation whenever layout happens in case transforms change during layout
+ activity.rootView.viewTreeObserver.apply {
+ if (isAlive) {
+ addOnGlobalLayoutListener(launcherLayoutListener)
+ }
+ }
+ // Link this to the state manager so that it auto-cancels when state changes
+ recreatePending = false
+ animationController =
+ controller.apply { activity.stateManager.setCurrentUserControlledAnimation(this) }
+ recreateAnimation(provider)
+ }
+
+ private fun endCurrentAnimation(success: Boolean) {
+ currentAnim?.apply {
+ // When cancelling an animation, apply final progress so that all transformations
+ // are restored
+ setPlayFraction(1f)
+ if (!success) dispatchOnCancel()
+ dispatchOnEnd()
+ }
+ currentAnim = null
+ }
+
+ /** Returns the current animation controller to control the animation */
+ fun getPlaybackController(provider: Any): AnimatorPlaybackController? {
+ return if (provider == animationProvider) animationController
+ else {
+ Log.d(TAG, "Wrong controller access from $provider, actual provider $animationProvider")
+ null
+ }
+ }
+
+ private fun scheduleRecreateAnimOnPreDraw() {
+ if (!recreatePending) {
+ recreatePending = true
+ OneShotPreDrawListener.add(activity.rootView) {
+ if (recreatePending) {
+ recreatePending = false
+ animationProvider?.apply { recreateAnimation(this) }
+ }
+ }
+ }
+ }
+
+ /** Notify the controller to recreate the animation. The animation progress is preserved */
+ fun recreateAnimation(provider: Any) {
+ if (provider != animationProvider) {
+ Log.e(TAG, "Ignore recreate request from $provider, actual provider $animationProvider")
+ return
+ }
+ endCurrentAnimation(false /* success */)
+
+ if (animationFactory == null || animationController == null) {
+ return
+ }
+ currentAnim =
+ PendingAnimation(animationDuration)
+ .apply { animationFactory?.accept(this) }
+ .createPlaybackController()
+ .apply { setPlayFraction(animationController!!.progressFraction) }
+ }
+}
diff --git a/src/com/android/launcher3/util/MultiScalePropertyFactory.java b/src/com/android/launcher3/util/MultiScalePropertyFactory.java
index a7e6cc8..cf8d6cc 100644
--- a/src/com/android/launcher3/util/MultiScalePropertyFactory.java
+++ b/src/com/android/launcher3/util/MultiScalePropertyFactory.java
@@ -40,8 +40,7 @@
private static final boolean DEBUG = false;
private static final String TAG = "MultiScaleProperty";
private final String mName;
- private final ArrayMap<Integer, MultiScaleProperty> mProperties =
- new ArrayMap<Integer, MultiScaleProperty>();
+ private final ArrayMap<Integer, MultiScaleProperty> mProperties = new ArrayMap<>();
// This is an optimization for cases when set is called repeatedly with the same setterIndex.
private float mMinOfOthers = 0;
@@ -55,7 +54,7 @@
}
/** Returns the [MultiFloatProperty] associated with [inx], creating it if not present. */
- public MultiScaleProperty get(Integer index) {
+ public FloatProperty<T> get(Integer index) {
return mProperties.computeIfAbsent(index,
(k) -> new MultiScaleProperty(index, mName + "_" + index));
}
diff --git a/src/com/android/launcher3/util/Themes.java b/src/com/android/launcher3/util/Themes.java
index a5c663f..60951ba 100644
--- a/src/com/android/launcher3/util/Themes.java
+++ b/src/com/android/launcher3/util/Themes.java
@@ -21,8 +21,6 @@
import static com.android.launcher3.LauncherPrefs.THEMED_ICONS;
-import android.app.WallpaperColors;
-import android.app.WallpaperManager;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
@@ -48,16 +46,9 @@
public static final String KEY_THEMED_ICONS = "themed_icons";
+ /** Gets the WallpaperColorHints and then uses those to get the correct activity theme res. */
public static int getActivityThemeRes(Context context) {
- final int colorHints;
- if (Utilities.ATLEAST_P) {
- WallpaperColors colors = context.getSystemService(WallpaperManager.class)
- .getWallpaperColors(WallpaperManager.FLAG_SYSTEM);
- colorHints = colors == null ? 0 : colors.getColorHints();
- } else {
- colorHints = 0;
- }
- return getActivityThemeRes(context, colorHints);
+ return getActivityThemeRes(context, WallpaperColorHints.get(context).getHints());
}
public static int getActivityThemeRes(Context context, int wallpaperColorHints) {
diff --git a/src/com/android/launcher3/util/WallpaperColorHints.kt b/src/com/android/launcher3/util/WallpaperColorHints.kt
new file mode 100644
index 0000000..1361c1e
--- /dev/null
+++ b/src/com/android/launcher3/util/WallpaperColorHints.kt
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2023 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.launcher3.util
+
+import android.app.WallpaperColors
+import android.app.WallpaperManager
+import android.app.WallpaperManager.FLAG_SYSTEM
+import android.app.WallpaperManager.OnColorsChangedListener
+import android.content.Context
+import androidx.annotation.MainThread
+import androidx.annotation.VisibleForTesting
+import com.android.launcher3.Utilities
+import com.android.launcher3.util.Executors.MAIN_EXECUTOR
+import com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR
+
+/**
+ * This class caches the system's wallpaper color hints for use by other classes as a performance
+ * enhancer. It also centralizes all the WallpaperManager color hint code in one location.
+ */
+class WallpaperColorHints(private val context: Context) : SafeCloseable {
+ var hints: Int = 0
+ private set
+ private val wallpaperManager
+ get() = context.getSystemService(WallpaperManager::class.java)!!
+ private val onColorHintsChangedListeners = mutableListOf<OnColorHintListener>()
+ private val onClose: SafeCloseable
+
+ init {
+ if (Utilities.ATLEAST_S) {
+ hints = wallpaperManager.getWallpaperColors(FLAG_SYSTEM)?.colorHints ?: 0
+ val onColorsChangedListener = OnColorsChangedListener { colors, which ->
+ onColorsChanged(colors, which)
+ }
+ UI_HELPER_EXECUTOR.execute {
+ wallpaperManager.addOnColorsChangedListener(
+ onColorsChangedListener,
+ MAIN_EXECUTOR.handler
+ )
+ }
+ onClose = SafeCloseable {
+ UI_HELPER_EXECUTOR.execute {
+ wallpaperManager.removeOnColorsChangedListener(onColorsChangedListener)
+ }
+ }
+ } else {
+ onClose = SafeCloseable {}
+ }
+ }
+
+ @MainThread
+ private fun onColorsChanged(colors: WallpaperColors?, which: Int) {
+ if ((which and FLAG_SYSTEM) != 0 && Utilities.ATLEAST_S) {
+ val newHints = colors?.colorHints ?: 0
+ if (newHints != hints) {
+ hints = newHints
+ onColorHintsChangedListeners.forEach { it.onColorHintsChanged(newHints) }
+ }
+ }
+ }
+
+ override fun close() = onClose.close()
+
+ fun registerOnColorHintsChangedListener(listener: OnColorHintListener) {
+ onColorHintsChangedListeners.add(listener)
+ }
+
+ fun unregisterOnColorsChangedListener(listener: OnColorHintListener) {
+ onColorHintsChangedListeners.remove(listener)
+ }
+
+ companion object {
+ @VisibleForTesting
+ @JvmField
+ val INSTANCE = MainThreadInitializedObject { WallpaperColorHints(it) }
+ @JvmStatic fun get(context: Context): WallpaperColorHints = INSTANCE.get(context)
+ }
+}
+
+interface OnColorHintListener {
+ fun onColorHintsChanged(colorHints: Int)
+}
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 438d4a0..abca1f8 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -888,18 +888,6 @@
return mContent;
}
- /** Gets the search bar, which is used for testing */ // b/294050472
- @VisibleForTesting
- public View getSearchBar() {
- return (View) mSearchBar;
- }
-
- /** Gets the search bar container, which is used for testing */ // b/294050472
- @VisibleForTesting
- public View getSearchBarContainer() {
- return (View) mSearchBarContainer;
- }
-
/** Opens the first header in widget picker and scrolls to the top of the RecyclerView. */
@VisibleForTesting
public void openFirstHeader() {
diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index bbe4c20..87ec260 100644
--- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -161,7 +161,7 @@
public static final String LAUNCH_SPLIT_PAIR = "b/288939273";
public static final String OVERVIEW_OVER_HOME = "b/279059025";
-
+ public static final String INCORRECT_HOME_STATE = "b/293191790";
public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
public static final String REQUEST_IS_EMULATE_DISPLAY_RUNNING = "is-emulate-display-running";
diff --git a/tests/src/com/android/launcher3/celllayout/CellLayoutTestCaseReader.java b/tests/src/com/android/launcher3/celllayout/CellLayoutTestCaseReader.java
index e33a304..419cb3d 100644
--- a/tests/src/com/android/launcher3/celllayout/CellLayoutTestCaseReader.java
+++ b/tests/src/com/android/launcher3/celllayout/CellLayoutTestCaseReader.java
@@ -63,8 +63,8 @@
}
public static class Board extends TestSection {
- Point gridSize;
- String board;
+ public Point gridSize;
+ public String board;
public Board(Point gridSize, String board) {
super(State.BOARD);
@@ -127,7 +127,7 @@
}
}
- List<TestSection> parse() {
+ public List<TestSection> parse() {
List<TestSection> sections = new ArrayList<>();
String[] lines = mTest.split("\n");
Iterator<String> it = Arrays.stream(lines).iterator();
diff --git a/tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java b/tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java
index b6c55af..86a7bd3 100644
--- a/tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java
+++ b/tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java
@@ -42,7 +42,7 @@
params.getCellX(), params.getCellY(),
launcher.getWorkspace().getIdForScreen(cellLayout), CONTAINER_DESKTOP);
int screenId = pos.screenId;
- if (screenId > boards.size() - 1) {
+ for (int j = boards.size(); j <= screenId; j++) {
boards.add(new CellLayoutBoard(cellLayout.getCountX(), cellLayout.getCountY()));
}
CellLayoutBoard board = boards.get(screenId);
diff --git a/tests/src/com/android/launcher3/icons/FastBitmapDrawableTest.java b/tests/src/com/android/launcher3/icons/FastBitmapDrawableTest.java
new file mode 100644
index 0000000..038c98b
--- /dev/null
+++ b/tests/src/com/android/launcher3/icons/FastBitmapDrawableTest.java
@@ -0,0 +1,329 @@
+/*
+ * Copyright (C) 2023 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.launcher3.icons;
+
+import static com.android.launcher3.icons.FastBitmapDrawable.CLICK_FEEDBACK_DURATION;
+import static com.android.launcher3.icons.FastBitmapDrawable.HOVERED_SCALE;
+import static com.android.launcher3.icons.FastBitmapDrawable.HOVER_FEEDBACK_DURATION;
+import static com.android.launcher3.icons.FastBitmapDrawable.PRESSED_SCALE;
+import static com.android.launcher3.icons.FastBitmapDrawable.SCALE;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.clearInvocations;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.graphics.Bitmap;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.PathInterpolator;
+
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+
+/**
+ * Tests for FastBitmapDrawable.
+ */
+@SmallTest
+@UiThreadTest
+@RunWith(AndroidJUnit4.class)
+public class FastBitmapDrawableTest {
+ private static final float EPSILON = 0.00001f;
+
+ @Spy
+ FastBitmapDrawable mFastBitmapDrawable =
+ spy(new FastBitmapDrawable(Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888)));
+
+ @Before
+ public void setUp() {
+ FastBitmapDrawable.setFlagHoverEnabled(true);
+ when(mFastBitmapDrawable.isVisible()).thenReturn(true);
+ mFastBitmapDrawable.mIsPressed = false;
+ mFastBitmapDrawable.mIsHovered = false;
+ mFastBitmapDrawable.resetScale();
+ }
+
+ @Test
+ public void testOnStateChange_noState() {
+ int[] state = new int[]{};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No scale changes without state change.
+ assertFalse("State change handled.", isHandled);
+ assertNull("Scale animation not null.", mFastBitmapDrawable.mScaleAnimation);
+ }
+
+ @Test
+ public void testOnStateChange_statePressed() {
+ int[] state = new int[]{android.R.attr.state_pressed};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to state pressed.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.", mFastBitmapDrawable.mScaleAnimation.getDuration(),
+ CLICK_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), PRESSED_SCALE, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator()
+ instanceof AccelerateInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_stateHovered() {
+ int[] state = new int[]{android.R.attr.state_hovered};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to state hovered.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.", mFastBitmapDrawable.mScaleAnimation.getDuration(),
+ HOVER_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), HOVERED_SCALE, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator() instanceof PathInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_stateHoveredFlagDisabled() {
+ FastBitmapDrawable.setFlagHoverEnabled(false);
+ int[] state = new int[]{android.R.attr.state_hovered};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No state change with flag disabled.
+ assertFalse("Hover state change handled with flag disabled.", isHandled);
+ assertNull("Animation should not run with hover flag disabled.",
+ mFastBitmapDrawable.mScaleAnimation);
+ }
+
+ @Test
+ public void testOnStateChange_statePressedAndHovered() {
+ int[] state = new int[]{android.R.attr.state_pressed, android.R.attr.state_hovered};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to pressed state only.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.", mFastBitmapDrawable.mScaleAnimation.getDuration(),
+ CLICK_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), PRESSED_SCALE, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator()
+ instanceof AccelerateInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_stateHoveredAndPressed() {
+ int[] state = new int[]{android.R.attr.state_hovered, android.R.attr.state_pressed};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to pressed state only.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.", mFastBitmapDrawable.mScaleAnimation.getDuration(),
+ CLICK_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), PRESSED_SCALE, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator()
+ instanceof AccelerateInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_stateHoveredAndPressedToPressed() {
+ mFastBitmapDrawable.mIsPressed = true;
+ mFastBitmapDrawable.mIsHovered = true;
+ SCALE.setValue(mFastBitmapDrawable, PRESSED_SCALE);
+ int[] state = new int[]{android.R.attr.state_pressed};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No scale change from pressed state to pressed state.
+ assertTrue("State not changed.", isHandled);
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), PRESSED_SCALE, EPSILON);
+ }
+
+ @Test
+ public void testOnStateChange_stateHoveredAndPressedToHovered() {
+ mFastBitmapDrawable.mIsPressed = true;
+ mFastBitmapDrawable.mIsHovered = true;
+ SCALE.setValue(mFastBitmapDrawable, PRESSED_SCALE);
+ int[] state = new int[]{android.R.attr.state_hovered};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No scale change from pressed state to hovered state.
+ assertTrue("State not changed.", isHandled);
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), HOVERED_SCALE, EPSILON);
+ }
+
+ @Test
+ public void testOnStateChange_stateHoveredToPressed() {
+ mFastBitmapDrawable.mIsHovered = true;
+ SCALE.setValue(mFastBitmapDrawable, HOVERED_SCALE);
+ int[] state = new int[]{android.R.attr.state_pressed};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No scale change from pressed state to hovered state.
+ assertTrue("State not changed.", isHandled);
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), PRESSED_SCALE, EPSILON);
+ }
+
+ @Test
+ public void testOnStateChange_statePressedToHovered() {
+ mFastBitmapDrawable.mIsPressed = true;
+ SCALE.setValue(mFastBitmapDrawable, PRESSED_SCALE);
+ int[] state = new int[]{android.R.attr.state_hovered};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No scale change from pressed state to hovered state.
+ assertTrue("State not changed.", isHandled);
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), HOVERED_SCALE, EPSILON);
+ }
+
+ @Test
+ public void testOnStateChange_stateDefaultFromPressed() {
+ mFastBitmapDrawable.mIsPressed = true;
+ SCALE.setValue(mFastBitmapDrawable, PRESSED_SCALE);
+ int[] state = new int[]{};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to default state from pressed state.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.", mFastBitmapDrawable.mScaleAnimation.getDuration(),
+ CLICK_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.", (float) SCALE.get(mFastBitmapDrawable), 1f, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator()
+ instanceof DecelerateInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_stateDefaultFromHovered() {
+ mFastBitmapDrawable.mIsHovered = true;
+ SCALE.setValue(mFastBitmapDrawable, HOVERED_SCALE);
+ int[] state = new int[]{};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to default state from hovered state.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.", mFastBitmapDrawable.mScaleAnimation.getDuration(),
+ HOVER_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.", (float) SCALE.get(mFastBitmapDrawable), 1f, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator() instanceof PathInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_stateHoveredWhilePartiallyScaled() {
+ SCALE.setValue(mFastBitmapDrawable, 0.5f);
+ int[] state = new int[]{android.R.attr.state_hovered};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to hovered state from midway to pressed state.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.",
+ mFastBitmapDrawable.mScaleAnimation.getDuration(), HOVER_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), HOVERED_SCALE, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator() instanceof PathInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_statePressedWhilePartiallyScaled() {
+ SCALE.setValue(mFastBitmapDrawable, 0.5f);
+ int[] state = new int[]{android.R.attr.state_pressed};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // Animate to pressed state from midway to hovered state.
+ assertTrue("State change not handled.", isHandled);
+ assertEquals("Duration not correct.",
+ mFastBitmapDrawable.mScaleAnimation.getDuration(), CLICK_FEEDBACK_DURATION);
+ mFastBitmapDrawable.mScaleAnimation.end();
+ assertEquals("End value not correct.",
+ (float) SCALE.get(mFastBitmapDrawable), PRESSED_SCALE, EPSILON);
+ assertTrue("Wrong interpolator used.",
+ mFastBitmapDrawable.mScaleAnimation.getInterpolator()
+ instanceof AccelerateInterpolator);
+ }
+
+ @Test
+ public void testOnStateChange_stateDefaultFromPressedNotVisible() {
+ when(mFastBitmapDrawable.isVisible()).thenReturn(false);
+ mFastBitmapDrawable.mIsPressed = true;
+ SCALE.setValue(mFastBitmapDrawable, PRESSED_SCALE);
+ clearInvocations(mFastBitmapDrawable);
+ int[] state = new int[]{};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No animations when state was pressed but drawable no longer visible. Set values directly.
+ assertTrue("State change not handled.", isHandled);
+ assertNull("Scale animation not null.", mFastBitmapDrawable.mScaleAnimation);
+ assertEquals("End value not correct.", (float) SCALE.get(mFastBitmapDrawable), 1f, EPSILON);
+ verify(mFastBitmapDrawable).invalidateSelf();
+ }
+
+ @Test
+ public void testOnStateChange_stateDefaultFromHoveredNotVisible() {
+ when(mFastBitmapDrawable.isVisible()).thenReturn(false);
+ mFastBitmapDrawable.mIsHovered = true;
+ SCALE.setValue(mFastBitmapDrawable, HOVERED_SCALE);
+ clearInvocations(mFastBitmapDrawable);
+ int[] state = new int[]{};
+
+ boolean isHandled = mFastBitmapDrawable.onStateChange(state);
+
+ // No animations when state was hovered but drawable no longer visible. Set values directly.
+ assertTrue("State change not handled.", isHandled);
+ assertNull("Scale animation not null.", mFastBitmapDrawable.mScaleAnimation);
+ assertEquals("End value not correct.", (float) SCALE.get(mFastBitmapDrawable), 1f, EPSILON);
+ verify(mFastBitmapDrawable).invalidateSelf();
+ }
+}
diff --git a/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt b/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt
index 2a27487..d102397 100644
--- a/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt
+++ b/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt
@@ -158,4 +158,25 @@
assertThat(dp.isQsbInline).isFalse()
assertThat(dp.hotseatQsbWidth).isEqualTo(1095)
}
+
+ @Test
+ fun border_space_should_be_zero_when_numHotseatIcons_is_smallerOrEqual_1() {
+ initializeVarsForTablet(isGestureMode = false)
+ windowBounds = WindowBounds(Rect(0, 0, 1800, 2560), Rect(0, 104, 0, 0))
+
+ val numShownHotseatIcons = listOf(-1, 0, 1)
+ for (numHotseatIcons in numShownHotseatIcons) {
+ inv?.numShownHotseatIcons = numHotseatIcons
+
+ val dp = newDP()
+ dp.isTaskbarPresentInApps = true
+
+ assertThat(dp.numShownHotseatIcons).isEqualTo(numHotseatIcons)
+ assertThat(dp.hotseatBorderSpace).isEqualTo(0)
+
+ assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(177)
+ assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(177)
+ assertThat(dp.hotseatQsbWidth).isEqualTo(1445)
+ }
+ }
}
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index a0dbb7a..e12cf2d 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -19,6 +19,8 @@
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING;
+import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
+import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static com.google.common.truth.Truth.assertThat;
@@ -61,6 +63,7 @@
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.launcher3.util.rule.TISBindRule;
+import com.android.launcher3.util.rule.TestStabilityRule.Stability;
import com.android.launcher3.widget.picker.WidgetsFullSheet;
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
@@ -329,7 +332,8 @@
}
@Test
- @Ignore // b/293191790
+ @Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/293191790
+ @ScreenRecord
@PortraitLandscape
public void testWidgets() throws Exception {
// Test opening widgets.
@@ -553,6 +557,7 @@
@Test
@PortraitLandscape
@PlatinumTest(focusArea = "launcher")
+ @ScreenRecord // TODO(b/293944634): Remove after flaky debug
public void testUninstallFromWorkspace() throws Exception {
installDummyAppAndWaitForUIUpdate();
try {
diff --git a/tests/src/com/android/launcher3/util/LauncherModelHelper.java b/tests/src/com/android/launcher3/util/LauncherModelHelper.java
index 4580082..261436b 100644
--- a/tests/src/com/android/launcher3/util/LauncherModelHelper.java
+++ b/tests/src/com/android/launcher3/util/LauncherModelHelper.java
@@ -227,7 +227,8 @@
UserCache.INSTANCE, InstallSessionHelper.INSTANCE, LauncherPrefs.INSTANCE,
LauncherAppState.INSTANCE, InvariantDeviceProfile.INSTANCE,
DisplayController.INSTANCE, CustomWidgetManager.INSTANCE,
- SettingsCache.INSTANCE, PluginManagerWrapper.INSTANCE, LockedUserState.INSTANCE,
+ SettingsCache.INSTANCE, PluginManagerWrapper.INSTANCE,
+ LockedUserState.INSTANCE, WallpaperColorHints.INSTANCE,
ItemInstallQueue.INSTANCE, WindowManagerProxy.INSTANCE);
// System settings cache content provider. Ensure that they are statically initialized
diff --git a/tests/src/com/android/launcher3/util/TestUtil.java b/tests/src/com/android/launcher3/util/TestUtil.java
index 4cd6c53..21059e6 100644
--- a/tests/src/com/android/launcher3/util/TestUtil.java
+++ b/tests/src/com/android/launcher3/util/TestUtil.java
@@ -67,6 +67,7 @@
private static final String TAG = "TestUtil";
public static final String DUMMY_PACKAGE = "com.example.android.aardwolf";
+ public static final String DUMMY_CLASS_NAME = "com.example.android.aardwolf.Activity1";
public static final long DEFAULT_UI_TIMEOUT = 10000;
public static void installDummyApp() throws IOException {
diff --git a/tests/src/com/android/launcher3/util/viewcapture_analysis/FlashDetector.java b/tests/src/com/android/launcher3/util/viewcapture_analysis/FlashDetector.java
index eef1bc8..388a59a 100644
--- a/tests/src/com/android/launcher3/util/viewcapture_analysis/FlashDetector.java
+++ b/tests/src/com/android/launcher3/util/viewcapture_analysis/FlashDetector.java
@@ -38,9 +38,6 @@
private static final IgnoreNode IGNORED_NODES_ROOT = buildIgnoreNodesTree(List.of(
CONTENT + "LauncherRootView:id/launcher|FloatingIconView",
- DRAG_LAYER
- + "SearchContainerView:id/apps_view|AllAppsRecyclerView:id/apps_list_view"
- + "|BubbleTextView:id/icon",
DRAG_LAYER + "LauncherRecentsView:id/overview_panel|TaskView|TextView",
DRAG_LAYER
+ "LauncherAllAppsContainerView:id/apps_view|AllAppsRecyclerView:id"
@@ -58,7 +55,11 @@
+ "|WidgetCellPreview:id/widget_preview_container|ImageView:id/widget_badge",
RECENTS_DRAG_LAYER + "FallbackRecentsView:id/overview_panel|TaskView|IconView:id/icon",
DRAG_LAYER + "SearchContainerView:id/apps_view",
- DRAG_LAYER + "LauncherDragView"
+ DRAG_LAYER + "LauncherDragView",
+ DRAG_LAYER + "FloatingTaskView|FloatingTaskThumbnailView:id/thumbnail",
+ DRAG_LAYER
+ + "WidgetsFullSheet|SpringRelativeLayout:id/container|WidgetsRecyclerView:id"
+ + "/primary_widgets_list_view|WidgetsListHeader:id/widgets_list_header"
));
// Per-AnalysisNode data that's specific to this detector.
diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
index 9b4d273..9a7710a 100644
--- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
+++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
@@ -30,6 +30,7 @@
import android.graphics.Point;
import android.graphics.Rect;
import android.os.SystemClock;
+import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
@@ -223,12 +224,14 @@
int leftEdge = 10;
Point taskbarUnstashArea = new Point(leftEdge, mLauncher.getRealDisplaySize().y - 1);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_ENTER,
- new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null);
+ new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
+ InputDevice.SOURCE_MOUSE);
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_EXIT,
- new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null);
+ new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
+ InputDevice.SOURCE_MOUSE);
return new Taskbar(mLauncher);
}
@@ -245,7 +248,8 @@
Point stashedTaskbarHintArea = new Point(mLauncher.getRealDisplaySize().x / 2,
mLauncher.getRealDisplaySize().y - 1);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_ENTER,
- new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null);
+ new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null,
+ InputDevice.SOURCE_MOUSE);
mLauncher.getDevice().wait(mStashedTaskbarHintScaleCondition,
LauncherInstrumentation.WAIT_TIME_MS);
@@ -256,7 +260,8 @@
Point taskbarUnstashArea = new Point(mLauncher.getRealDisplaySize().x / 2,
mLauncher.getRealDisplaySize().y - 1);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_EXIT,
- new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null);
+ new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
+ InputDevice.SOURCE_MOUSE);
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
return new Taskbar(mLauncher);
@@ -308,7 +313,8 @@
Point stashedTaskbarHintArea = new Point(mLauncher.getRealDisplaySize().x / 2,
mLauncher.getRealDisplaySize().y - stashedTaskbarBottomEdge - 1);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_ENTER,
- new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null);
+ new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null,
+ InputDevice.SOURCE_MOUSE);
mLauncher.getDevice().wait(mStashedTaskbarHintScaleCondition,
LauncherInstrumentation.WAIT_TIME_MS);
@@ -317,19 +323,21 @@
"cursor clicking stashed taskbar to go home")) {
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_EXIT,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
- null);
+ null, InputDevice.SOURCE_MOUSE);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
- LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
+ LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER,
+ InputDevice.SOURCE_MOUSE);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_BUTTON_PRESS,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
- null);
+ null, InputDevice.SOURCE_MOUSE);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_BUTTON_RELEASE,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
- null);
+ null, InputDevice.SOURCE_MOUSE);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
- LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
+ LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER,
+ InputDevice.SOURCE_MOUSE);
return mLauncher.getWorkspace();
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 940ea3b..262d5ff 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -1728,11 +1728,11 @@
}
private static MotionEvent getMotionEvent(long downTime, long eventTime, int action,
- float x, float y) {
+ float x, float y, int source) {
return MotionEvent.obtain(downTime, eventTime, action, 1,
- new MotionEvent.PointerProperties[] {getPointerProperties(0)},
- new MotionEvent.PointerCoords[] {getPointerCoords(x, y)},
- 0, 0, 1.0f, 1.0f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
+ new MotionEvent.PointerProperties[]{getPointerProperties(0)},
+ new MotionEvent.PointerCoords[]{getPointerCoords(x, y)},
+ 0, 0, 1.0f, 1.0f, 0, 0, source, 0);
}
private static MotionEvent.PointerProperties getPointerProperties(int pointerId) {
@@ -1768,6 +1768,12 @@
public void sendPointer(long downTime, long currentTime, int action, Point point,
GestureScope gestureScope) {
+ sendPointer(downTime, currentTime, action, point, gestureScope,
+ InputDevice.SOURCE_TOUCHSCREEN);
+ }
+
+ public void sendPointer(long downTime, long currentTime, int action, Point point,
+ GestureScope gestureScope, int source) {
final boolean hasTIS = hasTIS();
int pointerCount = mPointerCount;
@@ -1867,7 +1873,7 @@
? getTrackpadMotionEvent(
downTime, currentTime, action, point.x, point.y, pointerCount,
mTrackpadGestureType)
- : getMotionEvent(downTime, currentTime, action, point.x, point.y);
+ : getMotionEvent(downTime, currentTime, action, point.x, point.y, source);
if (action == MotionEvent.ACTION_BUTTON_PRESS
|| action == MotionEvent.ACTION_BUTTON_RELEASE) {
event.setActionButton(MotionEvent.BUTTON_PRIMARY);