Merge "Re-send the IME control after IME is re-created" into rvc-dev
This commit is contained in:
@@ -73,7 +73,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
|
|||||||
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
|
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
|
||||||
import static android.view.WindowManager.TRANSIT_TASK_OPEN;
|
import static android.view.WindowManager.TRANSIT_TASK_OPEN;
|
||||||
import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;
|
import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;
|
||||||
import static android.window.DisplayAreaOrganizer.FEATURE_DEFAULT_TASK_CONTAINER;
|
|
||||||
|
|
||||||
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
|
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
|
||||||
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
|
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
|
||||||
@@ -199,7 +198,6 @@ import android.view.ViewRootImpl;
|
|||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManagerPolicyConstants.PointerEventListener;
|
import android.view.WindowManagerPolicyConstants.PointerEventListener;
|
||||||
import android.window.ITaskOrganizer;
|
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
@@ -540,6 +538,15 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
*/
|
*/
|
||||||
WindowState mInputMethodTarget;
|
WindowState mInputMethodTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The window which receives input from the input method. This is also a candidate of the
|
||||||
|
* input method control target.
|
||||||
|
*/
|
||||||
|
WindowState mInputMethodInputTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This controls the visibility and animation of the input method window.
|
||||||
|
*/
|
||||||
InsetsControlTarget mInputMethodControlTarget;
|
InsetsControlTarget mInputMethodControlTarget;
|
||||||
|
|
||||||
/** If true hold off on modifying the animation layer of mInputMethodTarget */
|
/** If true hold off on modifying the animation layer of mInputMethodTarget */
|
||||||
@@ -3247,6 +3254,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
mInsetsStateController.getSourceProvider(ITYPE_IME).setWindow(win,
|
mInsetsStateController.getSourceProvider(ITYPE_IME).setWindow(win,
|
||||||
null /* frameProvider */, null /* imeFrameProvider */);
|
null /* frameProvider */, null /* imeFrameProvider */);
|
||||||
computeImeTarget(true /* updateImeTarget */);
|
computeImeTarget(true /* updateImeTarget */);
|
||||||
|
updateImeControlTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3426,8 +3434,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setInputMethodTarget(WindowState target, boolean targetWaitingAnim) {
|
private void setInputMethodTarget(WindowState target, boolean targetWaitingAnim) {
|
||||||
// Always update control target. This is needed to handle rotation.
|
|
||||||
updateImeControlTarget(target);
|
|
||||||
if (target == mInputMethodTarget && mInputMethodTargetWaitingAnim == targetWaitingAnim) {
|
if (target == mInputMethodTarget && mInputMethodTargetWaitingAnim == targetWaitingAnim) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3436,22 +3442,28 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
mInputMethodTargetWaitingAnim = targetWaitingAnim;
|
mInputMethodTargetWaitingAnim = targetWaitingAnim;
|
||||||
assignWindowLayers(false /* setLayoutNeeded */);
|
assignWindowLayers(false /* setLayoutNeeded */);
|
||||||
updateImeParent();
|
updateImeParent();
|
||||||
|
updateImeControlTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IME control target is the window that controls the IME visibility and animation.
|
* The IME input target is the window which receives input from IME. It is also a candidate
|
||||||
* This window is same as the window on which startInput is called.
|
* which controls the visibility and animation of the input method window.
|
||||||
* @param target the window that receives IME control. This is ignored if we aren't attaching
|
|
||||||
* the IME to an app (eg. when in multi-window mode).
|
|
||||||
*
|
*
|
||||||
* @see #getImeControlTarget()
|
* @param target the window that receives input from IME.
|
||||||
*/
|
*/
|
||||||
void updateImeControlTarget(InsetsControlTarget target) {
|
void setInputMethodInputTarget(WindowState target) {
|
||||||
|
if (mInputMethodInputTarget != target) {
|
||||||
|
mInputMethodInputTarget = target;
|
||||||
|
updateImeControlTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateImeControlTarget() {
|
||||||
if (!isImeAttachedToApp() && mRemoteInsetsControlTarget != null) {
|
if (!isImeAttachedToApp() && mRemoteInsetsControlTarget != null) {
|
||||||
mInputMethodControlTarget = mRemoteInsetsControlTarget;
|
mInputMethodControlTarget = mRemoteInsetsControlTarget;
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we just use the ime target
|
// Otherwise, we just use the ime input target
|
||||||
mInputMethodControlTarget = target;
|
mInputMethodControlTarget = mInputMethodInputTarget;
|
||||||
}
|
}
|
||||||
mInsetsStateController.onImeControlTargetChanged(mInputMethodControlTarget);
|
mInsetsStateController.onImeControlTargetChanged(mInputMethodControlTarget);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1697,15 +1697,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
displayContent.getInputMonitor().updateInputWindowsLw(false /*force*/);
|
displayContent.getInputMonitor().updateInputWindowsLw(false /*force*/);
|
||||||
|
|
||||||
getInsetsSourceControls(win, outActiveControls);
|
|
||||||
|
|
||||||
ProtoLog.v(WM_DEBUG_ADD_REMOVE, "addWindow: New client %s"
|
ProtoLog.v(WM_DEBUG_ADD_REMOVE, "addWindow: New client %s"
|
||||||
+ ": window=%s Callers=%s", client.asBinder(), win, Debug.getCallers(5));
|
+ ": window=%s Callers=%s", client.asBinder(), win, Debug.getCallers(5));
|
||||||
|
|
||||||
|
|
||||||
if (win.isVisibleOrAdding() && displayContent.updateOrientation()) {
|
if (win.isVisibleOrAdding() && displayContent.updateOrientation()) {
|
||||||
displayContent.sendNewConfiguration();
|
displayContent.sendNewConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getInsetsSourceControls(win, outActiveControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
@@ -2401,7 +2400,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
outCutout.set(win.getWmDisplayCutout().getDisplayCutout());
|
outCutout.set(win.getWmDisplayCutout().getDisplayCutout());
|
||||||
outBackdropFrame.set(win.getBackdropFrame(win.getFrameLw()));
|
outBackdropFrame.set(win.getBackdropFrame(win.getFrameLw()));
|
||||||
outInsetsState.set(win.getInsetsState(), win.isClientLocal());
|
outInsetsState.set(win.getInsetsState(), win.isClientLocal());
|
||||||
getInsetsSourceControls(win, outActiveControls);
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.v(TAG_WM, "Relayout given client " + client.asBinder()
|
Slog.v(TAG_WM, "Relayout given client " + client.asBinder()
|
||||||
+ ", requestedWidth=" + requestedWidth
|
+ ", requestedWidth=" + requestedWidth
|
||||||
@@ -2432,6 +2430,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
outSurfaceSize.set(winAnimator.mSurfaceController.getWidth(),
|
outSurfaceSize.set(winAnimator.mSurfaceController.getWidth(),
|
||||||
winAnimator.mSurfaceController.getHeight());
|
winAnimator.mSurfaceController.getHeight());
|
||||||
}
|
}
|
||||||
|
getInsetsSourceControls(win, outActiveControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
@@ -6107,10 +6106,15 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
mRoot.forAllDisplays(dc -> {
|
mRoot.forAllDisplays(dc -> {
|
||||||
final int displayId = dc.getDisplayId();
|
final int displayId = dc.getDisplayId();
|
||||||
final WindowState inputMethodTarget = dc.mInputMethodTarget;
|
final WindowState inputMethodTarget = dc.mInputMethodTarget;
|
||||||
|
final WindowState inputMethodInputTarget = dc.mInputMethodInputTarget;
|
||||||
if (inputMethodTarget != null) {
|
if (inputMethodTarget != null) {
|
||||||
pw.print(" mInputMethodTarget in display# "); pw.print(displayId);
|
pw.print(" mInputMethodTarget in display# "); pw.print(displayId);
|
||||||
pw.print(' '); pw.println(inputMethodTarget);
|
pw.print(' '); pw.println(inputMethodTarget);
|
||||||
}
|
}
|
||||||
|
if (inputMethodInputTarget != null) {
|
||||||
|
pw.print(" mInputMethodInputTarget in display# "); pw.print(displayId);
|
||||||
|
pw.print(' '); pw.println(inputMethodInputTarget);
|
||||||
|
}
|
||||||
if (mAccessibilityController != null) {
|
if (mAccessibilityController != null) {
|
||||||
final Region magnificationRegion = new Region();
|
final Region magnificationRegion = new Region();
|
||||||
mAccessibilityController.getMagnificationRegionLocked(displayId,
|
mAccessibilityController.getMagnificationRegionLocked(displayId,
|
||||||
@@ -7362,7 +7366,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
synchronized (mGlobalLock) {
|
synchronized (mGlobalLock) {
|
||||||
final WindowState imeTarget = mWindowMap.get(imeTargetWindowToken);
|
final WindowState imeTarget = mWindowMap.get(imeTargetWindowToken);
|
||||||
if (imeTarget != null) {
|
if (imeTarget != null) {
|
||||||
imeTarget.getDisplayContent().updateImeControlTarget(imeTarget);
|
imeTarget.getDisplayContent().setInputMethodInputTarget(imeTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1469,6 +1469,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onDisplayChanged(DisplayContent dc) {
|
void onDisplayChanged(DisplayContent dc) {
|
||||||
|
if (dc != null && mDisplayContent != null
|
||||||
|
&& mDisplayContent.mInputMethodInputTarget == this) {
|
||||||
|
dc.setInputMethodInputTarget(mDisplayContent.mInputMethodInputTarget);
|
||||||
|
mDisplayContent.mInputMethodInputTarget = null;
|
||||||
|
}
|
||||||
super.onDisplayChanged(dc);
|
super.onDisplayChanged(dc);
|
||||||
// Window was not laid out for this display yet, so make sure mLayoutSeq does not match.
|
// Window was not laid out for this display yet, so make sure mLayoutSeq does not match.
|
||||||
if (dc != null && mInputWindowHandle.displayId != dc.getDisplayId()) {
|
if (dc != null && mInputWindowHandle.displayId != dc.getDisplayId()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user