Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 969e7ea6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I60d42f38,I25857739 into main

* changes:
  Ensure Choreographer is held as sp<> in SurfaceControl.
  Harden construction sites of android::StrongPointer in frameworks/native
parents 4b527799 90456660
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −2
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ const std::string& SurfaceControl::getName() const {
    return mName;
}

std::shared_ptr<Choreographer> SurfaceControl::getChoreographer() {
sp<Choreographer> SurfaceControl::getChoreographer() {
    if (mChoreographer) {
        return mChoreographer;
    }
@@ -203,7 +203,7 @@ std::shared_ptr<Choreographer> SurfaceControl::getChoreographer() {
        ALOGE("%s: No looper prepared for thread", __func__);
        return nullptr;
    }
    mChoreographer = std::make_shared<Choreographer>(looper, getHandle());
    mChoreographer = sp<Choreographer>::make(looper, getHandle());
    status_t result = mChoreographer->initialize();
    if (result != OK) {
        ALOGE("Failed to initialize choreographer");
+3 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#include <android/gui/ISurfaceComposerClient.h>

#include <gui/Choreographer.h>
#include <ui/FrameStats.h>
#include <ui/PixelFormat.h>
#include <ui/Region.h>
@@ -36,7 +37,6 @@ namespace android {

// ---------------------------------------------------------------------------

class Choreographer;
class IGraphicBufferProducer;
class Surface;
class SurfaceComposerClient;
@@ -82,7 +82,7 @@ public:
    const std::string& getName() const;

    // TODO(b/267195698): Consider renaming.
    std::shared_ptr<Choreographer> getChoreographer();
    sp<Choreographer> getChoreographer();

    sp<IGraphicBufferProducer> getIGraphicBufferProducer();

@@ -134,7 +134,7 @@ private:
    PixelFormat mFormat = PIXEL_FORMAT_NONE;
    uint32_t mCreateFlags = 0;
    uint64_t mFallbackFrameNumber = 100;
    std::shared_ptr<Choreographer> mChoreographer;
    sp<Choreographer> mChoreographer;
};

}; // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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());
Loading