Merge "Don't unset syncId in Transition." into tm-qpr-dev
This commit is contained in:
@@ -149,9 +149,6 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
|
|
||||||
final @TransitionType int mType;
|
final @TransitionType int mType;
|
||||||
private int mSyncId = -1;
|
private int mSyncId = -1;
|
||||||
// Used for tracking a Transition throughout a lifecycle (i.e. from STATE_COLLECTING to
|
|
||||||
// STATE_FINISHED or STATE_ABORT), and should only be used for testing and debugging.
|
|
||||||
private int mDebugId = -1;
|
|
||||||
private @TransitionFlags int mFlags;
|
private @TransitionFlags int mFlags;
|
||||||
private final TransitionController mController;
|
private final TransitionController mController;
|
||||||
private final BLASTSyncEngine mSyncEngine;
|
private final BLASTSyncEngine mSyncEngine;
|
||||||
@@ -295,11 +292,6 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
return mSyncId;
|
return mSyncId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
int getDebugId() {
|
|
||||||
return mDebugId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@TransitionFlags
|
@TransitionFlags
|
||||||
int getFlags() {
|
int getFlags() {
|
||||||
return mFlags;
|
return mFlags;
|
||||||
@@ -315,6 +307,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
return mFinishTransaction;
|
return mFinishTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCollecting() {
|
||||||
|
return mState == STATE_COLLECTING || mState == STATE_STARTED;
|
||||||
|
}
|
||||||
|
|
||||||
/** Starts collecting phase. Once this starts, all relevant surface operations are sync. */
|
/** Starts collecting phase. Once this starts, all relevant surface operations are sync. */
|
||||||
void startCollecting(long timeoutMs) {
|
void startCollecting(long timeoutMs) {
|
||||||
if (mState != STATE_PENDING) {
|
if (mState != STATE_PENDING) {
|
||||||
@@ -322,7 +318,6 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
}
|
}
|
||||||
mState = STATE_COLLECTING;
|
mState = STATE_COLLECTING;
|
||||||
mSyncId = mSyncEngine.startSyncSet(this, timeoutMs, TAG);
|
mSyncId = mSyncEngine.startSyncSet(this, timeoutMs, TAG);
|
||||||
mDebugId = mSyncId;
|
|
||||||
|
|
||||||
mController.mTransitionTracer.logState(this);
|
mController.mTransitionTracer.logState(this);
|
||||||
}
|
}
|
||||||
@@ -353,7 +348,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
if (mState < STATE_COLLECTING) {
|
if (mState < STATE_COLLECTING) {
|
||||||
throw new IllegalStateException("Transition hasn't started collecting.");
|
throw new IllegalStateException("Transition hasn't started collecting.");
|
||||||
}
|
}
|
||||||
if (mSyncId < 0) return;
|
if (!isCollecting()) {
|
||||||
|
// Too late, transition already started playing, so don't collect.
|
||||||
|
return;
|
||||||
|
}
|
||||||
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, "Collecting in transition %d: %s",
|
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, "Collecting in transition %d: %s",
|
||||||
mSyncId, wc);
|
mSyncId, wc);
|
||||||
// "snapshot" all parents (as potential promotion targets). Do this before checking
|
// "snapshot" all parents (as potential promotion targets). Do this before checking
|
||||||
@@ -403,7 +401,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
* or waiting until after the animation to close).
|
* or waiting until after the animation to close).
|
||||||
*/
|
*/
|
||||||
void collectExistenceChange(@NonNull WindowContainer wc) {
|
void collectExistenceChange(@NonNull WindowContainer wc) {
|
||||||
if (mSyncId < 0) return;
|
if (mState >= STATE_PLAYING) {
|
||||||
|
// Too late to collect. Don't check too-early here since `collect` will check that.
|
||||||
|
return;
|
||||||
|
}
|
||||||
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, "Existence Changed in transition %d:"
|
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, "Existence Changed in transition %d:"
|
||||||
+ " %s", mSyncId, wc);
|
+ " %s", mSyncId, wc);
|
||||||
collect(wc);
|
collect(wc);
|
||||||
@@ -437,7 +438,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
*/
|
*/
|
||||||
void setOverrideAnimation(TransitionInfo.AnimationOptions options,
|
void setOverrideAnimation(TransitionInfo.AnimationOptions options,
|
||||||
@Nullable IRemoteCallback startCallback, @Nullable IRemoteCallback finishCallback) {
|
@Nullable IRemoteCallback startCallback, @Nullable IRemoteCallback finishCallback) {
|
||||||
if (mSyncId < 0) return;
|
if (!isCollecting()) return;
|
||||||
mOverrideOptions = options;
|
mOverrideOptions = options;
|
||||||
sendRemoteCallback(mClientAnimationStartCallback);
|
sendRemoteCallback(mClientAnimationStartCallback);
|
||||||
mClientAnimationStartCallback = startCallback;
|
mClientAnimationStartCallback = startCallback;
|
||||||
@@ -455,7 +456,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
* The transition will wait for all groups to be ready.
|
* The transition will wait for all groups to be ready.
|
||||||
*/
|
*/
|
||||||
void setReady(WindowContainer wc, boolean ready) {
|
void setReady(WindowContainer wc, boolean ready) {
|
||||||
if (mSyncId < 0) return;
|
if (!isCollecting() || mSyncId < 0) return;
|
||||||
mReadyTracker.setReadyFrom(wc, ready);
|
mReadyTracker.setReadyFrom(wc, ready);
|
||||||
applyReady();
|
applyReady();
|
||||||
}
|
}
|
||||||
@@ -473,7 +474,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
* @see ReadyTracker#setAllReady.
|
* @see ReadyTracker#setAllReady.
|
||||||
*/
|
*/
|
||||||
void setAllReady() {
|
void setAllReady() {
|
||||||
if (mSyncId < 0) return;
|
if (!isCollecting() || mSyncId < 0) return;
|
||||||
mReadyTracker.setAllReady();
|
mReadyTracker.setAllReady();
|
||||||
applyReady();
|
applyReady();
|
||||||
}
|
}
|
||||||
@@ -889,7 +890,6 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
// No player registered, so just finish/apply immediately
|
// No player registered, so just finish/apply immediately
|
||||||
cleanUpOnFailure();
|
cleanUpOnFailure();
|
||||||
}
|
}
|
||||||
mSyncId = -1;
|
|
||||||
mOverrideOptions = null;
|
mOverrideOptions = null;
|
||||||
|
|
||||||
reportStartReasonsToLogger();
|
reportStartReasonsToLogger();
|
||||||
@@ -1614,7 +1614,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean getLegacyIsReady() {
|
boolean getLegacyIsReady() {
|
||||||
return (mState == STATE_STARTED || mState == STATE_COLLECTING) && mSyncId >= 0;
|
return isCollecting() && mSyncId >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Transition fromBinder(IBinder binder) {
|
static Transition fromBinder(IBinder binder) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class TransitionTracer {
|
|||||||
final ProtoOutputStream outputStream = new ProtoOutputStream();
|
final ProtoOutputStream outputStream = new ProtoOutputStream();
|
||||||
final long transitionEntryToken = outputStream.start(TRANSITION);
|
final long transitionEntryToken = outputStream.start(TRANSITION);
|
||||||
|
|
||||||
outputStream.write(ID, transition.getDebugId());
|
outputStream.write(ID, transition.getSyncId());
|
||||||
outputStream.write(TIMESTAMP, SystemClock.elapsedRealtimeNanos());
|
outputStream.write(TIMESTAMP, SystemClock.elapsedRealtimeNanos());
|
||||||
outputStream.write(TRANSITION_TYPE, transition.mType);
|
outputStream.write(TRANSITION_TYPE, transition.mType);
|
||||||
outputStream.write(STATE, transition.getState());
|
outputStream.write(STATE, transition.getState());
|
||||||
|
|||||||
Reference in New Issue
Block a user