From a2ca9bf0a9789e9e5e37961ebfb356347f59309e Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Mon, 8 Jun 2015 16:30:08 +0000 Subject: [PATCH] Revert "libgui: Add getConsumerName" This reverts commit 107fbe5599016b0e35145a1a00c4f238b63d61e4. Change-Id: I0c2b0f7c81193b05eb3dd2f5a59f83598434b744 --- include/gui/BufferQueueProducer.h | 3 --- include/gui/IGraphicBufferProducer.h | 3 --- include/gui/Surface.h | 3 --- libs/gui/BufferQueueProducer.cpp | 6 ------ libs/gui/IGraphicBufferProducer.cpp | 17 ----------------- libs/gui/Surface.cpp | 4 ---- libs/gui/tests/BufferQueue_test.cpp | 8 ++++++-- libs/gui/tests/DummyConsumer.h | 27 --------------------------- libs/gui/tests/Surface_test.cpp | 18 ------------------ 9 files changed, 6 insertions(+), 83 deletions(-) delete mode 100644 libs/gui/tests/DummyConsumer.h diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h index 9754a89ea..afa7eb180 100644 --- a/include/gui/BufferQueueProducer.h +++ b/include/gui/BufferQueueProducer.h @@ -178,9 +178,6 @@ public: // See IGraphicBufferProducer::setGenerationNumber virtual status_t setGenerationNumber(uint32_t generationNumber); - // See IGraphicBufferProducer::getConsumerName - virtual String8 getConsumerName() const override; - private: // This is required by the IBinder::DeathRecipient interface virtual void binderDied(const wp& who); diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h index 9530de1aa..4ca4cd50d 100644 --- a/include/gui/IGraphicBufferProducer.h +++ b/include/gui/IGraphicBufferProducer.h @@ -480,9 +480,6 @@ public: // affected and will retain their current generation number. The generation // number defaults to 0. virtual status_t setGenerationNumber(uint32_t generationNumber) = 0; - - // Returns the name of the connected consumer. - virtual String8 getConsumerName() const = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/gui/Surface.h b/include/gui/Surface.h index 72f106707..261b07c8f 100644 --- a/include/gui/Surface.h +++ b/include/gui/Surface.h @@ -106,9 +106,6 @@ public: * See IGBP::setGenerationNumber for more information. */ status_t setGenerationNumber(uint32_t generationNumber); - // See IGraphicBufferProducer::getConsumerName - String8 getConsumerName() const; - protected: virtual ~Surface(); diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 38fb75766..73d4261d5 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -1089,12 +1089,6 @@ status_t BufferQueueProducer::setGenerationNumber(uint32_t generationNumber) { return NO_ERROR; } -String8 BufferQueueProducer::getConsumerName() const { - ATRACE_CALL(); - BQ_LOGV("getConsumerName: %s", mConsumerName.string()); - return mConsumerName; -} - void BufferQueueProducer::binderDied(const wp& /* who */) { // If we're here, it means that a producer we were connected to died. // We're guaranteed that we are still connected to it because we remove diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp index d7a78850d..cfe726bc0 100644 --- a/libs/gui/IGraphicBufferProducer.cpp +++ b/libs/gui/IGraphicBufferProducer.cpp @@ -48,7 +48,6 @@ enum { ALLOCATE_BUFFERS, ALLOW_ALLOCATION, SET_GENERATION_NUMBER, - GET_CONSUMER_NAME, }; class BpGraphicBufferProducer : public BpInterface @@ -297,17 +296,6 @@ public: } return result; } - - virtual String8 getConsumerName() const { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - status_t result = remote()->transact(GET_CONSUMER_NAME, data, &reply); - if (result != NO_ERROR) { - ALOGE("getConsumerName failed to transact: %d", result); - return String8("TransactFailed"); - } - return reply.readString8(); - } }; // Out-of-line virtual method definition to trigger vtable emission in this @@ -479,11 +467,6 @@ status_t BnGraphicBufferProducer::onTransact( reply->writeInt32(result); return NO_ERROR; } - case GET_CONSUMER_NAME: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - reply->writeString8(getConsumerName()); - return NO_ERROR; - } } return BBinder::onTransact(code, data, reply, flags); } diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index df0661cf4..aeb56e002 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -111,10 +111,6 @@ status_t Surface::setGenerationNumber(uint32_t generation) { return result; } -String8 Surface::getConsumerName() const { - return mGraphicBufferProducer->getConsumerName(); -} - int Surface::hook_setSwapInterval(ANativeWindow* window, int interval) { Surface* c = getSelf(window); return c->setSwapInterval(interval); diff --git a/libs/gui/tests/BufferQueue_test.cpp b/libs/gui/tests/BufferQueue_test.cpp index 1a5487544..3d1139d4f 100644 --- a/libs/gui/tests/BufferQueue_test.cpp +++ b/libs/gui/tests/BufferQueue_test.cpp @@ -17,8 +17,6 @@ #define LOG_TAG "BufferQueue_test" //#define LOG_NDEBUG 0 -#include "DummyConsumer.h" - #include #include #include @@ -69,6 +67,12 @@ protected: sp mConsumer; }; +struct DummyConsumer : public BnConsumerListener { + virtual void onFrameAvailable(const BufferItem& /* item */) {} + virtual void onBuffersReleased() {} + virtual void onSidebandStreamChanged() {} +}; + static const uint32_t TEST_DATA = 0x12345678u; // XXX: Tests that fork a process to hold the BufferQueue must run before tests diff --git a/libs/gui/tests/DummyConsumer.h b/libs/gui/tests/DummyConsumer.h deleted file mode 100644 index 0511e165c..000000000 --- a/libs/gui/tests/DummyConsumer.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -namespace android { - -struct DummyConsumer : public BnConsumerListener { - virtual void onFrameAvailable(const BufferItem& /* item */) {} - virtual void onBuffersReleased() {} - virtual void onSidebandStreamChanged() {} -}; - -} // namespace android diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index 3f495f8de..cf0043dc6 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#include "DummyConsumer.h" - #include #include @@ -212,20 +210,4 @@ TEST_F(SurfaceTest, SettingGenerationNumber) { ASSERT_EQ(1U, graphicBuffer->getGenerationNumber()); } -TEST_F(SurfaceTest, GetConsumerName) { - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - - sp dummyConsumer(new DummyConsumer); - consumer->consumerConnect(dummyConsumer, false); - consumer->setConsumerName(String8("TestConsumer")); - - sp surface = new Surface(producer); - sp window(surface); - native_window_api_connect(window.get(), NATIVE_WINDOW_API_CPU); - - EXPECT_STREQ("TestConsumer", surface->getConsumerName().string()); -} - }