2626#include < gui/ISurfaceComposer.h>
2727#include < gui/LayerState.h>
2828#include < gui/SchedulingPolicy.h>
29- #include < gui/TransactionState.h>
3029#include < private/gui/ParcelUtils.h>
3130#include < stdint.h>
3231#include < sys/types.h>
@@ -61,12 +60,54 @@ class BpSurfaceComposer : public BpInterface<ISurfaceComposer>
6160
6261 virtual ~BpSurfaceComposer ();
6362
64- status_t setTransactionState (TransactionState&& state) override {
63+ status_t setTransactionState (
64+ const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& state,
65+ Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
66+ InputWindowCommands commands, int64_t desiredPresentTime, bool isAutoTimestamp,
67+ const std::vector<client_cache_t >& uncacheBuffers, bool hasListenerCallbacks,
68+ const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId,
69+ const std::vector<uint64_t >& mergedTransactionIds) override {
6570 Parcel data, reply;
6671 data.writeInterfaceToken (ISurfaceComposer::getInterfaceDescriptor ());
67- SAFE_PARCEL (state.writeToParcel , &data);
6872
69- if (state.mFlags & ISurfaceComposer::eOneWay) {
73+ frameTimelineInfo.writeToParcel (&data);
74+
75+ SAFE_PARCEL (data.writeUint32 , static_cast <uint32_t >(state.size ()));
76+ for (const auto & s : state) {
77+ SAFE_PARCEL (s.write , data);
78+ }
79+
80+ SAFE_PARCEL (data.writeUint32 , static_cast <uint32_t >(displays.size ()));
81+ for (const auto & d : displays) {
82+ SAFE_PARCEL (d.write , data);
83+ }
84+
85+ SAFE_PARCEL (data.writeUint32 , flags);
86+ SAFE_PARCEL (data.writeStrongBinder , applyToken);
87+ SAFE_PARCEL (commands.write , data);
88+ SAFE_PARCEL (data.writeInt64 , desiredPresentTime);
89+ SAFE_PARCEL (data.writeBool , isAutoTimestamp);
90+ SAFE_PARCEL (data.writeUint32 , static_cast <uint32_t >(uncacheBuffers.size ()));
91+ for (const client_cache_t & uncacheBuffer : uncacheBuffers) {
92+ SAFE_PARCEL (data.writeStrongBinder , uncacheBuffer.token .promote ());
93+ SAFE_PARCEL (data.writeUint64 , uncacheBuffer.id );
94+ }
95+ SAFE_PARCEL (data.writeBool , hasListenerCallbacks);
96+
97+ SAFE_PARCEL (data.writeVectorSize , listenerCallbacks);
98+ for (const auto & [listener, callbackIds] : listenerCallbacks) {
99+ SAFE_PARCEL (data.writeStrongBinder , listener);
100+ SAFE_PARCEL (data.writeParcelableVector , callbackIds);
101+ }
102+
103+ SAFE_PARCEL (data.writeUint64 , transactionId);
104+
105+ SAFE_PARCEL (data.writeUint32 , static_cast <uint32_t >(mergedTransactionIds.size ()));
106+ for (auto mergedTransactionId : mergedTransactionIds) {
107+ SAFE_PARCEL (data.writeUint64 , mergedTransactionId);
108+ }
109+
110+ if (flags & ISurfaceComposer::eOneWay) {
70111 return remote ()->transact (BnSurfaceComposer::SET_TRANSACTION_STATE,
71112 data, &reply, IBinder::FLAG_ONEWAY);
72113 } else {
@@ -91,9 +132,75 @@ status_t BnSurfaceComposer::onTransact(
91132 case SET_TRANSACTION_STATE: {
92133 CHECK_INTERFACE (ISurfaceComposer, data, reply);
93134
94- TransactionState state;
95- SAFE_PARCEL (state.readFromParcel , &data);
96- return setTransactionState (std::move (state));
135+ FrameTimelineInfo frameTimelineInfo;
136+ frameTimelineInfo.readFromParcel (&data);
137+
138+ uint32_t count = 0 ;
139+ SAFE_PARCEL_READ_SIZE (data.readUint32 , &count, data.dataSize ());
140+ Vector<ComposerState> state;
141+ state.setCapacity (count);
142+ for (size_t i = 0 ; i < count; i++) {
143+ ComposerState s;
144+ SAFE_PARCEL (s.read , data);
145+ state.add (s);
146+ }
147+
148+ SAFE_PARCEL_READ_SIZE (data.readUint32 , &count, data.dataSize ());
149+ DisplayState d;
150+ Vector<DisplayState> displays;
151+ displays.setCapacity (count);
152+ for (size_t i = 0 ; i < count; i++) {
153+ SAFE_PARCEL (d.read , data);
154+ displays.add (d);
155+ }
156+
157+ uint32_t stateFlags = 0 ;
158+ SAFE_PARCEL (data.readUint32 , &stateFlags);
159+ sp<IBinder> applyToken;
160+ SAFE_PARCEL (data.readStrongBinder , &applyToken);
161+ InputWindowCommands inputWindowCommands;
162+ SAFE_PARCEL (inputWindowCommands.read , data);
163+
164+ int64_t desiredPresentTime = 0 ;
165+ bool isAutoTimestamp = true ;
166+ SAFE_PARCEL (data.readInt64 , &desiredPresentTime);
167+ SAFE_PARCEL (data.readBool , &isAutoTimestamp);
168+
169+ SAFE_PARCEL_READ_SIZE (data.readUint32 , &count, data.dataSize ());
170+ std::vector<client_cache_t > uncacheBuffers (count);
171+ sp<IBinder> tmpBinder;
172+ for (size_t i = 0 ; i < count; i++) {
173+ SAFE_PARCEL (data.readNullableStrongBinder , &tmpBinder);
174+ uncacheBuffers[i].token = tmpBinder;
175+ SAFE_PARCEL (data.readUint64 , &uncacheBuffers[i].id );
176+ }
177+
178+ bool hasListenerCallbacks = false ;
179+ SAFE_PARCEL (data.readBool , &hasListenerCallbacks);
180+
181+ std::vector<ListenerCallbacks> listenerCallbacks;
182+ int32_t listenersSize = 0 ;
183+ SAFE_PARCEL_READ_SIZE (data.readInt32 , &listenersSize, data.dataSize ());
184+ for (int32_t i = 0 ; i < listenersSize; i++) {
185+ SAFE_PARCEL (data.readStrongBinder , &tmpBinder);
186+ std::vector<CallbackId> callbackIds;
187+ SAFE_PARCEL (data.readParcelableVector , &callbackIds);
188+ listenerCallbacks.emplace_back (tmpBinder, callbackIds);
189+ }
190+
191+ uint64_t transactionId = -1 ;
192+ SAFE_PARCEL (data.readUint64 , &transactionId);
193+
194+ SAFE_PARCEL_READ_SIZE (data.readUint32 , &count, data.dataSize ());
195+ std::vector<uint64_t > mergedTransactions (count);
196+ for (size_t i = 0 ; i < count; i++) {
197+ SAFE_PARCEL (data.readUint64 , &mergedTransactions[i]);
198+ }
199+
200+ return setTransactionState (frameTimelineInfo, state, displays, stateFlags, applyToken,
201+ std::move (inputWindowCommands), desiredPresentTime,
202+ isAutoTimestamp, uncacheBuffers, hasListenerCallbacks,
203+ listenerCallbacks, transactionId, mergedTransactions);
97204 }
98205 case GET_SCHEDULING_POLICY: {
99206 gui::SchedulingPolicy policy;
0 commit comments