Merge "Improve Taskbar touchableRegion debuggability" into main

This commit is contained in:
Tony Wickham
2024-01-13 01:38:18 +00:00
committed by Android (Google) Code Review
5 changed files with 91 additions and 7 deletions
@@ -17,16 +17,23 @@ package com.android.quickstep;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;
import android.graphics.Rect;
import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.Closeable;
import java.io.IOException;
@LargeTest
@RunWith(AndroidJUnit4.class)
public class TaplTestsPersistentTaskbar extends AbstractTaplTestsTaskbar {
@@ -39,4 +46,28 @@ public class TaplTestsPersistentTaskbar extends AbstractTaplTestsTaskbar {
// Width check is performed inside TAPL whenever getTaskbar() is called.
getTaskbar();
}
@Test
@NavigationModeSwitch(mode = NavigationModeSwitchRule.Mode.THREE_BUTTON)
public void testThreeButtonsTaskbarBoundsAfterConfigChangeDuringIme() {
// Start off in light mode.
try (Closeable c = InstrumentationRegistry.getInstrumentation().getUiAutomation()
.executeShellCommand("cmd uimode night no")) {
Rect taskbarBoundsBefore = getTaskbar().getVisibleBounds();
startImeTestActivity();
// IME should stash the taskbar, which hides icons even in 3 button mode.
mLauncher.getLaunchedAppState().assertTaskbarHidden();
// Switch to dark mode (any configuration change here would do).
InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand(
"cmd uimode night yes").close();
// Close IME to check new taskbar bounds.
mLauncher.pressBack();
Rect taskbarBoundsAfter = getTaskbar().getVisibleBounds();
Assert.assertEquals(
"Taskbar bounds are not the same after a configuration change while stashed.",
taskbarBoundsBefore, taskbarBoundsAfter);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}