Add empty addTransactionCommittedListener for StubTransaction

To avoid calling real method which may run the listener on a dead
handler which was terminated by test. That crashes the test process.

(TransitionTests#testFixedRotationOpen uses the stub transaction
to onRotationTransactionReady -> addTransactionCommittedListener)

Bug: 221223435
Test: atest TransitionTests
Change-Id: Ie967814cebf8f33563184c6a98ed4e670e7a8056
This commit is contained in:
Riddle Hsu
2022-03-03 15:54:19 +08:00
parent 4fa92e4aec
commit 0b7566676b

View File

@@ -28,6 +28,8 @@ import android.view.InputWindowHandle;
import android.view.Surface;
import android.view.SurfaceControl;
import java.util.concurrent.Executor;
/**
* Stubbed {@link android.view.SurfaceControl.Transaction} class that can be used when unit
* testing to avoid calls to native code.
@@ -218,6 +220,12 @@ public class StubTransaction extends SurfaceControl.Transaction {
return this;
}
@Override
public SurfaceControl.Transaction addTransactionCommittedListener(Executor executor,
SurfaceControl.TransactionCommittedListener listener) {
return this;
}
@Override
public SurfaceControl.Transaction syncInputWindows() {
return this;