Split up tests by actual hardware keyboard status.

Flag: TEST_ONLY
Bug: 230027385
Test: TaskbarStashControllerTest
Change-Id: I63fc433810af3993db5655571a11887eb2c68422
This commit is contained in:
Brian Isganitis
2024-12-10 19:06:28 -05:00
parent b172e86472
commit a481af5779
2 changed files with 28 additions and 25 deletions
@@ -84,8 +84,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
private static final String TAG = "TaskbarStashController";
private static final boolean DEBUG = false;
private static boolean sEnableSoftwareImeForTests = false;
/**
* Def. value for @param shouldBubblesFollow in
* {@link #updateAndAnimateTransientTaskbar(boolean)} */
@@ -1172,13 +1170,13 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
}
// Do not stash if pinned taskbar, hardware keyboard is attached and no IME is docked
if (isHardwareKeyboard() && DisplayController.isPinnedTaskbar(mActivity)
if (mActivity.isHardwareKeyboard() && DisplayController.isPinnedTaskbar(mActivity)
&& !mActivity.isImeDocked()) {
return false;
}
// Do not stash if hardware keyboard is attached, in 3 button nav and desktop windowing mode
if (isHardwareKeyboard()
if (mActivity.isHardwareKeyboard()
&& mActivity.isThreeButtonNav()
&& mControllers.taskbarDesktopModeController.getAreDesktopTasksVisible()) {
return false;
@@ -1192,21 +1190,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
return mIsImeShowing || mIsImeSwitcherShowing;
}
private boolean isHardwareKeyboard() {
return mActivity.isHardwareKeyboard() && !sEnableSoftwareImeForTests;
}
/**
* Overrides {@link #isHardwareKeyboard()} to {@code false} for testing, if enabled.
* <p>
* Virtual devices are sometimes in hardware keyboard mode, leading to an inconsistent
* testing environment.
*/
@VisibleForTesting
static void enableSoftwareImeForTests(boolean enable) {
sEnableSoftwareImeForTests = enable;
}
/**
* Updates the proper flag to indicate whether the task bar should be stashed.
*