diff options
author | 2025-03-14 14:43:29 -0700 | |
---|---|---|
committer | 2025-03-17 15:19:03 -0700 | |
commit | a4e35c689dbab4ad538da39ddb88aecba83d1abb (patch) | |
tree | ee7a1dcdad7774d5b170151f612c1f5c0f3c507b | |
parent | b1fd1868e96a6b9455d784ad9fc31dcf1b6fd249 (diff) |
Harden construction sites of android::StrongPointer in frameworks/native
Test: presubmit
Flag: EXEMPT refactor
Bug: 393217449
Change-Id: I25857739af659a52d2e33fc0e05799959f4024ab
-rw-r--r-- | cmds/flatland/GLHelper.cpp | 2 | ||||
-rw-r--r-- | libs/gui/tests/BLASTBufferQueue_test.cpp | 2 | ||||
-rw-r--r-- | libs/gui/tests/DisplayedContentSampling_test.cpp | 2 | ||||
-rw-r--r-- | libs/gui/tests/EndToEndNativeInputTest.cpp | 2 | ||||
-rw-r--r-- | libs/gui/tests/GLTest.cpp | 2 | ||||
-rw-r--r-- | libs/gui/tests/RegionSampling_test.cpp | 2 | ||||
-rw-r--r-- | libs/gui/tests/SamplingDemo.cpp | 2 | ||||
-rw-r--r-- | libs/gui/tests/Surface_test.cpp | 2 | ||||
-rw-r--r-- | opengl/tests/lib/WindowSurface.cpp | 2 | ||||
-rw-r--r-- | services/automotive/display/AutomotiveDisplayProxyService.cpp | 2 |
10 files changed, 10 insertions, 10 deletions
diff --git a/cmds/flatland/GLHelper.cpp b/cmds/flatland/GLHelper.cpp index 6e6d27d463..a2e171fa3b 100644 --- a/cmds/flatland/GLHelper.cpp +++ b/cmds/flatland/GLHelper.cpp @@ -241,7 +241,7 @@ bool GLHelper::createWindowSurface(uint32_t w, uint32_t h, status_t err; if (mSurfaceComposerClient == nullptr) { - mSurfaceComposerClient = new SurfaceComposerClient; + mSurfaceComposerClient = sp<SurfaceComposerClient>::make(); } err = mSurfaceComposerClient->initCheck(); if (err != NO_ERROR) { diff --git a/libs/gui/tests/BLASTBufferQueue_test.cpp b/libs/gui/tests/BLASTBufferQueue_test.cpp index b861c6d4b7..4e4c8a2b63 100644 --- a/libs/gui/tests/BLASTBufferQueue_test.cpp +++ b/libs/gui/tests/BLASTBufferQueue_test.cpp @@ -201,7 +201,7 @@ public: protected: void SetUp() { mComposer = ComposerService::getComposerService(); - mClient = new SurfaceComposerClient(); + mClient = sp<SurfaceComposerClient>::make(); const auto ids = SurfaceComposerClient::getPhysicalDisplayIds(); ASSERT_FALSE(ids.empty()); // display 0 is picked as this test is not much display depedent diff --git a/libs/gui/tests/DisplayedContentSampling_test.cpp b/libs/gui/tests/DisplayedContentSampling_test.cpp index bffb3f0430..62d73ca752 100644 --- a/libs/gui/tests/DisplayedContentSampling_test.cpp +++ b/libs/gui/tests/DisplayedContentSampling_test.cpp @@ -30,7 +30,7 @@ static constexpr uint32_t INVALID_MASK = 0x10; class DisplayedContentSamplingTest : public ::testing::Test { protected: void SetUp() { - mComposerClient = new SurfaceComposerClient; + mComposerClient = sp<SurfaceComposerClient>::make(); ASSERT_EQ(OK, mComposerClient->initCheck()); const auto ids = SurfaceComposerClient::getPhysicalDisplayIds(); ASSERT_FALSE(ids.empty()); diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp index adf8fce472..5a5067b2b9 100644 --- a/libs/gui/tests/EndToEndNativeInputTest.cpp +++ b/libs/gui/tests/EndToEndNativeInputTest.cpp @@ -398,7 +398,7 @@ public: InputSurfacesTest() { ProcessState::self()->startThreadPool(); } void SetUp() { - mComposerClient = new SurfaceComposerClient; + mComposerClient = sp<SurfaceComposerClient>::make(); ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); const auto ids = SurfaceComposerClient::getPhysicalDisplayIds(); ASSERT_FALSE(ids.empty()); diff --git a/libs/gui/tests/GLTest.cpp b/libs/gui/tests/GLTest.cpp index 40af8e845a..407c18ed0d 100644 --- a/libs/gui/tests/GLTest.cpp +++ b/libs/gui/tests/GLTest.cpp @@ -56,7 +56,7 @@ void GLTest::SetUp() { } if (mDisplaySecs > 0) { - mComposerClient = new SurfaceComposerClient; + mComposerClient = sp<SurfaceComposerClient>::make(); ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); mSurfaceControl = mComposerClient->createSurface( diff --git a/libs/gui/tests/RegionSampling_test.cpp b/libs/gui/tests/RegionSampling_test.cpp index c35efe28a3..d80d223f49 100644 --- a/libs/gui/tests/RegionSampling_test.cpp +++ b/libs/gui/tests/RegionSampling_test.cpp @@ -180,7 +180,7 @@ protected: } void SetUp() override { - mSurfaceComposerClient = new SurfaceComposerClient; + mSurfaceComposerClient = sp<SurfaceComposerClient>::make(); ASSERT_EQ(NO_ERROR, mSurfaceComposerClient->initCheck()); mBackgroundLayer = diff --git a/libs/gui/tests/SamplingDemo.cpp b/libs/gui/tests/SamplingDemo.cpp index 8fea689c91..a2fe8fd2ec 100644 --- a/libs/gui/tests/SamplingDemo.cpp +++ b/libs/gui/tests/SamplingDemo.cpp @@ -36,7 +36,7 @@ namespace android { class Button : public gui::BnRegionSamplingListener { public: Button(const char* name, const Rect& samplingArea) { - sp<SurfaceComposerClient> client = new SurfaceComposerClient; + sp<SurfaceComposerClient> client = sp<SurfaceComposerClient>::make(); mButton = client->createSurface(String8(name), 0, 0, PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eFXSurfaceEffect); diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index c4dcba856a..8e7f469efd 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -134,7 +134,7 @@ protected: } virtual void SetUp() { - mComposerClient = new SurfaceComposerClient; + mComposerClient = sp<SurfaceComposerClient>::make(); ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); // TODO(brianderson): The following sometimes fails and is a source of diff --git a/opengl/tests/lib/WindowSurface.cpp b/opengl/tests/lib/WindowSurface.cpp index e94b565f11..beac9001bc 100644 --- a/opengl/tests/lib/WindowSurface.cpp +++ b/opengl/tests/lib/WindowSurface.cpp @@ -29,7 +29,7 @@ using namespace android; WindowSurface::WindowSurface() { status_t err; - sp<SurfaceComposerClient> surfaceComposerClient = new SurfaceComposerClient; + sp<SurfaceComposerClient> surfaceComposerClient = sp<SurfaceComposerClient>::make(); err = surfaceComposerClient->initCheck(); if (err != NO_ERROR) { fprintf(stderr, "SurfaceComposerClient::initCheck error: %#x\n", err); diff --git a/services/automotive/display/AutomotiveDisplayProxyService.cpp b/services/automotive/display/AutomotiveDisplayProxyService.cpp index afa623352b..56c3b7d31f 100644 --- a/services/automotive/display/AutomotiveDisplayProxyService.cpp +++ b/services/automotive/display/AutomotiveDisplayProxyService.cpp @@ -65,7 +65,7 @@ AutomotiveDisplayProxyService::getIGraphicBufferProducer(uint64_t id) { std::swap(displayWidth, displayHeight); } - sp<android::SurfaceComposerClient> surfaceClient = new SurfaceComposerClient(); + sp<android::SurfaceComposerClient> surfaceClient = sp<SurfaceComposerClient>::make(); err = surfaceClient->initCheck(); if (err != NO_ERROR) { ALOGE("SurfaceComposerClient::initCheck error: %#x", err); |