Loading core/java/android/view/InsetsAnimationControlImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll if (leash != null) { // TODO: use a better interpolation for fade. alpha = mFade ? ((float) maxInset / inset * 0.3f + 0.7f) : alpha; surfaceParams.add(new SurfaceParams(leash, alpha, mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, surfaceParams.add(new SurfaceParams(leash, side == ISIDE_FLOATING ? 1 : alpha, mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, side == ISIDE_FLOATING ? state.getSource(source.getType()).isVisible() : inset != 0 /* visible */)); } Loading core/java/android/view/InsetsSource.java +8 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static android.view.InsetsState.ITYPE_IME; import android.annotation.Nullable; import android.graphics.Insets; import android.graphics.Rect; Loading Loading @@ -109,6 +111,12 @@ public class InsetsSource implements Parcelable { return Insets.NONE; } // TODO: Currently, non-floating IME always intersects at bottom due to issues with cutout. // However, we should let the policy decide from the server. if (getType() == ITYPE_IME) { return Insets.of(0, 0, 0, mTmpFrame.height()); } // Intersecting at top/bottom if (mTmpFrame.width() == relativeFrame.width()) { if (mTmpFrame.top == relativeFrame.top) { Loading core/tests/coretests/src/android/view/InsetsSourceTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import static android.view.InsetsState.ITYPE_IME; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static org.junit.Assert.assertEquals; Loading Loading @@ -44,10 +45,12 @@ import org.junit.runner.RunWith; public class InsetsSourceTest { private InsetsSource mSource = new InsetsSource(ITYPE_NAVIGATION_BAR); private InsetsSource mImeSource = new InsetsSource(ITYPE_IME); @Before public void setUp() { mSource.setVisible(true); mImeSource.setVisible(true); } @Test Loading Loading @@ -90,6 +93,14 @@ public class InsetsSourceTest { assertEquals(Insets.of(0, 100, 0, 0), insets); } @Test public void testCalculateInsets_ime_leftCutout() { mImeSource.setFrame(new Rect(100, 400, 500, 500)); Insets insets = mImeSource.calculateInsets(new Rect(0, 0, 500, 500), false /* ignoreVisibility */); assertEquals(Insets.of(0, 0, 0, 100), insets); } @Test public void testCalculateInsets_invisible() { mSource.setFrame(new Rect(0, 0, 500, 100)); Loading Loading
core/java/android/view/InsetsAnimationControlImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll if (leash != null) { // TODO: use a better interpolation for fade. alpha = mFade ? ((float) maxInset / inset * 0.3f + 0.7f) : alpha; surfaceParams.add(new SurfaceParams(leash, alpha, mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, surfaceParams.add(new SurfaceParams(leash, side == ISIDE_FLOATING ? 1 : alpha, mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, side == ISIDE_FLOATING ? state.getSource(source.getType()).isVisible() : inset != 0 /* visible */)); } Loading
core/java/android/view/InsetsSource.java +8 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static android.view.InsetsState.ITYPE_IME; import android.annotation.Nullable; import android.graphics.Insets; import android.graphics.Rect; Loading Loading @@ -109,6 +111,12 @@ public class InsetsSource implements Parcelable { return Insets.NONE; } // TODO: Currently, non-floating IME always intersects at bottom due to issues with cutout. // However, we should let the policy decide from the server. if (getType() == ITYPE_IME) { return Insets.of(0, 0, 0, mTmpFrame.height()); } // Intersecting at top/bottom if (mTmpFrame.width() == relativeFrame.width()) { if (mTmpFrame.top == relativeFrame.top) { Loading
core/tests/coretests/src/android/view/InsetsSourceTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import static android.view.InsetsState.ITYPE_IME; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static org.junit.Assert.assertEquals; Loading Loading @@ -44,10 +45,12 @@ import org.junit.runner.RunWith; public class InsetsSourceTest { private InsetsSource mSource = new InsetsSource(ITYPE_NAVIGATION_BAR); private InsetsSource mImeSource = new InsetsSource(ITYPE_IME); @Before public void setUp() { mSource.setVisible(true); mImeSource.setVisible(true); } @Test Loading Loading @@ -90,6 +93,14 @@ public class InsetsSourceTest { assertEquals(Insets.of(0, 100, 0, 0), insets); } @Test public void testCalculateInsets_ime_leftCutout() { mImeSource.setFrame(new Rect(100, 400, 500, 500)); Insets insets = mImeSource.calculateInsets(new Rect(0, 0, 500, 500), false /* ignoreVisibility */); assertEquals(Insets.of(0, 0, 0, 100), insets); } @Test public void testCalculateInsets_invisible() { mSource.setFrame(new Rect(0, 0, 500, 100)); Loading