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

Commit c723b12c authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove InputMethodManagerDelegate#setCurrentRootView()

With this CL,

  InputMethodManagerDelegate#setCurrentRootView()

will be removed.

This is mechanical refactoring.  There must be no observable behavior
change.

Bug: 234882948
Test: presubmit
Change-Id: I3e596b4243f3223d1c9b8ba3571f91879ce0ecd4
parent 867ceacb
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -82,12 +82,10 @@ public final class ImeFocusController {

    @UiThread
    void onPreWindowFocus(boolean hasWindowFocus, WindowManager.LayoutParams windowAttribute) {
        if (!mHasImeFocus || isInLocalFocusMode(windowAttribute)) {
        if (!hasWindowFocus || !mHasImeFocus || isInLocalFocusMode(windowAttribute)) {
            return;
        }
        if (hasWindowFocus) {
            getImmDelegate().setCurrentRootView(mViewRootImpl);
        }
        getImmDelegate().onPreWindowGainedFocus(mViewRootImpl);
    }

    @UiThread
@@ -113,7 +111,7 @@ public final class ImeFocusController {
                    windowAttribute.softInputMode));
        }

        getImmDelegate().onPostWindowFocus(viewForWindowFocus, windowAttribute);
        getImmDelegate().onPostWindowGainedFocus(viewForWindowFocus, windowAttribute);
    }

    /**
@@ -187,7 +185,8 @@ public final class ImeFocusController {
     * @hide
     */
    public interface InputMethodManagerDelegate {
        void onPostWindowFocus(View viewForWindowFocus,
        void onPreWindowGainedFocus(ViewRootImpl viewRootImpl);
        void onPostWindowGainedFocus(View viewForWindowFocus,
                @NonNull WindowManager.LayoutParams windowAttribute);
        void onViewFocusChanged(@NonNull View view, boolean hasFocus);
        boolean checkFocus(boolean forceNewFocus, boolean startInput, ViewRootImpl viewRootImpl);
@@ -195,7 +194,6 @@ public final class ImeFocusController {
        void onWindowDismissed(ViewRootImpl viewRootImpl);

        void finishInputAndReportToIme();
        void setCurrentRootView(ViewRootImpl rootView);
        boolean isCurrentRootView(ViewRootImpl rootView);
    }

+13 −11
Original line number Diff line number Diff line
@@ -759,7 +759,14 @@ public final class InputMethodManager {
        }

        @Override
        public void onPostWindowFocus(View viewForWindowFocus,
        public void onPreWindowGainedFocus(ViewRootImpl viewRootImpl) {
            synchronized (mH) {
                setCurrentRootViewLocked(viewRootImpl);
            }
        }

        @Override
        public void onPostWindowGainedFocus(View viewForWindowFocus,
                @NonNull WindowManager.LayoutParams windowAttribute) {
            boolean forceFocus = false;
            synchronized (mH) {
@@ -932,20 +939,15 @@ public final class InputMethodManager {
                if (mServedView != null) {
                    finishInputLocked();
                }
                setCurrentRootView(null);
                setCurrentRootViewLocked(null);
            }
        }

        /**
         * Used for {@link ImeFocusController} to set the current focused root view.
         */
        @Override
        public void setCurrentRootView(ViewRootImpl rootView) {
            synchronized (mH) {
        @GuardedBy("mH")
        private void setCurrentRootViewLocked(ViewRootImpl rootView) {
            mImeDispatcher.switchRootView(mCurRootView, rootView);
            mCurRootView = rootView;
        }
        }

        /**
         * Used for {@link ImeFocusController} to return if the root view from the