summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java13
-rw-r--r--core/res/res/values/config.xml2
-rw-r--r--core/res/res/values/symbols.xml2
-rw-r--r--services/core/java/com/android/server/wm/InsetsPolicy.java19
4 files changed, 21 insertions, 15 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 200fe22edaad..21ecf8b0888c 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -592,7 +592,7 @@ public class InputMethodService extends AbstractInputMethodService {
private InlineSuggestionSessionController mInlineSuggestionSessionController;
- private boolean mAutomotiveHideNavBarForKeyboard;
+ private boolean mHideNavBarForKeyboard;
private boolean mIsAutomotive;
private @NonNull OptionalInt mHandwritingRequestId = OptionalInt.empty();
private InputEventReceiver mHandwritingEventReceiver;
@@ -1498,9 +1498,8 @@ public class InputMethodService extends AbstractInputMethodService {
// shown the first time (cold start).
mSettingsObserver.shouldShowImeWithHardKeyboard();
- mIsAutomotive = isAutomotive();
- mAutomotiveHideNavBarForKeyboard = getApplicationContext().getResources().getBoolean(
- com.android.internal.R.bool.config_automotiveHideNavBarForKeyboard);
+ mHideNavBarForKeyboard = getApplicationContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_hideNavBarForKeyboard);
// TODO(b/111364446) Need to address context lifecycle issue if need to re-create
// for update resources & configuration correctly when show soft input
@@ -1539,11 +1538,11 @@ public class InputMethodService extends AbstractInputMethodService {
window.setFlags(windowFlags, windowFlagsMask);
// Automotive devices may request the navigation bar to be hidden when the IME shows up
- // (controlled via config_automotiveHideNavBarForKeyboard) in order to maximize the
- // visible screen real estate. When this happens, the IME window should animate from the
+ // (controlled via config_hideNavBarForKeyboard) in order to maximize the visible
+ // screen real estate. When this happens, the IME window should animate from the
// bottom of the screen to reduce the jank that happens from the lack of synchronization
// between the bottom system window and the IME window.
- if (mIsAutomotive && mAutomotiveHideNavBarForKeyboard) {
+ if (mHideNavBarForKeyboard) {
window.setDecorFitsSystemWindows(false);
}
}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 178bfbc80e5f..b139e472460a 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4894,7 +4894,7 @@
<!-- Whether or not to hide the navigation bar when the soft keyboard is visible in order to
create additional screen real estate outside beyond the keyboard. Note that the user needs
to have a confirmed way to dismiss the keyboard when desired. -->
- <bool name="config_automotiveHideNavBarForKeyboard">false</bool>
+ <bool name="config_hideNavBarForKeyboard">false</bool>
<!-- Whether or not to show the built-in charging animation when the device begins charging
wirelessly. -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index dcd706c15ff0..77007afc2156 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -4154,7 +4154,7 @@
<java-symbol type="bool" name="config_disable_all_cb_messages" />
<java-symbol type="drawable" name="ic_close" />
- <java-symbol type="bool" name="config_automotiveHideNavBarForKeyboard" />
+ <java-symbol type="bool" name="config_hideNavBarForKeyboard" />
<java-symbol type="bool" name="config_showBuiltinWirelessChargingAnim" />
diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java
index 5c8cfffdd3b3..9e0d7b57264e 100644
--- a/services/core/java/com/android/server/wm/InsetsPolicy.java
+++ b/services/core/java/com/android/server/wm/InsetsPolicy.java
@@ -46,6 +46,7 @@ import android.annotation.Nullable;
import android.app.ActivityTaskManager;
import android.app.StatusBarManager;
import android.app.WindowConfiguration;
+import android.content.res.Resources;
import android.graphics.Rect;
import android.util.ArrayMap;
import android.util.IntArray;
@@ -123,14 +124,17 @@ class InsetsPolicy {
* Let remote insets controller control system bars regardless of other settings.
*/
private boolean mRemoteInsetsControllerControlsSystemBars;
+ private final boolean mHideNavBarForKeyboard;
private final float[] mTmpFloat9 = new float[9];
InsetsPolicy(InsetsStateController stateController, DisplayContent displayContent) {
mStateController = stateController;
mDisplayContent = displayContent;
mPolicy = displayContent.getDisplayPolicy();
- mRemoteInsetsControllerControlsSystemBars = mPolicy.getContext().getResources().getBoolean(
+ final Resources r = mPolicy.getContext().getResources();
+ mRemoteInsetsControllerControlsSystemBars = r.getBoolean(
R.bool.config_remoteInsetsControllerControlsSystemBars);
+ mHideNavBarForKeyboard = r.getBoolean(R.bool.config_hideNavBarForKeyboard);
}
boolean getRemoteInsetsControllerControlsSystemBars() {
@@ -428,13 +432,15 @@ class InsetsPolicy {
private InsetsState adjustVisibilityForIme(WindowState w, InsetsState originalState,
boolean copyState) {
if (w.mIsImWindow) {
- // Navigation bar insets is always visible to IME.
+ // If navigation bar is not hidden by IME, IME should always receive visible
+ // navigation bar insets.
+ final boolean navVisible = !mHideNavBarForKeyboard;
final InsetsSource originalNavSource = originalState.peekSource(ITYPE_NAVIGATION_BAR);
- if (originalNavSource != null && !originalNavSource.isVisible()) {
+ if (originalNavSource != null && originalNavSource.isVisible() != navVisible) {
final InsetsState state = copyState ? new InsetsState(originalState)
: originalState;
final InsetsSource navSource = new InsetsSource(originalNavSource);
- navSource.setVisible(true);
+ navSource.setVisible(navVisible);
state.addSource(navSource);
return state;
}
@@ -573,8 +579,9 @@ class InsetsPolicy {
private @Nullable InsetsControlTarget getNavControlTarget(@Nullable WindowState focusedWin,
boolean fake) {
final WindowState imeWin = mDisplayContent.mInputMethodWindow;
- if (imeWin != null && imeWin.isVisible()) {
- // Force showing navigation bar while IME is visible.
+ if (imeWin != null && imeWin.isVisible() && !mHideNavBarForKeyboard) {
+ // Force showing navigation bar while IME is visible and if navigation bar is not
+ // configured to be hidden by the IME.
return null;
}
if (!fake && isShowingTransientTypes(Type.navigationBars())) {