Merge "Prevent unnecessary updateRequestedState" into rvc-dev am: d8bb9b4dd8

Change-Id: Iee16e96691ac379546141542885807249367dfb5
This commit is contained in:
Tiger Huang
2020-05-08 13:40:33 +00:00
committed by Automerger Merge Worker

View File

@@ -667,7 +667,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
if (hideTypes[0] != 0) { if (hideTypes[0] != 0) {
applyAnimation(hideTypes[0], false /* show */, false /* fromIme */); applyAnimation(hideTypes[0], false /* show */, false /* fromIme */);
} }
if (hasControl) { if (hasControl && mRequestedState.getSourcesCount() > 0) {
// We might have changed our requested visibilities while we don't have the control, // We might have changed our requested visibilities while we don't have the control,
// so we need to update our requested state once we have control. Otherwise, our // so we need to update our requested state once we have control. Otherwise, our
// requested state at the server side might be incorrect. // requested state at the server side might be incorrect.
@@ -1065,9 +1065,16 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
if (consumer.getControl() != null) { if (consumer.getControl() != null) {
final InsetsSource localSource = mState.getSource(type); final InsetsSource localSource = mState.getSource(type);
if (!localSource.equals(mRequestedState.peekSource(type))) { if (!localSource.equals(mRequestedState.peekSource(type))) {
// Our requested state is stale. Update it here and send it to window manager.
mRequestedState.addSource(new InsetsSource(localSource)); mRequestedState.addSource(new InsetsSource(localSource));
changed = true; changed = true;
} }
if (!localSource.equals(mLastDispatchedState.peekSource(type))) {
// The server state is not what we expected. This can happen while we don't have
// the control. Since we have the control now, we need to send our request again
// to modify the server state.
changed = true;
}
} }
} }
if (!changed) { if (!changed) {