Unstash taskbar after timeout when cursor hovers bottom edge.
This prevents accidental triggering of Taskbar unstash with cursor when the user wants to click the handle to go home. Fix: 338357087 Test: TaplTestsTransientTaskbar Flag: com.android.launcher3.enable_cursor_hover_states Change-Id: I76f3e31cb2588a0fae302278c847227e9548be8f
This commit is contained in:
1 parent
e14ee6f914
commit
5f838c45c2
1 file changed
+18
-4
+18
-4
@@ -28,6 +28,8 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.InputDevice;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
@@ -51,6 +53,9 @@ import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
*/
|
||||
public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
||||
|
||||
private static final int HOVER_TASKBAR_UNSTASH_TIMEOUT = 500;
|
||||
private static final Handler sUnstashHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private final TaskbarActivityContext mTaskbarActivityContext;
|
||||
private final OverviewCommandHelper mOverviewCommandHelper;
|
||||
private final float mUnstashArea;
|
||||
@@ -299,16 +304,25 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
||||
dp.heightPx);
|
||||
|
||||
if (mBottomEdgeBounds.contains(x, y)) {
|
||||
// If hovering stashed taskbar and then hover screen bottom edge, unstash it.
|
||||
mTaskbarActivityContext.onSwipeToUnstashTaskbar();
|
||||
mIsStashedTaskbarHovered = false;
|
||||
// start a single unstash timeout if hovering bottom edge under the hinted taskbar.
|
||||
if (!sUnstashHandler.hasMessagesOrCallbacks()) {
|
||||
sUnstashHandler.postDelayed(() -> {
|
||||
mTaskbarActivityContext.onSwipeToUnstashTaskbar();
|
||||
mIsStashedTaskbarHovered = false;
|
||||
}, HOVER_TASKBAR_UNSTASH_TIMEOUT);
|
||||
}
|
||||
} else if (!isStashedTaskbarHovered(x, y)) {
|
||||
// If exit hovering stashed taskbar, remove hint.
|
||||
// If exit hovering stashed taskbar, remove hint and clear pending unstash calls.
|
||||
sUnstashHandler.removeCallbacksAndMessages(null);
|
||||
startStashedTaskbarHover(/* isHovered = */ false);
|
||||
} else {
|
||||
sUnstashHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUnhoveredTaskbarState(int x, int y) {
|
||||
sUnstashHandler.removeCallbacksAndMessages(null);
|
||||
|
||||
DeviceProfile dp = mTaskbarActivityContext.getDeviceProfile();
|
||||
mBottomEdgeBounds.set(
|
||||
0,
|
||||
|
||||
Reference in new issue
Block a user