Merge "Fix IME not shown from recents to split-screen task" into tm-qpr-dev
This commit is contained in:
@@ -274,29 +274,30 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
||||
}
|
||||
|
||||
if (hasImeSourceControl) {
|
||||
final Point lastSurfacePosition = mImeSourceControl != null
|
||||
? mImeSourceControl.getSurfacePosition() : null;
|
||||
final boolean positionChanged =
|
||||
!imeSourceControl.getSurfacePosition().equals(lastSurfacePosition);
|
||||
final boolean leashChanged =
|
||||
!haveSameLeash(mImeSourceControl, imeSourceControl);
|
||||
if (mAnimation != null) {
|
||||
final Point lastSurfacePosition = hadImeSourceControl
|
||||
? mImeSourceControl.getSurfacePosition() : null;
|
||||
final boolean positionChanged =
|
||||
!imeSourceControl.getSurfacePosition().equals(lastSurfacePosition);
|
||||
if (positionChanged) {
|
||||
startAnimation(mImeShowing, true /* forceRestart */);
|
||||
}
|
||||
} else {
|
||||
if (leashChanged) {
|
||||
if (!haveSameLeash(mImeSourceControl, imeSourceControl)) {
|
||||
applyVisibilityToLeash(imeSourceControl);
|
||||
}
|
||||
if (!mImeShowing) {
|
||||
removeImeSurface();
|
||||
}
|
||||
if (mImeSourceControl != null) {
|
||||
mImeSourceControl.release(SurfaceControl::release);
|
||||
}
|
||||
}
|
||||
mImeSourceControl = imeSourceControl;
|
||||
} else if (mAnimation != null) {
|
||||
mAnimation.cancel();
|
||||
}
|
||||
|
||||
if (hadImeSourceControl && mImeSourceControl != imeSourceControl) {
|
||||
mImeSourceControl.release(SurfaceControl::release);
|
||||
}
|
||||
mImeSourceControl = imeSourceControl;
|
||||
}
|
||||
|
||||
private void applyVisibilityToLeash(InsetsSourceControl imeSourceControl) {
|
||||
|
||||
@@ -22,6 +22,8 @@ import static android.view.Surface.ROTATION_0;
|
||||
import static android.view.WindowInsets.Type.ime;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -131,6 +133,15 @@ public class DisplayImeControllerTest extends ShellTestCase {
|
||||
verify(mT).show(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insetsControlChanged_updateImeSourceControl() {
|
||||
mPerDisplay.insetsControlChanged(insetsStateWithIme(false), insetsSourceControl());
|
||||
assertNotNull(mPerDisplay.mImeSourceControl);
|
||||
|
||||
mPerDisplay.insetsControlChanged(new InsetsState(), new InsetsSourceControl[]{});
|
||||
assertNull(mPerDisplay.mImeSourceControl);
|
||||
}
|
||||
|
||||
private InsetsSourceControl[] insetsSourceControl() {
|
||||
return new InsetsSourceControl[]{
|
||||
new InsetsSourceControl(
|
||||
|
||||
Reference in New Issue
Block a user