Merge "Adding more icons to Launcher for tests" into ub-launcher3-qt-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
index 7c0791e..e865137 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
@@ -41,6 +41,7 @@
import com.android.quickstep.util.MotionPauseDetector;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.launcher3.R;
+import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.NavigationBarCompat;
/**
@@ -83,8 +84,11 @@
private final InputConsumer mConsumerDelegate;
private final Context mContext;
+ private final InputMonitorCompat mInputMonitorCompat;
+
+
public AssistantTouchConsumer(Context context, ISystemUiProxy systemUiProxy,
- InputConsumer delegate) {
+ InputConsumer delegate, InputMonitorCompat inputMonitorCompat) {
final Resources res = context.getResources();
mContext = context;
mSysUiProxy = systemUiProxy;
@@ -94,6 +98,7 @@
mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold);
mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold);
mSlop = NavigationBarCompat.getQuickScrubTouchSlopPx();
+ mInputMonitorCompat = inputMonitorCompat;
mState = STATE_INACTIVE;
}
@@ -153,6 +158,10 @@
if (!mPassedSlop) {
// Normal gesture, ensure we pass the slop before we start tracking the gesture
if (Math.hypot(mLastPos.x - mDownPos.x, mLastPos.y - mDownPos.y) > mSlop) {
+
+ // Cancel touches to other windows (intercept)
+ mInputMonitorCompat.pilferPointers();
+
mPassedSlop = true;
mStartDragPos.set(mLastPos.x, mLastPos.y);
mDragTime = SystemClock.uptimeMillis();
@@ -162,7 +171,8 @@
Math.atan2(mDownPos.y - mLastPos.y, mDownPos.x - mLastPos.x));
mDirection = angle > 90 ? UPLEFT : UPRIGHT;
angle = angle > 90 ? 180 - angle : angle;
- if (angle > mAngleThreshold) {
+
+ if (angle > mAngleThreshold && angle < 90 - mAngleThreshold) {
mState = STATE_ASSISTANT_ACTIVE;
if (mConsumerDelegate != null) {
@@ -209,6 +219,7 @@
animator.setInterpolator(Interpolators.DEACCEL_2);
animator.start();
}
+ mState = STATE_INACTIVE;
mMotionPauseDetector.clear();
break;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
index 990bcff..9c8e80e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
@@ -149,6 +149,7 @@
mDragSlop = NavigationBarCompat.getQuickStepDragSlopPx();
mTouchSlop = NavigationBarCompat.getQuickStepTouchSlopPx();
+
mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture;
}
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 6044b61..95dea50 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -461,7 +461,7 @@
&& SysUINavigationMode.INSTANCE.get(this).getMode() == Mode.NO_BUTTON
&& AssistantTouchConsumer.withinTouchRegion(this, event)) {
return new AssistantTouchConsumer(this, mISystemUiProxy, !activityControl.isResumed()
- ? createOtherActivityInputConsumer(event, runningTaskInfo) : null);
+ ? createOtherActivityInputConsumer(event, runningTaskInfo) : null, mInputMonitorCompat);
} else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) {
return OverviewInputConsumer.newInstance(activityControl, false);
} else if (ENABLE_QUICKSTEP_LIVE_TILE.get() &&
diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml
index a966698..e29d3df 100644
--- a/quickstep/res/values/config.xml
+++ b/quickstep/res/values/config.xml
@@ -29,5 +29,5 @@
<!-- Assistant Gesture -->
<integer name="assistant_gesture_min_time_threshold">200</integer>
- <integer name="assistant_gesture_corner_deg_threshold">30</integer>
+ <integer name="assistant_gesture_corner_deg_threshold">10</integer>
</resources>
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index c5a1aca..75959d1 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -65,7 +65,7 @@
<dimen name="shelf_surface_offset">24dp</dimen>
<!-- Assistant Gestures -->
- <dimen name="gestures_assistant_size">28dp</dimen>
+ <dimen name="gestures_assistant_size">48dp</dimen>
<dimen name="gestures_assistant_drag_threshold">70dp</dimen>
<!-- Distance to move elements when swiping up to go home from launcher -->
diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
index 6034791..e552f56 100644
--- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
+++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
@@ -21,6 +21,7 @@
import static com.android.quickstep.NavigationModeSwitchRule.Mode.ALL;
import static com.android.quickstep.NavigationModeSwitchRule.Mode.THREE_BUTTON;
import static com.android.quickstep.NavigationModeSwitchRule.Mode.TWO_BUTTON;
+import static com.android.quickstep.NavigationModeSwitchRule.Mode.ZERO_BUTTON;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_2BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_3BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_GESTURAL_OVERLAY;
@@ -85,9 +86,9 @@
final LauncherInstrumentation.NavigationModel originalMode =
mLauncher.getNavigationModel();
try {
-// if (mode == ZERO_BUTTON || mode == ALL) {
-// evaluateWithZeroButtons();
-// }
+ if (mode == ZERO_BUTTON || mode == ALL) {
+ evaluateWithZeroButtons();
+ }
if (mode == TWO_BUTTON || mode == ALL) {
evaluateWithTwoButtons();
}
@@ -131,7 +132,10 @@
overlayPackage == NAV_BAR_MODE_GESTURAL_OVERLAY);
for (int i = 0; i != 100; ++i) {
- if (mLauncher.getNavigationModel() == expectedMode) return;
+ if (mLauncher.getNavigationModel() == expectedMode) {
+ Thread.sleep(1000);
+ return;
+ }
Thread.sleep(100);
}
Assert.fail("Couldn't switch to " + overlayPackage);
diff --git a/res/values/overlayable.xml b/res/values/overlayable.xml
new file mode 100644
index 0000000..b68d615
--- /dev/null
+++ b/res/values/overlayable.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<resources>
+ <overlayable name="SystemIcons">
+ <policy type="product|system|vendor">
+ <item type="drawable" name="ic_corp"/>
+ <item type="drawable" name="ic_info_no_shadow"/>
+ <item type="drawable" name="ic_remove_no_shadow"/>
+ <item type="drawable" name="ic_setting"/>
+ <item type="drawable" name="ic_wallpaper"/>
+ <item type="drawable" name="ic_warning"/>
+ <item type="drawable" name="ic_widget"/>
+ </policy>
+ </overlayable>
+</resources>
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 074c149..563f3b3 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -3,6 +3,7 @@
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
+import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
@@ -159,9 +160,8 @@
return (view) -> {
dismissTaskMenuView(activity);
Rect sourceBounds = activity.getViewBounds(view);
- Bundle opts = activity.getActivityLaunchOptionsAsBundle(view);
new PackageManagerHelper(activity).startDetailsActivityForInfo(
- itemInfo, sourceBounds, opts);
+ itemInfo, sourceBounds, ActivityOptions.makeBasic().toBundle());
activity.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.APPINFO_TARGET, view);
};
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 876afcc..8f777b6 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -255,12 +255,14 @@
assertEquals("Unexpected display rotation",
mExpectedRotation, mDevice.getDisplayRotation());
final NavigationModel navigationModel = getNavigationModel();
- assertTrue("Presence of recents button doesn't match the interaction mode",
- (navigationModel == NavigationModel.THREE_BUTTON) ==
- hasSystemUiObject("recent_apps"));
- assertTrue("Presence of home button doesn't match the interaction mode",
- (navigationModel != NavigationModel.ZERO_BUTTON) ==
- hasSystemUiObject("home"));
+ final boolean hasRecentsButton = hasSystemUiObject("recent_apps");
+ final boolean hasHomeButton = hasSystemUiObject("home");
+ assertTrue("Presence of recents button doesn't match the interaction mode, mode="
+ + navigationModel.name() + ", hasRecents=" + hasRecentsButton,
+ (navigationModel == NavigationModel.THREE_BUTTON) == hasRecentsButton);
+ assertTrue("Presence of home button doesn't match the interaction mode, mode="
+ + navigationModel.name() + ", hasHome=" + hasHomeButton,
+ (navigationModel != NavigationModel.ZERO_BUTTON) == hasHomeButton);
log("verifyContainerType: " + containerType);
try (Closable c = addContextLayer(