Use sp<>::make instead of new
For better refcount safety, use sp<>::make instead of new.
After this change, sp<T> t = new T(args..) will be prohibited at compile
time.
Bug: 241125940
Test: m checkinput
Change-Id: I27806ca8f41e8d67744f3569c87a64241318c20b
diff --git a/services/inputflinger/tests/LatencyTracker_test.cpp b/services/inputflinger/tests/LatencyTracker_test.cpp
index 89c0741..1f4b248 100644
--- a/services/inputflinger/tests/LatencyTracker_test.cpp
+++ b/services/inputflinger/tests/LatencyTracker_test.cpp
@@ -44,7 +44,7 @@
graphicsTimeline[GraphicsTimeline::GPU_COMPLETED_TIME] = 9;
graphicsTimeline[GraphicsTimeline::PRESENT_TIME] = 10;
expectedCT.setGraphicsTimeline(std::move(graphicsTimeline));
- t.connectionTimelines.emplace(new BBinder(), std::move(expectedCT));
+ t.connectionTimelines.emplace(sp<BBinder>::make(), std::move(expectedCT));
return t;
}
@@ -56,8 +56,8 @@
sp<IBinder> connection2;
void SetUp() override {
- connection1 = new BBinder();
- connection2 = new BBinder();
+ connection1 = sp<BBinder>::make();
+ connection2 = sp<BBinder>::make();
mTracker = std::make_unique<LatencyTracker>(this);
}