Make SurfaceControl Transaction parcelable 2/2
Allow clients to send SurfaceControl Transactions across processes to
enable more advanced synchronization use cases.
Bug: 132205507
Test: atest SurfaceFlinger_test
Change-Id: I20a33cafc0960e73f9a2c3d740f81319e02b68ff
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index 0e17c7b..1f2947c 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -285,7 +285,7 @@
std::unordered_set<sp<SurfaceControl>, SCHash> surfaceControls;
};
- class Transaction {
+ class Transaction : Parcelable {
std::unordered_map<sp<SurfaceControl>, ComposerState, SCHash> mComposerStates;
SortedVector<DisplayState > mDisplayStates;
std::unordered_map<sp<ITransactionCompletedListener>, CallbackInfo, TCLHash>
@@ -325,6 +325,12 @@
virtual ~Transaction() = default;
Transaction(Transaction const& other);
+ // Factory method that creates a new Transaction instance from the parcel.
+ static std::unique_ptr<Transaction> createFromParcel(const Parcel* parcel);
+
+ status_t writeToParcel(Parcel* parcel) const override;
+ status_t readFromParcel(const Parcel* parcel) override;
+
status_t apply(bool synchronous = false);
// Merge another transaction in to this one, clearing other
// as if it had been applied.