Merge "Not using unstable Messages app in tests" into ub-launcher3-master
diff --git a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 70739ef..c579c8a 100644
--- a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -85,6 +85,10 @@
// TODO handle assistant
}
+ public void onBackAction(boolean completed, int downX, int downY, boolean isButton,
+ boolean gestureSwipeLeft) {
+ }
+
/** Deprecated methods **/
public void onQuickStep(MotionEvent motionEvent) { }
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto
index 5518f09..4974dcb 100644
--- a/protos/launcher_log.proto
+++ b/protos/launcher_log.proto
@@ -106,7 +106,7 @@
RESIZE_HANDLE = 8;
VERTICAL_SCROLL = 9;
HOME_INTENT = 10; // Deprecated, use enum Command instead
- BACK_BUTTON = 11; // Deprecated, use enum Command instead
+ BACK_BUTTON = 11;
QUICK_SCRUB_BUTTON = 12;
CLEAR_ALL_BUTTON = 13;
CANCEL_TARGET = 14;
@@ -114,6 +114,7 @@
SPLIT_SCREEN_TARGET = 16;
REMOTE_ACTION_SHORTCUT = 17;
APP_USAGE_SETTINGS = 18;
+ BACK_GESTURE = 19;
}
enum TipType {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
index 31d6042..21e98f2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -192,7 +192,11 @@
@Override
public int getContainerType() {
- return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER;
+ RecentsActivity activity = getCreatedActivity();
+ boolean visible = activity != null && activity.isStarted() && activity.hasWindowFocus();
+ return visible
+ ? LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER
+ : LauncherLogProto.ContainerType.APP;
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 311824f..87ae091 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -53,6 +53,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.logging.EventLogArray;
+import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.UiThreadHelper;
import com.android.quickstep.SysUINavigationMode.Mode;
@@ -141,6 +142,14 @@
});
}
+ public void onBackAction(boolean completed, int downX, int downY, boolean isButton,
+ boolean gestureSwipeLeft) {
+ final ActivityControlHelper activityControl =
+ mOverviewComponentObserver.getActivityControlHelper();
+ UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY,
+ isButton, gestureSwipeLeft, activityControl.getContainerType());
+ }
+
/** Deprecated methods **/
public void onQuickStep(MotionEvent motionEvent) { }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
index 6b3f028..777e592 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
@@ -17,12 +17,18 @@
import android.annotation.TargetApi;
import android.content.Context;
+import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.ViewDebug;
+import android.view.WindowInsets;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.BaseDragLayer;
@@ -33,6 +39,9 @@
private static final int MIN_SIZE = 10;
private final RecentsActivity mActivity;
+ @ViewDebug.ExportedProperty(category = "launcher")
+ private final RectF mTouchExcludeRegion = new RectF();
+
private final Point mLastKnownSize = new Point(MIN_SIZE, MIN_SIZE);
public RecentsRootView(Context context, AttributeSet attrs) {
@@ -88,4 +97,29 @@
mActivity.getDeviceProfile().updateInsets(mInsets);
super.setInsets(mInsets);
}
+
+ @Override
+ public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
+ if (Utilities.ATLEAST_Q) {
+ Insets gestureInsets = insets.getMandatorySystemGestureInsets();
+ mTouchExcludeRegion.set(gestureInsets.left, gestureInsets.top,
+ gestureInsets.right, gestureInsets.bottom);
+ }
+ return super.dispatchApplyWindowInsets(insets);
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ float x = ev.getX();
+ float y = ev.getY();
+ if (y < mTouchExcludeRegion.top
+ || x < mTouchExcludeRegion.left
+ || x > (getWidth() - mTouchExcludeRegion.right)
+ || y > (getHeight() - mTouchExcludeRegion.bottom)) {
+ return false;
+ }
+ }
+ return super.dispatchTouchEvent(ev);
+ }
}
\ No newline at end of file
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java
index 8e2ffe9..f9a8d1b 100644
--- a/src/com/android/launcher3/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher3/AppWidgetResizeFrame.java
@@ -24,6 +24,9 @@
import com.android.launcher3.util.FocusLogic;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
+import java.util.ArrayList;
+import java.util.List;
+
public class AppWidgetResizeFrame extends AbstractFloatingView implements View.OnKeyListener {
private static final int SNAP_DURATION = 150;
private static final float DIMMED_HANDLE_ALPHA = 0f;
@@ -45,6 +48,7 @@
private final FirstFrameAnimatorHelper mFirstFrameAnimatorHelper;
private final View[] mDragHandles = new View[HANDLE_COUNT];
+ private final List<Rect> mSystemGestureExclusionRects = new ArrayList<>(HANDLE_COUNT);
private LauncherAppWidgetHostView mWidgetView;
private CellLayout mCellLayout;
@@ -106,6 +110,10 @@
.getDimensionPixelSize(R.dimen.resize_frame_background_padding);
mTouchTargetWidth = 2 * mBackgroundPadding;
mFirstFrameAnimatorHelper = new FirstFrameAnimatorHelper(this);
+
+ for (int i = 0; i < HANDLE_COUNT; i++) {
+ mSystemGestureExclusionRects.add(new Rect());
+ }
}
@Override
@@ -118,6 +126,19 @@
}
}
+ @Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+ if (Utilities.ATLEAST_Q) {
+ for (int i = 0; i < HANDLE_COUNT; i++) {
+ View dragHandle = mDragHandles[i];
+ mSystemGestureExclusionRects.get(i).set(dragHandle.getLeft(), dragHandle.getTop(),
+ dragHandle.getRight(), dragHandle.getBottom());
+ }
+ setSystemGestureExclusionRects(mSystemGestureExclusionRects);
+ }
+ }
+
public static void showForWidget(LauncherAppWidgetHostView widget, CellLayout cellLayout) {
Launcher launcher = Launcher.getLauncher(cellLayout.getContext());
AbstractFloatingView.closeAllOpenViews(launcher);
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index 9f6e5cd..e738eb7 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -8,11 +8,15 @@
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Insets;
import android.graphics.Paint;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
+import android.view.WindowInsets;
public class LauncherRootView extends InsettableFrameLayout {
@@ -23,6 +27,9 @@
@ViewDebug.ExportedProperty(category = "launcher")
private final Rect mConsumedInsets = new Rect();
+ @ViewDebug.ExportedProperty(category = "launcher")
+ private final RectF mTouchExcludeRegion = new RectF();
+
private View mAlignedView;
private WindowStateListener mWindowStateListener;
@@ -145,6 +152,31 @@
}
}
+ @Override
+ public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
+ if (Utilities.ATLEAST_Q) {
+ Insets gestureInsets = insets.getMandatorySystemGestureInsets();
+ mTouchExcludeRegion.set(gestureInsets.left, gestureInsets.top,
+ gestureInsets.right, gestureInsets.bottom);
+ }
+ return super.dispatchApplyWindowInsets(insets);
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ float x = ev.getX();
+ float y = ev.getY();
+ if (y < mTouchExcludeRegion.top
+ || x < mTouchExcludeRegion.left
+ || x > (getWidth() - mTouchExcludeRegion.right)
+ || y > (getHeight() - mTouchExcludeRegion.bottom)) {
+ return false;
+ }
+ }
+ return super.dispatchTouchEvent(ev);
+ }
+
public interface WindowStateListener {
void onWindowFocusChanged(boolean hasFocus);
diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java
index 6ccde62..c8a4e2a 100644
--- a/src/com/android/launcher3/logging/UserEventDispatcher.java
+++ b/src/com/android/launcher3/logging/UserEventDispatcher.java
@@ -34,7 +34,8 @@
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
-import android.view.ViewParent;
+
+import androidx.annotation.Nullable;
import com.android.launcher3.DropTarget;
import com.android.launcher3.ItemInfo;
@@ -54,8 +55,6 @@
import java.util.Locale;
import java.util.UUID;
-import androidx.annotation.Nullable;
-
/**
* Manages the creation of {@link LauncherEvent}.
* To debug this class, execute following command before side loading a new apk.
@@ -359,6 +358,27 @@
dispatchUserEvent(event, null);
}
+ public void logActionBack(boolean completed, int downX, int downY, boolean isButton,
+ boolean gestureSwipeLeft, int containerType) {
+ int actionTouch = isButton ? Action.Touch.TAP : Action.Touch.SWIPE;
+ Action action = newCommandAction(actionTouch);
+ action.command = Action.Command.BACK;
+ action.dir = isButton
+ ? Action.Direction.NONE
+ : gestureSwipeLeft
+ ? Action.Direction.LEFT
+ : Action.Direction.RIGHT;
+ Target target = newControlTarget(isButton
+ ? LauncherLogProto.ControlType.BACK_BUTTON
+ : LauncherLogProto.ControlType.BACK_GESTURE);
+ target.spanX = downX;
+ target.spanY = downY;
+ target.cardinality = completed ? 1 : 0;
+ LauncherEvent event = newLauncherEvent(action, target, newContainerTarget(containerType));
+
+ dispatchUserEvent(event, null);
+ }
+
/**
* Currently logs following containers: workspace, allapps, widget tray.
* @param reason