Merge "Add IME {insets control, IME-WM} target to History" into rvc-dev am: fde28a6f47 am: ecb85a1a60 am: 259291c795

Change-Id: I0f9def245a27869e0810a49f66ff1d3a5e6dbfe3
This commit is contained in:
TreeHugger Robot
2020-05-28 04:24:23 +00:00
committed by Automerger Merge Worker
3 changed files with 71 additions and 3 deletions

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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) {