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

Commit fdcde516 authored by Anmol Gupta's avatar Anmol Gupta Committed by Automerger Merge Worker
Browse files

Merge "Include more details in SoftInputShowHideHistory" into rvc-dev am: ea8748a2 am: e28e5683

Change-Id: Ifab017793e685067691ba0654902c1c88bb8b394
parents 341fc913 e28e5683
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -229,7 +229,7 @@ public final class InputMethodDebug {


    /**
    /**
     * Return a fixed size string of the object.
     * Return a fixed size string of the object.
     * TODO(b/141738570): Take & return with StringBuilder to make more memory efficient.
     * TODO(b/151575861): Take & return with StringBuilder to make more memory efficient.
     */
     */
    @NonNull
    @NonNull
    @AnyThread
    @AnyThread
+47 −26
Original line number Original line Diff line number Diff line
@@ -774,29 +774,35 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        private int mNextIndex = 0;
        private int mNextIndex = 0;
        private static final AtomicInteger sSequenceNumber = new AtomicInteger(0);
        private static final AtomicInteger sSequenceNumber = new AtomicInteger(0);


        // TODO(b/141738570): add requestWindowToken to track who request show / hide softInput.
        private static final class Entry {
        private static final class Entry {
            ClientState mClientState;
            final ClientState mClientState;
            String mFocusedWindowString;
            @SoftInputModeFlags
            @SoftInputModeFlags
            int mFocusedWindowSoftInputMode;
            final int mFocusedWindowSoftInputMode;
            @SoftInputShowHideReason
            @SoftInputShowHideReason
            int mReason;
            final int mReason;
            boolean mRequestShowKeyboard;
            // The timing of handling MSG_SHOW_SOFT_INPUT or MSG_HIDE_SOFT_INPUT.
            // The timing of handling MSG_SHOW_SOFT_INPUT or MSG_HIDE_SOFT_INPUT.
            long mTimestamp;
            final long mTimestamp;
            long mWallTime;
            final long mWallTime;
            int mTargetDisplayId;
            final boolean mInFullscreenMode;
            @NonNull
            final String mFocusedWindowName;
            @NonNull
            final EditorInfo mEditorInfo;
            @NonNull
            final String mRequestWindowName;


            Entry(ClientState client, String focusedWindow, @SoftInputModeFlags int softInputMode,
            Entry(ClientState client, EditorInfo editorInfo, String focusedWindowName,
                    @SoftInputShowHideReason int reason, boolean show) {
                    @SoftInputModeFlags int softInputMode, @SoftInputShowHideReason int reason,
                    boolean inFullscreenMode, String requestWindowName) {
                mClientState = client;
                mClientState = client;
                mFocusedWindowString = focusedWindow;
                mEditorInfo = editorInfo;
                mFocusedWindowName = focusedWindowName;
                mFocusedWindowSoftInputMode = softInputMode;
                mFocusedWindowSoftInputMode = softInputMode;
                mReason = reason;
                mReason = reason;
                mRequestShowKeyboard = show;
                mTimestamp = SystemClock.uptimeMillis();
                mTimestamp = SystemClock.uptimeMillis();
                mWallTime = System.currentTimeMillis();
                mWallTime = System.currentTimeMillis();
                mInFullscreenMode = inFullscreenMode;
                mRequestWindowName = requestWindowName;
            }
            }
        }
        }


@@ -823,13 +829,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                        + " (timestamp=" + entry.mTimestamp + ")");
                        + " (timestamp=" + entry.mTimestamp + ")");


                pw.print(prefix);
                pw.print(prefix);
                pw.print(" requestShowKeyboard=" + entry.mRequestShowKeyboard);
                pw.print(" reason=" + InputMethodDebug.softInputDisplayReasonToString(
                pw.print(" targetDisplayId=" + entry.mTargetDisplayId);
                        entry.mReason));
                pw.println(" reason=" + entry.mReason);
                pw.println(" inFullscreenMode=" + entry.mInFullscreenMode);

                pw.print(prefix);
                pw.println(" requestClient=" + entry.mClientState);

                pw.print(prefix);
                pw.println(" focusedWindowName=" + entry.mFocusedWindowName);

                pw.print(prefix);
                pw.println(" requestWindowName=" + entry.mRequestWindowName);


                pw.print(prefix);
                pw.print(prefix);
                pw.print(" requestClient=" + entry.mClientState);
                pw.print(" editorInfo: ");
                pw.println(" focusedWindow=" + entry.mFocusedWindowString);
                pw.print(" inputType=" + entry.mEditorInfo.inputType);
                pw.print(" privateImeOptions=" + entry.mEditorInfo.privateImeOptions);
                pw.println(" fieldId (viewId)=" + entry.mEditorInfo.fieldId);


                pw.print(prefix);
                pw.print(prefix);
                pw.println(" focusedWindowSoftInputMode=" + InputMethodDebug.softInputModeToString(
                pw.println(" focusedWindowSoftInputMode=" + InputMethodDebug.softInputModeToString(
@@ -4012,10 +4029,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                            + InputMethodDebug.softInputDisplayReasonToString(reason));
                            + InputMethodDebug.softInputDisplayReasonToString(reason));
                    ((IInputMethod) args.arg1).showSoftInput(
                    ((IInputMethod) args.arg1).showSoftInput(
                            (IBinder) args.arg3, msg.arg1, (ResultReceiver) args.arg2);
                            (IBinder) args.arg3, msg.arg1, (ResultReceiver) args.arg2);
                    mSoftInputShowHideHistory.addEntry(
                    mSoftInputShowHideHistory.addEntry(new SoftInputShowHideHistory.Entry(
                            new SoftInputShowHideHistory.Entry(mCurClient,
                            mCurClient, mCurAttribute,
                                    InputMethodDebug.objToString(mCurFocusedWindow),
                            mWindowManagerInternal.getWindowName(mCurFocusedWindow),
                                    mCurFocusedWindowSoftInputMode, reason, true /* show */));
                            mCurFocusedWindowSoftInputMode, reason, mInFullscreenMode,
                            mWindowManagerInternal.getWindowName(
                                    mShowRequestWindowMap.get(args.arg3))));
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                }
                }
                args.recycle();
                args.recycle();
@@ -4029,10 +4048,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                            + InputMethodDebug.softInputDisplayReasonToString(reason));
                            + InputMethodDebug.softInputDisplayReasonToString(reason));
                    ((IInputMethod)args.arg1).hideSoftInput(
                    ((IInputMethod)args.arg1).hideSoftInput(
                            (IBinder) args.arg3, 0, (ResultReceiver)args.arg2);
                            (IBinder) args.arg3, 0, (ResultReceiver)args.arg2);
                    mSoftInputShowHideHistory.addEntry(
                    mSoftInputShowHideHistory.addEntry(new SoftInputShowHideHistory.Entry(
                            new SoftInputShowHideHistory.Entry(mCurClient,
                            mCurClient, mCurAttribute,
                                    InputMethodDebug.objToString(mCurFocusedWindow),
                            mWindowManagerInternal.getWindowName(mCurFocusedWindow),
                                    mCurFocusedWindowSoftInputMode, reason, false /* show */));
                            mCurFocusedWindowSoftInputMode, reason, mInFullscreenMode,
                            mWindowManagerInternal.getWindowName(
                                    mHideRequestWindowMap.get(args.arg3))));
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                }
                }
                args.recycle();
                args.recycle();
+9 −0
Original line number Original line Diff line number Diff line
@@ -577,4 +577,13 @@ public abstract class WindowManagerInternal {
     */
     */
    public abstract boolean transferTouchFocusToImeWindow(@NonNull IBinder sourceInputToken,
    public abstract boolean transferTouchFocusToImeWindow(@NonNull IBinder sourceInputToken,
            int displayId);
            int displayId);

    /**
     *
     * Returns the window name associated to the given binder.
     *
     * @param binder The {@link IBinder} object
     * @return The corresponding {@link WindowState#getName()}
     */
    public abstract String getWindowName(@NonNull IBinder binder);
}
}
+8 −0
Original line number Original line Diff line number Diff line
@@ -7587,6 +7587,14 @@ public class WindowManagerService extends IWindowManager.Stub


            return mInputManager.transferTouchFocus(sourceInputToken, destinationInputToken);
            return mInputManager.transferTouchFocus(sourceInputToken, destinationInputToken);
        }
        }

        @Override
        public String getWindowName(@NonNull IBinder binder) {
            synchronized (mGlobalLock) {
                final WindowState w = mWindowMap.get(binder);
                return w != null ? w.getName() : null;
            }
        }
    }
    }


    void registerAppFreezeListener(AppFreezeListener listener) {
    void registerAppFreezeListener(AppFreezeListener listener) {