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

Commit aea0ecf4 authored by Carlos Martinez Romero's avatar Carlos Martinez Romero Committed by Android (Google) Code Review
Browse files

Merge "Remove redundant connect methods in Surface." into main

parents 3e8de46e 6a5fdc1d
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -2027,15 +2027,6 @@ int Surface::connect(int api) {
    return connect(api, listener);
}

int Surface::connect(int api, const sp<SurfaceListener>& listener) {
    return connect(api, listener, false);
}

int Surface::connect(
        int api, bool reportBufferRemoval, const sp<SurfaceListener>& sListener) {
    return connect(api, sListener, reportBufferRemoval);
}

int Surface::connect(int api, const sp<SurfaceListener>& listener, bool reportBufferRemoval) {
    ATRACE_CALL();
    ALOGV("Surface::connect");
+3 −8
Original line number Diff line number Diff line
@@ -381,20 +381,15 @@ public:
    virtual int unlockAndPost();
    virtual int query(int what, int* value) const;

    virtual int connect(int api, const sp<SurfaceListener>& listener);

    // When reportBufferRemoval is true, clients must call getAndFlushRemovedBuffers to fetch
    // GraphicBuffers removed from this surface after a dequeueBuffer, detachNextBuffer or
    // attachBuffer call. This allows clients with their own buffer caches to free up buffers no
    // longer in use by this surface.
    virtual int connect(int api, const sp<SurfaceListener>& listener, bool reportBufferRemoval);
    virtual int detachNextBuffer(sp<GraphicBuffer>* outBuffer,
            sp<Fence>* outFence);
    virtual int connect(int api, const sp<SurfaceListener>& listener,
                        bool reportBufferRemoval = false);
    virtual int detachNextBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence);
    virtual int attachBuffer(ANativeWindowBuffer*);

    virtual int connect(
            int api, bool reportBufferRemoval,
            const sp<SurfaceListener>& sListener);
    virtual void destroy();

    // When client connects to Surface with reportBufferRemoval set to true, any buffers removed
+9 −9
Original line number Diff line number Diff line
@@ -151,10 +151,10 @@ protected:
        if (hasSurfaceListener) {
            listener = new FakeSurfaceListener(enableReleasedCb);
        }
        ASSERT_EQ(OK, surface->connect(
                NATIVE_WINDOW_API_CPU,
                /*reportBufferRemoval*/true,
                /*listener*/listener));
        ASSERT_EQ(OK,
                  surface->connect(NATIVE_WINDOW_API_CPU,
                                   /*listener*/ listener,
                                   /*reportBufferRemoval*/ true));
        const int BUFFER_COUNT = 4 + extraDiscardedBuffers;
        ASSERT_EQ(NO_ERROR, native_window_set_buffer_count(window.get(), BUFFER_COUNT));
        ASSERT_EQ(NO_ERROR, native_window_set_usage(window.get(), TEST_PRODUCER_USAGE_BITS));
@@ -500,8 +500,8 @@ TEST_F(SurfaceTest, GetAndFlushRemovedBuffers) {
    sp<Surface> surface = new Surface(producer);
    sp<ANativeWindow> window(surface);
    sp<StubSurfaceListener> listener = new StubSurfaceListener();
    ASSERT_EQ(OK, surface->connect(
            NATIVE_WINDOW_API_CPU,
    ASSERT_EQ(OK,
              surface->connect(NATIVE_WINDOW_API_CPU,
                               /*listener*/ listener,
                               /*reportBufferRemoval*/ true));
    const int BUFFER_COUNT = 4;
@@ -2374,7 +2374,7 @@ TEST_F(SurfaceTest, QueueAcquireReleaseDequeue_CalledInStack_DoesNotDeadlock) {
    consumer->setFrameAvailableListener(consumerListener);

    sp<DequeuingSurfaceListener> surfaceListener = sp<DequeuingSurfaceListener>::make(surface);
    EXPECT_EQ(OK, surface->connect(NATIVE_WINDOW_API_CPU, false, surfaceListener));
    EXPECT_EQ(OK, surface->connect(NATIVE_WINDOW_API_CPU, surfaceListener, false));

    EXPECT_EQ(OK, surface->setMaxDequeuedBufferCount(2));