Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8496b66a authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Android (Google) Code Review
Browse files

Merge "Cleanup ENABLE_HIDE_IME_CAPTION_BAR flag" into main

parents 5f7384fb 0d48f6c3
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -603,12 +603,6 @@ public class InputMethodService extends AbstractInputMethodService {
    @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
    public static final long DISALLOW_INPUT_METHOD_INTERFACE_OVERRIDE = 148086656L;

    /**
     * Enable the logic to allow hiding the IME caption bar ("fake" IME navigation bar).
     * @hide
     */
    public static final boolean ENABLE_HIDE_IME_CAPTION_BAR = true;

    LayoutInflater mInflater;
    TypedArray mThemeAttrs;
    @UnsupportedAppUsage
+16 −22
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.inputmethodservice;

import static android.inputmethodservice.InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR;
import static android.view.WindowInsets.Type.captionBar;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;

@@ -260,16 +259,16 @@ final class NavigationBarController {
            setIconTintInternal(calculateTargetDarkIntensity(mAppearance,
                    mDrawLegacyNavigationBarBackground));

            if (ENABLE_HIDE_IME_CAPTION_BAR) {
            mNavigationBarFrame.setOnApplyWindowInsetsListener((view, insets) -> {
                if (mNavigationBarFrame != null) {
                    // The IME window receives IME-specific captionBar insets, representing the
                    // IME navigation bar.
                    boolean visible = insets.isVisible(captionBar());
                    mNavigationBarFrame.setVisibility(visible ? View.VISIBLE : View.GONE);
                }
                return view.onApplyWindowInsets(insets);
            });
        }
        }

        private void uninstallNavigationBarFrameIfNecessary() {
            if (mNavigationBarFrame == null) {
@@ -279,9 +278,7 @@ final class NavigationBarController {
            if (parent instanceof ViewGroup) {
                ((ViewGroup) parent).removeView(mNavigationBarFrame);
            }
            if (ENABLE_HIDE_IME_CAPTION_BAR) {
            mNavigationBarFrame.setOnApplyWindowInsetsListener(null);
            }
            mNavigationBarFrame = null;
        }

@@ -474,9 +471,6 @@ final class NavigationBarController {
                        decor.bringChildToFront(mNavigationBarFrame);
                    }
                }
                if (!ENABLE_HIDE_IME_CAPTION_BAR) {
                    mNavigationBarFrame.setVisibility(View.VISIBLE);
                }
            }
        }

@@ -497,10 +491,8 @@ final class NavigationBarController {
                    mShouldShowImeSwitcherWhenImeIsShown;
            mShouldShowImeSwitcherWhenImeIsShown = shouldShowImeSwitcherWhenImeIsShown;

            if (ENABLE_HIDE_IME_CAPTION_BAR) {
            mService.mWindow.getWindow().getDecorView().getWindowInsetsController()
                        .setImeCaptionBarInsetsHeight(getImeCaptionBarHeight());
            }
                    .setImeCaptionBarInsetsHeight(getImeCaptionBarHeight(imeDrawsImeNavBar));

            if (imeDrawsImeNavBar) {
                installNavigationBarFrameIfNecessary();
@@ -608,9 +600,11 @@ final class NavigationBarController {

        /**
         * Returns the height of the IME caption bar if this should be shown, or {@code 0} instead.
         *
         * @param imeDrawsImeNavBar whether the IME should show the IME navigation bar.
         */
        private int getImeCaptionBarHeight() {
            return mImeDrawsImeNavBar
        private int getImeCaptionBarHeight(boolean imeDrawsImeNavBar) {
            return imeDrawsImeNavBar
                    ? mService.getResources().getDimensionPixelSize(
                            com.android.internal.R.dimen.navigation_bar_frame_height)
                    : 0;
+0 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.view;

import static android.inputmethodservice.InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR;
import static android.os.Trace.TRACE_TAG_VIEW;
import static android.view.InsetsControllerProto.CONTROL;
import static android.view.InsetsControllerProto.STATE;
@@ -2148,9 +2147,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation

    @Override
    public void setImeCaptionBarInsetsHeight(int height) {
        if (!ENABLE_HIDE_IME_CAPTION_BAR) {
            return;
        }
        Rect newFrame = new Rect(mFrame.left, mFrame.bottom - height, mFrame.right, mFrame.bottom);
        InsetsSource source = mState.peekSource(ID_IME_CAPTION_BAR);
        if (mImeCaptionBarInsetsHeight != height
+0 −7
Original line number Diff line number Diff line
@@ -25,12 +25,10 @@ import static android.app.StatusBarManager.WindowType;
import static android.app.StatusBarManager.WindowVisibleState;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.inputmethodservice.InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR;
import static android.view.InsetsSource.FLAG_SUPPRESS_SCRIM;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;

@@ -1836,11 +1834,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
    private InsetsFrameProvider[] getInsetsFrameProvider(int insetsHeight, Context userContext) {
        final InsetsFrameProvider navBarProvider =
                new InsetsFrameProvider(mInsetsSourceOwner, 0, WindowInsets.Type.navigationBars());
        if (!ENABLE_HIDE_IME_CAPTION_BAR) {
            navBarProvider.setInsetsSizeOverrides(new InsetsFrameProvider.InsetsSizeOverride[] {
                    new InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, null)
            });
        }
        if (insetsHeight != -1 && !mEdgeBackGestureHandler.isButtonForcedVisible()) {
            navBarProvider.setInsetsSize(Insets.of(0, 0, 0, insetsHeight));
        }
+0 −2
Original line number Diff line number Diff line
@@ -6078,8 +6078,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        p.println("  mSystemReady=" + mSystemReady);
        p.println("  mInteractive=" + mIsInteractive);
        p.println("  mConcurrentMultiUserModeEnabled=" + mConcurrentMultiUserModeEnabled);
        p.println("  ENABLE_HIDE_IME_CAPTION_BAR="
                + InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR);
        final int currentImeUserId;
        synchronized (ImfLock.class) {
            currentImeUserId = mCurrentImeUserId;
Loading