@@ -294,12 +294,7 @@ void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width,
294294 SurfaceComposerClient::Transaction t;
295295 if (surfaceControlChanged) {
296296#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BUFFER_RELEASE_CHANNEL)
297- // SELinux policy may prevent this process from sending the BufferReleaseChannel's file
298- // descriptor to SurfaceFlinger, causing the entire transaction to be dropped. This
299- // transaction is applied separately to ensure we don't lose the other updates.
300- t.setApplyToken (mApplyToken )
301- .setBufferReleaseChannel (mSurfaceControl , mBufferReleaseProducer )
302- .apply (false /* synchronous */ , true /* oneWay */ );
297+ updateBufferReleaseProducer ();
303298#endif
304299 t.setFlags (mSurfaceControl , layer_state_t ::eEnableBackpressure,
305300 layer_state_t ::eEnableBackpressure);
@@ -1335,6 +1330,20 @@ void BLASTBufferQueue::setApplyToken(sp<IBinder> applyToken) {
13351330
13361331#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BUFFER_RELEASE_CHANNEL)
13371332
1333+ void BLASTBufferQueue::updateBufferReleaseProducer () {
1334+ // SELinux policy may prevent this process from sending the BufferReleaseChannel's file
1335+ // descriptor to SurfaceFlinger, causing the entire transaction to be dropped. We send this
1336+ // transaction independently of any other updates to ensure those updates aren't lost.
1337+ SurfaceComposerClient::Transaction t;
1338+ status_t status = t.setApplyToken (mApplyToken )
1339+ .setBufferReleaseChannel (mSurfaceControl , mBufferReleaseProducer )
1340+ .apply (false /* synchronous */ , true /* oneWay */ );
1341+ if (status != OK) {
1342+ ALOGW (" [%s] %s - failed to set buffer release channel on %s" , mName .c_str (),
1343+ statusToString (status).c_str (), mSurfaceControl ->getName ().c_str ());
1344+ }
1345+ }
1346+
13381347void BLASTBufferQueue::drainBufferReleaseConsumer () {
13391348 ATRACE_CALL ();
13401349 while (true ) {
0 commit comments