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

Commit c5b2cd2e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SurfaceComposerClient: Ensure createSurface returns error codes." into pi-dev

parents 2252bdbb 740eaf09
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -629,7 +629,7 @@ status_t SurfaceComposerClient::createSurfaceChecked(
        int32_t ownerUid)
{
    sp<SurfaceControl> sur;
    status_t err = NO_ERROR;
    status_t err = mStatus;

    if (mStatus == NO_ERROR) {
        sp<IBinder> handle;
+10 −1
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ static constexpr uint64_t NO_FRAME_INDEX = std::numeric_limits<uint64_t>::max();

class SurfaceTest : public ::testing::Test {
protected:

    SurfaceTest() {
        ProcessState::self()->startThreadPool();
    }
@@ -93,6 +92,16 @@ protected:
    sp<SurfaceControl> mSurfaceControl;
};

TEST_F(SurfaceTest, CreateSurfaceReturnsErrorBadClient) {
    mComposerClient->dispose();
    ASSERT_EQ(NO_INIT, mComposerClient->initCheck());

    sp<SurfaceControl> sc;
    status_t err = mComposerClient->createSurfaceChecked(
            String8("Test Surface"), 32, 32, PIXEL_FORMAT_RGBA_8888, &sc, 0);
    ASSERT_EQ(NO_INIT, err);
}

TEST_F(SurfaceTest, QueuesToWindowComposerIsTrueWhenVisible) {
    sp<ANativeWindow> anw(mSurface);
    int result = -123;