Merge "Ignore empty frames in ime-controller." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ec78cc5b90
@@ -178,6 +178,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
ValueAnimator mAnimation = null;
|
ValueAnimator mAnimation = null;
|
||||||
int mRotation = Surface.ROTATION_0;
|
int mRotation = Surface.ROTATION_0;
|
||||||
boolean mImeShowing = false;
|
boolean mImeShowing = false;
|
||||||
|
final Rect mImeFrame = new Rect();
|
||||||
|
|
||||||
PerDisplay(int displayId, int initialRotation) {
|
PerDisplay(int displayId, int initialRotation) {
|
||||||
mDisplayId = displayId;
|
mDisplayId = displayId;
|
||||||
@@ -254,8 +255,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int imeTop(InsetsSource imeSource, float surfaceOffset) {
|
private int imeTop(float surfaceOffset) {
|
||||||
return imeSource.getFrame().top + (int) surfaceOffset;
|
return mImeFrame.top + (int) surfaceOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startAnimation(final boolean show, final boolean forceRestart) {
|
private void startAnimation(final boolean show, final boolean forceRestart) {
|
||||||
@@ -263,6 +264,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
if (imeSource == null || mImeSourceControl == null) {
|
if (imeSource == null || mImeSourceControl == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Set frame, but only if the new frame isn't empty -- this maintains continuity
|
||||||
|
final Rect newFrame = imeSource.getFrame();
|
||||||
|
if (newFrame.height() != 0) {
|
||||||
|
mImeFrame.set(newFrame);
|
||||||
|
}
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "Run startAnim show:" + show + " was:"
|
Slog.d(TAG, "Run startAnim show:" + show + " was:"
|
||||||
@@ -284,7 +290,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
}
|
}
|
||||||
final float defaultY = mImeSourceControl.getSurfacePosition().y;
|
final float defaultY = mImeSourceControl.getSurfacePosition().y;
|
||||||
final float x = mImeSourceControl.getSurfacePosition().x;
|
final float x = mImeSourceControl.getSurfacePosition().x;
|
||||||
final float hiddenY = defaultY + imeSource.getFrame().height();
|
final float hiddenY = defaultY + mImeFrame.height();
|
||||||
final float shownY = defaultY;
|
final float shownY = defaultY;
|
||||||
final float startY = show ? hiddenY : shownY;
|
final float startY = show ? hiddenY : shownY;
|
||||||
final float endY = show ? shownY : hiddenY;
|
final float endY = show ? shownY : hiddenY;
|
||||||
@@ -306,7 +312,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
SurfaceControl.Transaction t = mTransactionPool.acquire();
|
SurfaceControl.Transaction t = mTransactionPool.acquire();
|
||||||
float value = (float) animation.getAnimatedValue();
|
float value = (float) animation.getAnimatedValue();
|
||||||
t.setPosition(mImeSourceControl.getLeash(), x, value);
|
t.setPosition(mImeSourceControl.getLeash(), x, value);
|
||||||
dispatchPositionChanged(mDisplayId, imeTop(imeSource, value), t);
|
dispatchPositionChanged(mDisplayId, imeTop(value), t);
|
||||||
t.apply();
|
t.apply();
|
||||||
mTransactionPool.release(t);
|
mTransactionPool.release(t);
|
||||||
});
|
});
|
||||||
@@ -319,11 +325,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
t.setPosition(mImeSourceControl.getLeash(), x, startY);
|
t.setPosition(mImeSourceControl.getLeash(), x, startY);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "onAnimationStart d:" + mDisplayId + " top:"
|
Slog.d(TAG, "onAnimationStart d:" + mDisplayId + " top:"
|
||||||
+ imeTop(imeSource, hiddenY) + "->" + imeTop(imeSource, shownY)
|
+ imeTop(hiddenY) + "->" + imeTop(shownY)
|
||||||
+ " showing:" + (mAnimationDirection == DIRECTION_SHOW));
|
+ " showing:" + (mAnimationDirection == DIRECTION_SHOW));
|
||||||
}
|
}
|
||||||
dispatchStartPositioning(mDisplayId, imeTop(imeSource, hiddenY),
|
dispatchStartPositioning(mDisplayId, imeTop(hiddenY),
|
||||||
imeTop(imeSource, shownY), mAnimationDirection == DIRECTION_SHOW,
|
imeTop(shownY), mAnimationDirection == DIRECTION_SHOW,
|
||||||
t);
|
t);
|
||||||
if (mAnimationDirection == DIRECTION_SHOW) {
|
if (mAnimationDirection == DIRECTION_SHOW) {
|
||||||
t.show(mImeSourceControl.getLeash());
|
t.show(mImeSourceControl.getLeash());
|
||||||
|
|||||||
Reference in New Issue
Block a user