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

Commit 6f36dfb0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add IME {insets control, IME-WM} target to History" into rvc-dev am: fde28a6f

Change-Id: Iabc0f89c533ec88867efd2c8d5f1096dffa39cb7
parents e664dec6 fde28a6f
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -820,10 +820,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            final EditorInfo mEditorInfo;
            @NonNull
            final String mRequestWindowName;
            @Nullable
            final String mImeControlTargetName;
            @Nullable
            final String mImeTargetNameFromWm;

            Entry(ClientState client, EditorInfo editorInfo, String focusedWindowName,
                    @SoftInputModeFlags int softInputMode, @SoftInputShowHideReason int reason,
                    boolean inFullscreenMode, String requestWindowName) {
                    boolean inFullscreenMode, String requestWindowName,
                    @Nullable String imeControlTargetName, @Nullable String imeTargetName) {
                mClientState = client;
                mEditorInfo = editorInfo;
                mFocusedWindowName = focusedWindowName;
@@ -833,6 +838,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                mWallTime = System.currentTimeMillis();
                mInFullscreenMode = inFullscreenMode;
                mRequestWindowName = requestWindowName;
                mImeControlTargetName = imeControlTargetName;
                mImeTargetNameFromWm = imeTargetName;
            }
        }

@@ -872,6 +879,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                pw.print(prefix);
                pw.println(" requestWindowName=" + entry.mRequestWindowName);

                pw.print(prefix);
                pw.println(" imeControlTargetName=" + entry.mImeControlTargetName);

                pw.print(prefix);
                pw.println(" imeTargetNameFromWm=" + entry.mImeTargetNameFromWm);

                pw.print(prefix);
                pw.print(" editorInfo: ");
                pw.print(" inputType=" + entry.mEditorInfo.inputType);
@@ -4123,7 +4136,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                            mWindowManagerInternal.getWindowName(mCurFocusedWindow),
                            mCurFocusedWindowSoftInputMode, reason, mInFullscreenMode,
                            mWindowManagerInternal.getWindowName(
                                    mShowRequestWindowMap.get(args.arg3))));
                                    mShowRequestWindowMap.get(args.arg3)),
                            mWindowManagerInternal.getImeControlTargetNameForLogging(
                                    mCurTokenDisplayId),
                            mWindowManagerInternal.getImeTargetNameForLogging(
                                    mCurTokenDisplayId)));
                } catch (RemoteException e) {
                }
                args.recycle();
@@ -4142,7 +4159,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                            mWindowManagerInternal.getWindowName(mCurFocusedWindow),
                            mCurFocusedWindowSoftInputMode, reason, mInFullscreenMode,
                            mWindowManagerInternal.getWindowName(
                                    mHideRequestWindowMap.get(args.arg3))));
                                    mHideRequestWindowMap.get(args.arg3)),
                            mWindowManagerInternal.getImeControlTargetNameForLogging(
                                    mCurTokenDisplayId),
                            mWindowManagerInternal.getImeTargetNameForLogging(
                                    mCurTokenDisplayId)));
                } catch (RemoteException e) {
                }
                args.recycle();
+20 −0
Original line number Diff line number Diff line
@@ -576,4 +576,24 @@ public abstract class WindowManagerInternal {
     * @return The corresponding {@link WindowState#getName()}
     */
    public abstract String getWindowName(@NonNull IBinder binder);

    /**
     * Return the window name of IME Insets control target.
     *
     * @param displayId The ID of the display which input method is currently focused.
     * @return The corresponding {@link WindowState#getName()}
     */
    public abstract @Nullable String getImeControlTargetNameForLogging(int displayId);

    /**
     * Return the current window name of the input method is on top of.
     *
     * Note that the concept of this window is only reparent the target window behind the input
     * method window, it may different with the window which reported by
     * {@code InputMethodManagerService#reportStartInput} which has input connection.
     *
     * @param displayId The ID of the display which input method is currently focused.
     * @return The corresponding {@link WindowState#getName()}
     */
    public abstract @Nullable String getImeTargetNameForLogging(int displayId);
}
+27 −0
Original line number Diff line number Diff line
@@ -7755,6 +7755,33 @@ public class WindowManagerService extends IWindowManager.Stub
                return w != null ? w.getName() : null;
            }
        }

        @Override
        public String getImeControlTargetNameForLogging(int displayId) {
            synchronized (mGlobalLock) {
                final DisplayContent dc = mRoot.getDisplayContent(displayId);
                if (dc == null) {
                    return null;
                }
                final InsetsControlTarget target = dc.mInputMethodControlTarget;
                if (target == null) {
                    return null;
                }
                final WindowState win = target.getWindow();
                return win != null ? win.getName() : target.toString();
            }
        }

        @Override
        public String getImeTargetNameForLogging(int displayId) {
            synchronized (mGlobalLock) {
                final DisplayContent dc = mRoot.getDisplayContent(displayId);
                if (dc == null) {
                    return null;
                }
                return dc.mInputMethodTarget != null ? dc.mInputMethodTarget.getName() : null;
            }
        }
    }

    void registerAppFreezeListener(AppFreezeListener listener) {