Merge "DisplayImeController: reapply visibility when leash changes" into rvc-qpr-dev
This commit is contained in:
@@ -228,19 +228,43 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
final Point lastSurfacePosition = mImeSourceControl != null
|
final Point lastSurfacePosition = mImeSourceControl != null
|
||||||
? mImeSourceControl.getSurfacePosition() : null;
|
? mImeSourceControl.getSurfacePosition() : null;
|
||||||
|
final boolean positionChanged =
|
||||||
|
!activeControl.getSurfacePosition().equals(lastSurfacePosition);
|
||||||
|
final boolean leashChanged =
|
||||||
|
!haveSameLeash(mImeSourceControl, activeControl);
|
||||||
mImeSourceControl = activeControl;
|
mImeSourceControl = activeControl;
|
||||||
if (!activeControl.getSurfacePosition().equals(lastSurfacePosition)
|
if (mAnimation != null) {
|
||||||
&& mAnimation != null) {
|
if (positionChanged) {
|
||||||
startAnimation(mImeShowing, true /* forceRestart */);
|
startAnimation(mImeShowing, true /* forceRestart */);
|
||||||
} else if (!mImeShowing) {
|
}
|
||||||
|
} else {
|
||||||
|
if (leashChanged) {
|
||||||
|
applyVisibilityToLeash();
|
||||||
|
}
|
||||||
|
if (!mImeShowing) {
|
||||||
removeImeSurface();
|
removeImeSurface();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyVisibilityToLeash() {
|
||||||
|
SurfaceControl leash = mImeSourceControl.getLeash();
|
||||||
|
if (leash != null) {
|
||||||
|
SurfaceControl.Transaction t = mTransactionPool.acquire();
|
||||||
|
if (mImeShowing) {
|
||||||
|
t.show(leash);
|
||||||
|
} else {
|
||||||
|
t.hide(leash);
|
||||||
|
}
|
||||||
|
t.apply();
|
||||||
|
mTransactionPool.release(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showInsets(int types, boolean fromIme) {
|
public void showInsets(int types, boolean fromIme) {
|
||||||
if ((types & WindowInsets.Type.ime()) == 0) {
|
if ((types & WindowInsets.Type.ime()) == 0) {
|
||||||
@@ -492,4 +516,20 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
return IInputMethodManager.Stub.asInterface(
|
return IInputMethodManager.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.INPUT_METHOD_SERVICE));
|
ServiceManager.getService(Context.INPUT_METHOD_SERVICE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean haveSameLeash(InsetsSourceControl a, InsetsSourceControl b) {
|
||||||
|
if (a == b) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (a == null || b == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (a.getLeash() == b.getLeash()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (a.getLeash() == null || b.getLeash() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return a.getLeash().isSameSurface(b.getLeash());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6187,7 +6187,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
if (inputMethodControlTarget != null) {
|
if (inputMethodControlTarget != null) {
|
||||||
pw.print(" inputMethodControlTarget in display# "); pw.print(displayId);
|
pw.print(" inputMethodControlTarget in display# "); pw.print(displayId);
|
||||||
pw.print(' '); pw.println(inputMethodControlTarget.getWindow());
|
pw.print(' '); pw.println(inputMethodControlTarget);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
pw.print(" mInTouchMode="); pw.println(mInTouchMode);
|
pw.print(" mInTouchMode="); pw.println(mInTouchMode);
|
||||||
|
|||||||
Reference in New Issue
Block a user