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

Commit 8880ecd7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "input-trace-ime-active" into main

* changes:
  InputMethodManagerInternal: Remove isAnyInputConnectionActive
  Notify InputManagerService when an IME is active
parents e9955341 4dc27549
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -141,6 +141,11 @@ public abstract class InputManagerInternal {
     */
    public abstract void unregisterLidSwitchCallback(@NonNull LidSwitchCallback callbacks);

    /**
     * Notify the input manager that an IME connection is becoming active or is no longer active.
     */
    public abstract void notifyInputMethodConnectionActive(boolean connectionIsActive);

    /** Callback interface for notifications relating to the lid switch. */
    public interface LidSwitchCallback {
        /**
+5 −7
Original line number Diff line number Diff line
@@ -2846,13 +2846,6 @@ public class InputManagerService extends IInputManager.Stub
                lockedModifierState);
    }

    // Native callback.
    @SuppressWarnings("unused")
    boolean isInputMethodConnectionActive() {
        return mInputMethodManagerInternal != null
                && mInputMethodManagerInternal.isAnyInputConnectionActive();
    }

    /**
     * Callback interface implemented by the Window Manager.
     */
@@ -3300,6 +3293,11 @@ public class InputManagerService extends IInputManager.Stub
            unregisterLidSwitchCallbackInternal(callbacks);
        }

        @Override
        public void notifyInputMethodConnectionActive(boolean connectionIsActive) {
            mNative.setInputMethodConnectionIsActive(connectionIsActive);
        }

        @Override
        public InputChannel createInputChannel(String inputChannelName) {
            return InputManagerService.this.createInputChannel(inputChannelName);
+5 −0
Original line number Diff line number Diff line
@@ -273,6 +273,8 @@ interface NativeInputManagerService {
     */
    void setAccessibilityStickyKeysEnabled(boolean enabled);

    void setInputMethodConnectionIsActive(boolean isActive);

    /** The native implementation of InputManagerService methods. */
    class NativeImpl implements NativeInputManagerService {
        /** Pointer to native input manager service object, used by native code. */
@@ -549,5 +551,8 @@ interface NativeInputManagerService {

        @Override
        public native void setAccessibilityStickyKeysEnabled(boolean enabled);

        @Override
        public native void setInputMethodConnectionIsActive(boolean isActive);
    }
}
+0 −11
Original line number Diff line number Diff line
@@ -234,12 +234,6 @@ public abstract class InputMethodManagerInternal {
    public abstract void onSwitchKeyboardLayoutShortcut(int direction, int displayId,
            IBinder targetWindowToken);

    /**
     * Returns true if any InputConnection is currently active.
     * {@hide}
     */
    public abstract boolean isAnyInputConnectionActive();

    /**
     * Fake implementation of {@link InputMethodManagerInternal}. All the methods do nothing.
     */
@@ -331,11 +325,6 @@ public abstract class InputMethodManagerInternal {
                public void onSwitchKeyboardLayoutShortcut(int direction, int displayId,
                        IBinder targetWindowToken) {
                }

                @Override
                public boolean isAnyInputConnectionActive() {
                    return false;
                }
            };

    /**
+8 −8
Original line number Diff line number Diff line
@@ -2177,6 +2177,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
            prepareClientSwitchLocked(cs);
        }

        final boolean connectionWasActive = mCurInputConnection != null;

        // Bump up the sequence for this client and attach it.
        advanceSequenceNumberLocked();
        mCurClient = cs;
@@ -2195,6 +2197,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
        }
        mCurEditorInfo = editorInfo;

        // Notify input manager if the connection state changes.
        final boolean connectionIsActive = mCurInputConnection != null;
        if (connectionIsActive != connectionWasActive) {
            mInputManagerInternal.notifyInputMethodConnectionActive(connectionIsActive);
        }

        // If configured, we want to avoid starting up the IME if it is not supposed to be showing
        if (shouldPreventImeStartupLocked(selectedMethodId, startInputFlags,
                unverifiedTargetSdkVersion)) {
@@ -5693,14 +5701,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                switchKeyboardLayoutLocked(direction);
            }
        }

        /**
         * Returns true if any InputConnection is currently active.
         */
        @Override
        public boolean isAnyInputConnectionActive() {
            return mCurInputConnection != null;
        }
    }

    @BinderThread
Loading