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

Commit b63dc533 authored by Wilson Wu's avatar Wilson Wu Committed by Ming-Shin Lu
Browse files

Simplify IMM#hasActiveConnectionInternal(View)

After CL[1] and CL[2], IMM#hasActiveConnectionInternal(View)
only used by onPostWindowGainedFocus(View, LayoutParams).

However, the condition only need to verify the given view is
associated with current active input connection.

Hence we can remove the mServedInputConnection.isActive() check
to simplify the method.

[1]: I64412e87c4881018ea67140f9472e10ea41836e4
[2]: I7fe8b18ffbb450fd1e272e15f06f2629518f320c

Bug: 182259171
Test: atest CtsInputMethodTestCases
Test: make -j CtsInputMethod1  \
              CtsInputMethod2  \
              CtsInputMethodServiceDeviceTests  \
              CtsInputMethodServiceEventProvider  \
              CtsInputMethodServiceHostTestCases  \
              EditTextApp  &&
      atest -it  \
      CtsInputMethodServiceHostTestCases:InputMethodServiceLifecycleTest
Change-Id: Ib0c6827c58dd082a5f70b6ec508536b24cf42dcd
parent e79e299e
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -903,8 +903,6 @@ public final class InputMethodManager {
    /**
     * Checks whether the active input connection (if any) is for the given view.
     *
     * TODO(b/182259171): Clean-up hasActiveConnection to simplify the logic.
     *
     * Note that this method is only intended for restarting input after focus gain
     * (e.g. b/160391516), DO NOT leverage this method to do another check.
     */
@@ -915,7 +913,6 @@ public final class InputMethodManager {
            }

            return mServedInputConnection != null
                    && mServedInputConnection.isActive()
                    && mServedInputConnection.isAssociatedWith(view);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ final class RemoteInputConnectionImpl extends IRemoteInputConnection.Stub {
        }
    }

    public boolean isActive() {
    private boolean isActive() {
        return mParentInputMethodManager.isActive() && !isFinished();
    }