From b3cbc9330ecd4bde7c4189cdca54aaa9a85d658c Mon Sep 17 00:00:00 2001 From: "Priyanka Advani (xWF)" Date: Tue, 5 Nov 2024 20:00:49 +0000 Subject: Revert "Add API for Custom IME Switcher button visibility" Revert submission 29904508-custom-ime-switcher-visibility-api Reason for revert: Droidmonitor created revert due to b/377538389. Will be verifying through ABTD before submission. Reverted changes: /q/submissionid:29904508-custom-ime-switcher-visibility-api Change-Id: I213fca551fd99130127054f2d56cfab514ecf7a1 --- core/api/current.txt | 1 - .../inputmethodservice/InputMethodService.java | 34 ---------------------- .../NavigationBarController.java | 28 ------------------ 3 files changed, 63 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index e7ed8166062a..47ec2f91c385 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -20946,7 +20946,6 @@ package android.inputmethodservice { method @Deprecated public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface(); method public android.view.View onCreateInputView(); method protected void onCurrentInputMethodSubtypeChanged(android.view.inputmethod.InputMethodSubtype); - method @FlaggedApi("android.view.inputmethod.ime_switcher_revamp_api") public void onCustomImeSwitcherButtonRequestedVisible(boolean); method public void onDisplayCompletions(android.view.inputmethod.CompletionInfo[]); method public boolean onEvaluateFullscreenMode(); method @CallSuper public boolean onEvaluateInputViewShown(); diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index ae8366817f2b..8c3f0ef08039 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -55,7 +55,6 @@ import static android.view.inputmethod.ConnectionlessHandwritingCallback.CONNECT import static android.view.inputmethod.ConnectionlessHandwritingCallback.CONNECTIONLESS_HANDWRITING_ERROR_OTHER; import static android.view.inputmethod.ConnectionlessHandwritingCallback.CONNECTIONLESS_HANDWRITING_ERROR_UNSUPPORTED; import static android.view.inputmethod.Flags.FLAG_CONNECTIONLESS_HANDWRITING; -import static android.view.inputmethod.Flags.FLAG_IME_SWITCHER_REVAMP_API; import static android.view.inputmethod.Flags.ctrlShiftShortcut; import static android.view.inputmethod.Flags.predictiveBackIme; @@ -4392,39 +4391,6 @@ public class InputMethodService extends AbstractInputMethodService { return mNavigationBarController.isShown(); } - /** - * Called when the requested visibility of a custom IME Switcher button changes. - * - *

When the system provides an IME navigation bar, it may decide to show an IME Switcher - * button inside this bar. However, the IME can request hiding the bar provided by the system - * with {@code getWindowInsetsController().hide(captionBar())} (the IME navigation bar provides - * {@link Type#captionBar() captionBar} insets to the IME window). If the request is successful, - * then it becomes the IME's responsibility to provide a custom IME Switcher button in its - * input view, with equivalent functionality.

- * - *

This custom button is only requested to be visible when the system provides the IME - * navigation bar, both the bar and the IME Switcher button inside it should be visible, - * but the IME successfully requested to hide the bar. This does not depend on the current - * visibility of the IME. It could be called with {@code true} while the IME is hidden, in - * which case the IME should prepare to show the button as soon as the IME itself is shown.

- * - *

This is only called when the requested visibility changes. The default value is - * {@code false} and as such, this will not be called initially if the resulting value is - * {@code false}.

- * - *

This can be called at any time after {@link #onCreate}, even if the IME is not currently - * visible. However, this is not guaranteed to be called before the IME is shown, as it depends - * on when the IME requested hiding the IME navigation bar. If the request is sent during - * the showing flow (e.g. during {@link #onStartInputView}), this will be called shortly after - * {@link #onWindowShown}, but before the first IME frame is drawn.

- * - * @param visible whether the button is requested visible or not. - */ - @FlaggedApi(FLAG_IME_SWITCHER_REVAMP_API) - public void onCustomImeSwitcherButtonRequestedVisible(boolean visible) { - // Intentionally empty - } - /** * Called when the IME switch button was clicked from the client. Depending on the number of * enabled IME subtypes, this will either switch to the next IME/subtype, or show the input diff --git a/core/java/android/inputmethodservice/NavigationBarController.java b/core/java/android/inputmethodservice/NavigationBarController.java index 38be8d9f772d..b08454dd7f8f 100644 --- a/core/java/android/inputmethodservice/NavigationBarController.java +++ b/core/java/android/inputmethodservice/NavigationBarController.java @@ -41,7 +41,6 @@ import android.view.WindowInsets; import android.view.WindowInsetsController.Appearance; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; -import android.view.inputmethod.Flags; import android.view.inputmethod.InputMethodManager; import android.widget.FrameLayout; @@ -179,9 +178,6 @@ final class NavigationBarController { private boolean mDrawLegacyNavigationBarBackground; - /** Whether a custom IME Switcher button should be visible. */ - private boolean mCustomImeSwitcherVisible; - private final Rect mTempRect = new Rect(); private final int[] mTempPos = new int[2]; @@ -269,7 +265,6 @@ final class NavigationBarController { // IME navigation bar. boolean visible = insets.isVisible(captionBar()); mNavigationBarFrame.setVisibility(visible ? View.VISIBLE : View.GONE); - checkCustomImeSwitcherVisibility(); } return view.onApplyWindowInsets(insets); }); @@ -496,8 +491,6 @@ final class NavigationBarController { mShouldShowImeSwitcherWhenImeIsShown; mShouldShowImeSwitcherWhenImeIsShown = shouldShowImeSwitcherWhenImeIsShown; - checkCustomImeSwitcherVisibility(); - mService.mWindow.getWindow().getDecorView().getWindowInsetsController() .setImeCaptionBarInsetsHeight(getImeCaptionBarHeight(imeDrawsImeNavBar)); @@ -623,33 +616,12 @@ final class NavigationBarController { && mNavigationBarFrame.getVisibility() == View.VISIBLE; } - /** - * Checks if a custom IME Switcher button should be visible, and notifies the IME when this - * state changes. This can only be {@code true} if three conditions are met: - * - *
  • The IME should draw the IME navigation bar.
  • - *
  • The IME Switcher button should be visible when the IME is visible.
  • - *
  • The IME navigation bar should be visible, but was requested hidden by the IME.
  • - */ - private void checkCustomImeSwitcherVisibility() { - if (!Flags.imeSwitcherRevampApi()) { - return; - } - final boolean visible = mImeDrawsImeNavBar && mShouldShowImeSwitcherWhenImeIsShown - && mNavigationBarFrame != null && !isShown(); - if (visible != mCustomImeSwitcherVisible) { - mCustomImeSwitcherVisible = visible; - mService.onCustomImeSwitcherButtonRequestedVisible(mCustomImeSwitcherVisible); - } - } - @Override public String toDebugString() { return "{mImeDrawsImeNavBar=" + mImeDrawsImeNavBar + " mNavigationBarFrame=" + mNavigationBarFrame + " mShouldShowImeSwitcherWhenImeIsShown=" + mShouldShowImeSwitcherWhenImeIsShown - + " mCustomImeSwitcherVisible=" + mCustomImeSwitcherVisible + " mAppearance=0x" + Integer.toHexString(mAppearance) + " mDarkIntensity=" + mDarkIntensity + " mDrawLegacyNavigationBarBackground=" + mDrawLegacyNavigationBarBackground -- cgit v1.2.3-59-g8ed1b