SF: build with ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION
Change-Id: I347b2cf57f1df426d11d07a84075419597d4a442
Test: presubmit
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index d152ab2..d3f53c1 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -173,7 +173,7 @@
void EventThreadConnection::onFirstRef() {
// NOTE: mEventThread doesn't hold a strong reference on us
- mEventThread->registerDisplayEventConnection(this);
+ mEventThread->registerDisplayEventConnection(sp<EventThreadConnection>::fromExisting(this));
}
binder::Status EventThreadConnection::stealReceiveChannel(gui::BitTube* outChannel) {
@@ -188,20 +188,22 @@
}
binder::Status EventThreadConnection::setVsyncRate(int rate) {
- mEventThread->setVsyncRate(static_cast<uint32_t>(rate), this);
+ mEventThread->setVsyncRate(static_cast<uint32_t>(rate),
+ sp<EventThreadConnection>::fromExisting(this));
return binder::Status::ok();
}
binder::Status EventThreadConnection::requestNextVsync() {
ATRACE_CALL();
- mEventThread->requestNextVsync(this);
+ mEventThread->requestNextVsync(sp<EventThreadConnection>::fromExisting(this));
return binder::Status::ok();
}
binder::Status EventThreadConnection::getLatestVsyncEventData(
ParcelableVsyncEventData* outVsyncEventData) {
ATRACE_CALL();
- outVsyncEventData->vsync = mEventThread->getLatestVsyncEventData(this);
+ outVsyncEventData->vsync =
+ mEventThread->getLatestVsyncEventData(sp<EventThreadConnection>::fromExisting(this));
return binder::Status::ok();
}
@@ -289,9 +291,9 @@
sp<EventThreadConnection> EventThread::createEventConnection(
ResyncCallback resyncCallback, EventRegistrationFlags eventRegistration) const {
- return new EventThreadConnection(const_cast<EventThread*>(this),
- IPCThreadState::self()->getCallingUid(),
- std::move(resyncCallback), eventRegistration);
+ return sp<EventThreadConnection>::make(const_cast<EventThread*>(this),
+ IPCThreadState::self()->getCallingUid(),
+ std::move(resyncCallback), eventRegistration);
}
status_t EventThread::registerDisplayEventConnection(const sp<EventThreadConnection>& connection) {
diff --git a/services/surfaceflinger/Scheduler/MessageQueue.cpp b/services/surfaceflinger/Scheduler/MessageQueue.cpp
index f2af85e..e90e387 100644
--- a/services/surfaceflinger/Scheduler/MessageQueue.cpp
+++ b/services/surfaceflinger/Scheduler/MessageQueue.cpp
@@ -34,7 +34,7 @@
if (!mFramePending.exchange(true)) {
mVsyncId = vsyncId;
mExpectedVsyncTime = expectedVsyncTime;
- mQueue.mLooper->sendMessage(this, Message());
+ mQueue.mLooper->sendMessage(sp<MessageHandler>::fromExisting(this), Message());
}
}
diff --git a/services/surfaceflinger/Scheduler/MessageQueue.h b/services/surfaceflinger/Scheduler/MessageQueue.h
index 4082e26..d3c1e7a 100644
--- a/services/surfaceflinger/Scheduler/MessageQueue.h
+++ b/services/surfaceflinger/Scheduler/MessageQueue.h
@@ -25,6 +25,7 @@
#include <android/gui/IDisplayEventConnection.h>
#include <private/gui/BitTube.h>
#include <utils/Looper.h>
+#include <utils/StrongPointer.h>
#include <utils/Timers.h>
#include "EventThread.h"
@@ -47,6 +48,9 @@
template <typename G>
friend auto makeTask(G&&);
+ template <typename... Args>
+ friend sp<Task<F>> sp<Task<F>>::make(Args&&... args);
+
explicit Task(F&& f) : mTask(std::move(f)) {}
void handleMessage(const Message&) override { mTask(); }
@@ -57,7 +61,7 @@
template <typename F>
inline auto makeTask(F&& f) {
- sp<Task<F>> task = new Task<F>(std::move(f));
+ sp<Task<F>> task = sp<Task<F>>::make(std::move(f));
return std::make_pair(task, task->mTask.get_future());
}
diff --git a/services/surfaceflinger/Scheduler/VsyncModulator.cpp b/services/surfaceflinger/Scheduler/VsyncModulator.cpp
index be57b2a..138d8d6 100644
--- a/services/surfaceflinger/Scheduler/VsyncModulator.cpp
+++ b/services/surfaceflinger/Scheduler/VsyncModulator.cpp
@@ -53,14 +53,14 @@
case Schedule::EarlyStart:
if (token) {
mEarlyWakeupRequests.emplace(token);
- token->linkToDeath(this);
+ token->linkToDeath(sp<DeathRecipient>::fromExisting(this));
} else {
ALOGW("%s: EarlyStart requested without a valid token", __func__);
}
break;
case Schedule::EarlyEnd: {
if (token && mEarlyWakeupRequests.erase(token) > 0) {
- token->unlinkToDeath(this);
+ token->unlinkToDeath(sp<DeathRecipient>::fromExisting(this));
} else {
ALOGW("%s: Unexpected EarlyEnd", __func__);
}