Add TaskbarModeSwitchRule to test both transient/persistent taskbar.

- Lays the foundation for transient taskbar tests.
- Does not add flags that would add ACTION_OUTSIDE in tests.
  We can address testing this functionality in a separate CL

Bug: 257549303
Test: TaplTestsTaskbar
Change-Id: I44acc5e589b959e6d4bc93fdc369e503c54e7d87
This commit is contained in:
Jon Miranda
2022-11-04 15:58:47 -07:00
parent cd587212a2
commit d5a6b5f688
11 changed files with 247 additions and 7 deletions

View File

@@ -37,6 +37,7 @@ import android.view.View;
import android.view.ViewConfiguration;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.launcher3.Alarm;
@@ -169,6 +170,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
private boolean mEnableManualStashingDuringTests = false;
private final Alarm mTimeoutAlarm = new Alarm();
private boolean mEnableBlockingTimeoutDuringTests = false;
// Evaluate whether the handle should be stashed
private final StatePropertyHolder mStatePropertyHolder = new StatePropertyHolder(
@@ -267,10 +269,20 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
* Enables support for manual stashing. This should only be used to add this functionality
* to Launcher specific tests.
*/
@VisibleForTesting
public void enableManualStashingDuringTests(boolean enableManualStashing) {
mEnableManualStashingDuringTests = enableManualStashing;
}
/**
* Enables the auto timeout for taskbar stashing. This method should only be used for taskbar
* testing.
*/
@VisibleForTesting
public void enableBlockingTimeoutDuringTests(boolean enableBlockingTimeout) {
mEnableBlockingTimeoutDuringTests = enableBlockingTimeout;
}
/**
* Sets the flag indicating setup UI is visible
*/
@@ -846,12 +858,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
* Attempts to start timer to auto hide the taskbar based on time.
*/
public void tryStartTaskbarTimeout() {
if (!DisplayController.isTransientTaskbar(mActivity)) {
return;
}
if (mIsStashed) {
if (!DisplayController.isTransientTaskbar(mActivity)
|| mIsStashed
|| mEnableBlockingTimeoutDuringTests) {
return;
}
cancelTimeoutIfExists();
mTimeoutAlarm.setOnAlarmListener(this::onTaskbarTimeout);