Revert "Add unit test for StatusBarTouchController.java"
This reverts commit 1f0465e9f26cba907a4d50ea8451318e094d1448.
Reason for revert: Droidmonitor investigation of test suite failure
Bug: 323976612
Change-Id: I07895d5c10984def103c240664755b96b79f1fb5
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
index 74ba006..d98e608 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
@@ -31,8 +31,6 @@
import android.view.Window;
import android.view.WindowManager;
-import androidx.annotation.VisibleForTesting;
-
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
@@ -53,12 +51,12 @@
private final Launcher mLauncher;
private final SystemUiProxy mSystemUiProxy;
- @VisibleForTesting final float mTouchSlop;
+ private final float mTouchSlop;
private int mLastAction;
private final SparseArray<PointF> mDownEvents;
/* If {@code false}, this controller should not handle the input {@link MotionEvent}.*/
- @VisibleForTesting boolean mCanIntercept;
+ private boolean mCanIntercept;
private boolean mIsTrackpadReverseScroll;
@@ -87,9 +85,9 @@
@Override
public final boolean onControllerInterceptTouchEvent(MotionEvent ev) {
- final int action = ev.getActionMasked();
- final int idx = ev.getActionIndex();
- final int pid = ev.getPointerId(idx);
+ int action = ev.getActionMasked();
+ int idx = ev.getActionIndex();
+ int pid = ev.getPointerId(idx);
if (action == ACTION_DOWN) {
mCanIntercept = canInterceptTouch(ev);
if (!mCanIntercept) {
@@ -137,6 +135,7 @@
.log(LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN);
setWindowSlippery(false);
mIsTrackpadReverseScroll = false;
+ return true;
}
return true;
}
@@ -150,8 +149,7 @@
* Touches can slide out of the window but they cannot necessarily slide
* back in (unless the other window with touch focus permits it).
*/
- @VisibleForTesting
- void setWindowSlippery(boolean enable) {
+ private void setWindowSlippery(boolean enable) {
Window w = mLauncher.getWindow();
WindowManager.LayoutParams wlp = w.getAttributes();
if (enable) {
diff --git a/quickstep/tests/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchControllerTest.kt b/quickstep/tests/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchControllerTest.kt
deleted file mode 100644
index 119b862..0000000
--- a/quickstep/tests/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchControllerTest.kt
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2024 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.uioverrides.touchcontrollers
-
-import android.view.MotionEvent
-import android.view.WindowManager
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SmallTest
-import com.android.launcher3.Launcher
-import com.android.launcher3.ui.AbstractLauncherUiTest
-import junit.framework.Assert.assertEquals
-import junit.framework.Assert.assertFalse
-import junit.framework.Assert.assertTrue
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class StatusBarTouchControllerTest : AbstractLauncherUiTest() {
- @Before
- @Throws(Exception::class)
- fun setup() {
- super.setUp()
- initialize(this)
- }
-
- @Test
- fun interceptActionDown_canIntercept() {
- executeOnLauncher { launcher ->
- val underTest = StatusBarTouchController(launcher)
- assertFalse(underTest.mCanIntercept)
- val downEvent = MotionEvent.obtain(1, 1, MotionEvent.ACTION_DOWN, 0f, 0f, 0)
-
- underTest.onControllerInterceptTouchEvent(downEvent)
-
- assertTrue(underTest.mCanIntercept)
- }
- }
-
- @Test
- fun interceptVerticalActionMove_handledAndSetSlippery() {
- executeOnLauncher { launcher ->
- val underTest = StatusBarTouchController(launcher)
- val downEvent = MotionEvent.obtain(1, 1, MotionEvent.ACTION_DOWN, 0f, 0f, 0)
- underTest.onControllerInterceptTouchEvent(downEvent)
- val w = launcher.window
- assertEquals(0, w.attributes.flags and WindowManager.LayoutParams.FLAG_SLIPPERY)
- val moveEvent =
- MotionEvent.obtain(
- 2,
- 2,
- MotionEvent.ACTION_MOVE,
- underTest.mTouchSlop,
- underTest.mTouchSlop + 10,
- 0
- )
-
- val handled = underTest.onControllerInterceptTouchEvent(moveEvent)
-
- assertTrue(handled)
- assertEquals(
- WindowManager.LayoutParams.FLAG_SLIPPERY,
- w.attributes.flags and WindowManager.LayoutParams.FLAG_SLIPPERY
- )
- }
- }
-
- @Test
- fun interceptHorizontalActionMove_not_handled() {
- executeOnLauncher { launcher ->
- val underTest = StatusBarTouchController(launcher)
- val downEvent = MotionEvent.obtain(1, 1, MotionEvent.ACTION_DOWN, 0f, 0f, 0)
- underTest.onControllerInterceptTouchEvent(downEvent)
- val moveEvent =
- MotionEvent.obtain(
- 2,
- 2,
- MotionEvent.ACTION_MOVE,
- underTest.mTouchSlop + 10,
- underTest.mTouchSlop,
- 0
- )
-
- val handled = underTest.onControllerInterceptTouchEvent(moveEvent)
-
- assertFalse(handled)
- }
- }
-
- @Test
- fun interceptActionMoveAsFirstGestureEvent_notCrashedNorHandled() {
- executeOnLauncher { launcher ->
- val underTest = StatusBarTouchController(launcher)
- underTest.mCanIntercept = true
- val moveEvent = MotionEvent.obtain(2, 2, MotionEvent.ACTION_MOVE, 10f, 10f, 0)
-
- val handled = underTest.onControllerInterceptTouchEvent(moveEvent)
-
- assertFalse(handled)
- }
- }
-
- @Test
- fun handleActionUp_setNotSlippery() {
- executeOnLauncher { launcher: Launcher ->
- val underTest = StatusBarTouchController(launcher)
- underTest.mCanIntercept = true
- underTest.setWindowSlippery(true)
- val moveEvent = MotionEvent.obtain(2, 2, MotionEvent.ACTION_UP, 10f, 10f, 0)
-
- val handled = underTest.onControllerTouchEvent(moveEvent)
-
- assertTrue(handled)
- assertEquals(
- 0,
- launcher.window.attributes.flags and WindowManager.LayoutParams.FLAG_SLIPPERY
- )
- }
- }
-
- @Test
- fun handleActionCancel_setNotSlippery() {
- executeOnLauncher { launcher ->
- val underTest = StatusBarTouchController(launcher)
- underTest.mCanIntercept = true
- underTest.setWindowSlippery(true)
- val moveEvent = MotionEvent.obtain(2, 2, MotionEvent.ACTION_CANCEL, 10f, 10f, 0)
-
- val handled = underTest.onControllerTouchEvent(moveEvent)
-
- assertTrue(handled)
- assertEquals(
- 0,
- launcher.window.attributes.flags and WindowManager.LayoutParams.FLAG_SLIPPERY
- )
- }
- }
-}