Merge "Fix focus cleared and password keyboard shown during IME switching" into rvc-dev
This commit is contained in:
@@ -166,11 +166,18 @@ class InsetsSourceProvider {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTmpRect.set(mWin.getFrameLw());
|
// Make sure we set the valid source frame only when server visible is true, because the
|
||||||
if (mFrameProvider != null) {
|
// frame may not yet determined that server side doesn't think the window is ready to
|
||||||
mFrameProvider.accept(mWin.getDisplayContent().mDisplayFrames, mWin, mTmpRect);
|
// visible. (i.e. No surface, pending insets that were given during layout, etc..)
|
||||||
|
if (mServerVisible) {
|
||||||
|
mTmpRect.set(mWin.getFrameLw());
|
||||||
|
if (mFrameProvider != null) {
|
||||||
|
mFrameProvider.accept(mWin.getDisplayContent().mDisplayFrames, mWin, mTmpRect);
|
||||||
|
} else {
|
||||||
|
mTmpRect.inset(mWin.mGivenContentInsets);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mTmpRect.inset(mWin.mGivenContentInsets);
|
mTmpRect.setEmpty();
|
||||||
}
|
}
|
||||||
mSource.setFrame(mTmpRect);
|
mSource.setFrame(mTmpRect);
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
package com.android.server.wm;
|
package com.android.server.wm;
|
||||||
|
|
||||||
|
import static android.view.InsetsState.ITYPE_IME;
|
||||||
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||||
|
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
@@ -44,12 +46,17 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
|
|||||||
|
|
||||||
private InsetsSource mSource = new InsetsSource(ITYPE_STATUS_BAR);
|
private InsetsSource mSource = new InsetsSource(ITYPE_STATUS_BAR);
|
||||||
private InsetsSourceProvider mProvider;
|
private InsetsSourceProvider mProvider;
|
||||||
|
private InsetsSource mImeSource = new InsetsSource(ITYPE_IME);
|
||||||
|
private InsetsSourceProvider mImeProvider;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
mSource.setVisible(true);
|
mSource.setVisible(true);
|
||||||
mProvider = new InsetsSourceProvider(mSource,
|
mProvider = new InsetsSourceProvider(mSource,
|
||||||
mDisplayContent.getInsetsStateController(), mDisplayContent);
|
mDisplayContent.getInsetsStateController(), mDisplayContent);
|
||||||
|
mProvider.setServerVisible(true);
|
||||||
|
mImeProvider = new InsetsSourceProvider(mImeSource,
|
||||||
|
mDisplayContent.getInsetsStateController(), mDisplayContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -165,6 +172,30 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
|
|||||||
assertNull(mProvider.getControl(target));
|
assertNull(mProvider.getControl(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateSourceFrameForIme() {
|
||||||
|
final WindowState inputMethod = createWindow(null, TYPE_INPUT_METHOD, "inputMethod");
|
||||||
|
|
||||||
|
inputMethod.getFrameLw().set(new Rect(0, 400, 500, 500));
|
||||||
|
|
||||||
|
mImeProvider.setWindow(inputMethod, null, null);
|
||||||
|
mImeProvider.setServerVisible(false);
|
||||||
|
mImeSource.setVisible(true);
|
||||||
|
mImeProvider.updateSourceFrame();
|
||||||
|
assertEquals(new Rect(0, 0, 0, 0), mImeSource.getFrame());
|
||||||
|
Insets insets = mImeSource.calculateInsets(new Rect(0, 0, 500, 500),
|
||||||
|
false /* ignoreVisibility */);
|
||||||
|
assertEquals(Insets.of(0, 0, 0, 0), insets);
|
||||||
|
|
||||||
|
mImeProvider.setServerVisible(true);
|
||||||
|
mImeSource.setVisible(true);
|
||||||
|
mImeProvider.updateSourceFrame();
|
||||||
|
assertEquals(inputMethod.getFrameLw(), mImeSource.getFrame());
|
||||||
|
insets = mImeSource.calculateInsets(new Rect(0, 0, 500, 500),
|
||||||
|
false /* ignoreVisibility */);
|
||||||
|
assertEquals(Insets.of(0, 0, 0, 100), insets);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInsetsModified() {
|
public void testInsetsModified() {
|
||||||
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
||||||
|
|||||||
Reference in New Issue
Block a user