Revert "Revert "Add TaskbarModeSwitchRule to test both transient/persistent taskbar.""
This reverts commit e7011d2b87.
Reason for revert: attempt to fix test issues
- Instead of using SharedPrefs which can be flaky anyways,
we pass along a boolean to test transient taskbar when
we are in the test harness
Bug: 257549303
Test: TaplTestsTaskbar
Change-Id: I7c15a97363adc377f29853c1fe60b1960c77bfc3
This commit is contained in:
1 parent
eaa5703f75
commit
f0349354ec
12 files changed
+269
-9
No files matched your search
@@ -42,6 +42,7 @@ import android.view.Display;
|
||||
|
||||
import androidx.annotation.AnyThread;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.window.CachedDisplayInfo;
|
||||
@@ -63,6 +64,7 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
|
||||
private static final String TAG = "DisplayController";
|
||||
private static final boolean DEBUG = false;
|
||||
private static boolean sTransientTaskbarStatusForTests;
|
||||
|
||||
public static final MainThreadInitializedObject<DisplayController> INSTANCE =
|
||||
new MainThreadInitializedObject<>(DisplayController::new);
|
||||
@@ -128,8 +130,18 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
* Returns whether taskbar is transient.
|
||||
*/
|
||||
public static boolean isTransientTaskbar(Context context) {
|
||||
return ENABLE_TRANSIENT_TASKBAR.get()
|
||||
&& getNavigationMode(context) == NavigationMode.NO_BUTTON;
|
||||
return getNavigationMode(context) == NavigationMode.NO_BUTTON
|
||||
&& (Utilities.IS_RUNNING_IN_TEST_HARNESS
|
||||
? sTransientTaskbarStatusForTests
|
||||
: ENABLE_TRANSIENT_TASKBAR.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables transient taskbar status for tests.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public static void enableTransientTaskbarForTests(boolean enable) {
|
||||
sTransientTaskbarStatusForTests = enable;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user