@@ -693,11 +693,11 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* ou
693693 .requestorName = {mConsumerName .c_str (), mConsumerName .size ()},
694694 .extras = std::move (tempOptions),
695695 };
696- sp<GraphicBuffer> graphicBuffer = new GraphicBuffer (allocRequest);
696+ sp<GraphicBuffer> graphicBuffer = sp< GraphicBuffer>:: make (allocRequest);
697697#else
698698 sp<GraphicBuffer> graphicBuffer =
699- new GraphicBuffer (width, height, format, BQ_LAYER_COUNT, usage,
700- {mConsumerName .c_str (), mConsumerName .size ()});
699+ sp< GraphicBuffer>:: make (width, height, format, BQ_LAYER_COUNT, usage,
700+ std::string {mConsumerName .c_str (), mConsumerName .size ()});
701701#endif
702702
703703 status_t error = graphicBuffer->initCheck ();
@@ -1464,7 +1464,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener,
14641464#ifndef NO_BINDER
14651465 if (IInterface::asBinder (listener)->remoteBinder () != nullptr ) {
14661466 status = IInterface::asBinder (listener)->linkToDeath (
1467- static_cast <IBinder::DeathRecipient*> (this ));
1467+ sp <IBinder::DeathRecipient>:: fromExisting (this ));
14681468 if (status != NO_ERROR) {
14691469 BQ_LOGE (" connect: linkToDeath failed: %s (%d)" ,
14701470 strerror (-status), status);
@@ -1553,8 +1553,7 @@ status_t BufferQueueProducer::disconnect(int api, DisconnectMode mode) {
15531553 IInterface::asBinder (mCore ->mLinkedToDeath );
15541554 // This can fail if we're here because of the death
15551555 // notification, but we just ignore it
1556- token->unlinkToDeath (
1557- static_cast <IBinder::DeathRecipient*>(this ));
1556+ token->unlinkToDeath (sp<IBinder::DeathRecipient>::fromExisting (this ));
15581557 }
15591558#endif
15601559 mCore ->mSharedBufferSlot =
@@ -1685,11 +1684,11 @@ void BufferQueueProducer::allocateBuffers(uint32_t width, uint32_t height,
16851684#endif
16861685
16871686#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_EXTENDEDALLOCATE)
1688- sp<GraphicBuffer> graphicBuffer = new GraphicBuffer (allocRequest);
1687+ sp<GraphicBuffer> graphicBuffer = sp< GraphicBuffer>:: make (allocRequest);
16891688#else
1690- sp<GraphicBuffer> graphicBuffer = new GraphicBuffer (
1691- allocWidth, allocHeight, allocFormat, BQ_LAYER_COUNT,
1692- allocUsage, allocName);
1689+ sp<GraphicBuffer> graphicBuffer =
1690+ sp<GraphicBuffer>:: make ( allocWidth, allocHeight, allocFormat, BQ_LAYER_COUNT,
1691+ allocUsage, allocName);
16931692#endif
16941693
16951694 status_t result = graphicBuffer->initCheck ();
0 commit comments