Do not hide persistent taskbar during input for physical keyboard.
Fix: 255818649
Test: TaplTestsQuickstep
Flag: NONE.
Change-Id: Id5495163f43464125bfcbd9e255f18e24183d67a
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 5be74be..56f1044 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -1055,10 +1055,10 @@
* * in small screen AND
* * 3 button nav AND
* * landscape (or seascape)
- * We do not stash if taskbar is transient
+ * We do not stash if taskbar is transient or hardware keyboard is active.
*/
private boolean shouldStashForIme() {
- if (DisplayController.isTransientTaskbar(mActivity)) {
+ if (DisplayController.isTransientTaskbar(mActivity) || mActivity.isHardwareKeyboard()) {
return false;
}
return (mIsImeShowing || mIsImeSwitcherShowing) &&
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 0966350..de1af1b 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -28,6 +28,7 @@
import static org.junit.Assume.assumeTrue;
import android.content.Intent;
+import android.content.res.Configuration;
import android.platform.test.annotations.PlatinumTest;
import androidx.test.filters.LargeTest;
@@ -312,7 +313,11 @@
// Expect task bar invisible when the launched app was the IME activity.
LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
- launchedAppState.assertTaskbarHidden();
+ if (isHardwareKeyboard()) {
+ launchedAppState.assertTaskbarVisible();
+ } else {
+ launchedAppState.assertTaskbarHidden();
+ }
// Quick-switch to the test app with swiping to right.
quickSwitchToPreviousAppAndAssert(true /* toRight */);
@@ -324,6 +329,11 @@
launchedAppState.assertTaskbarVisible();
}
+ private boolean isHardwareKeyboard() {
+ return Configuration.KEYBOARD_QWERTY
+ == mTargetContext.getResources().getConfiguration().keyboard;
+ }
+
@Test
@NavigationModeSwitch
@PortraitLandscape
diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java
index 3921e12..7072287 100644
--- a/src/com/android/launcher3/views/ActivityContext.java
+++ b/src/com/android/launcher3/views/ActivityContext.java
@@ -34,6 +34,7 @@
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.pm.LauncherApps;
+import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -306,6 +307,14 @@
}
/**
+ * Returns if the connected keyboard is a hardware keyboard.
+ */
+ default boolean isHardwareKeyboard() {
+ return Configuration.KEYBOARD_QWERTY
+ == ((Context) this).getResources().getConfiguration().keyboard;
+ }
+
+ /**
* Sends a pending intent animating from a view.
*
* @param v View to animate.