Taskbar Pinning Preference Rule fixes.

- Actually evaluate statement in tests.
- Enable aconfig flag for taskbar pinning.
- Allow DisplayController Taskbar mode to change in test harness.
- Make DisplayController think it's in desktop mode when needed.

Flag: TEST_ONLY
Bug: 230027385
Test: TaskbarPinningPreferenceRuleTest

Change-Id: I1c55f73cb5a4bb903cd2d628fa47fbd5e8b1bb86
This commit is contained in:
Brian Isganitis committed 2024-07-15 22:34:01 -04:00
1 parent 803c85ac21
commit e3d3d653d1
4 files changed
+43 -8

No files matched your search

@@ -76,6 +76,7 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
private static final String TAG = "DisplayController";
private static final boolean DEBUG = false;
private static boolean sTaskbarModePreferenceStatusForTests = false;
private static boolean sTransientTaskbarStatusForTests = true;
// TODO(b/254119092) remove all logs with this tag
@@ -202,6 +203,14 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
sTransientTaskbarStatusForTests = enable;
}
/**
* Enables respecting taskbar mode preference during test.
*/
@VisibleForTesting
public static void enableTaskbarModePreferenceForTests(boolean enable) {
sTaskbarModePreferenceStatusForTests = enable;
}
/**
* Returns whether the taskbar is pinned in gesture navigation mode.
*/
@@ -461,7 +470,7 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
if (navigationMode != NavigationMode.NO_BUTTON) {
return false;
}
if (Utilities.isRunningInTestHarness()) {
if (Utilities.isRunningInTestHarness() && !sTaskbarModePreferenceStatusForTests) {
// TODO(b/258604917): Once ENABLE_TASKBAR_PINNING is enabled, remove usage of
// sTransientTaskbarStatusForTests and update test to directly
// toggle shared preference to switch transient taskbar on/off.