Loading libs/ui/tests/BufferHubBuffer_test.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define LOG_TAG "BufferHubBufferTest" #include <android/frameworks/bufferhub/1.0/IBufferClient.h> #include <android/frameworks/bufferhub/1.0/IBufferHub.h> #include <gtest/gtest.h> #include <hidl/ServiceManagement.h> Loading @@ -33,11 +34,11 @@ const int kFormat = HAL_PIXEL_FORMAT_RGBA_8888; const int kUsage = 0; const size_t kUserMetadataSize = 0; } // namespace using dvr::BufferHubDefs::IsBufferGained; using dvr::BufferHubDefs::kFirstClientBitMask; using dvr::BufferHubDefs::kMetadataHeaderSize; using frameworks::bufferhub::V1_0::BufferHubStatus; using frameworks::bufferhub::V1_0::IBufferClient; using frameworks::bufferhub::V1_0::IBufferHub; using hardware::hidl_handle; using hidl::base::V1_0::IBase; Loading Loading @@ -129,8 +130,14 @@ TEST_F(BufferHubBufferTest, ConnectHidlServer) { // TODO(b/116681016): Fill in real test once the interface gets implemented.. hidl_handle handle; sp<IBase> interface = bufferhub->importBuffer(handle); EXPECT_EQ(nullptr, interface.get()); EXPECT_TRUE(bufferhub ->importBuffer(handle, [](const auto& client, const auto& ret) { EXPECT_EQ(client, nullptr); EXPECT_EQ(ret, BufferHubStatus::NO_ERROR); }) .isOk()); } } // namespace } // namespace android services/bufferhub/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ cc_library_shared { "-Wextra", ], srcs: [ "BufferClient.cpp", "BufferHubService.cpp", "BufferNode.cpp", ], Loading services/bufferhub/BufferClient.cpp 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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 <bufferhub/BufferClient.h> #include <hidl/HidlSupport.h> namespace android { namespace frameworks { namespace bufferhub { namespace V1_0 { namespace implementation { using hardware::hidl_handle; using hardware::Void; Return<void> BufferClient::duplicate(duplicate_cb _hidl_cb) { // TODO(b/118614157): implement token generation and registration _hidl_cb(/*token=*/hidl_handle(), /*status=*/BufferHubStatus::NO_ERROR); return Void(); } } // namespace implementation } // namespace V1_0 } // namespace bufferhub } // namespace frameworks } // namespace android No newline at end of file services/bufferhub/BufferHubService.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -22,16 +22,21 @@ namespace bufferhub { namespace V1_0 { namespace implementation { using ::android::status_t; using ::android::hardware::Void; using hardware::Void; Return<void> BufferHubService::allocateBuffer(const HardwareBufferDescription& /*description*/, allocateBuffer_cb /*hidl_cb*/) { const uint32_t /*userMetadataSize*/, allocateBuffer_cb _hidl_cb) { // TODO(b/118614333): implement buffer allocation _hidl_cb(/*bufferClient=*/nullptr, /*status=*/BufferHubStatus::NO_ERROR); return Void(); } Return<sp<IBase>> BufferHubService::importBuffer(const hidl_handle& /*nativeHandle*/) { return nullptr; Return<void> BufferHubService::importBuffer(const hidl_handle& /*nativeHandle*/, importBuffer_cb _hidl_cb) { // TODO(b/118614157): implement buffer import _hidl_cb(/*bufferClient=*/nullptr, /*status=*/BufferHubStatus::NO_ERROR); return Void(); } } // namespace implementation Loading services/bufferhub/include/bufferhub/BufferClient.h 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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. */ #ifndef ANDROID_FRAMEWORKS_BUFFERHUB_V1_0_BUFFER_CLIENT_H #define ANDROID_FRAMEWORKS_BUFFERHUB_V1_0_BUFFER_CLIENT_H #include <android/frameworks/bufferhub/1.0/IBufferClient.h> namespace android { namespace frameworks { namespace bufferhub { namespace V1_0 { namespace implementation { using hardware::Return; class BufferClient : public IBufferClient { public: Return<void> duplicate(duplicate_cb _hidl_cb) override; }; } // namespace implementation } // namespace V1_0 } // namespace bufferhub } // namespace frameworks } // namespace android #endif No newline at end of file Loading
libs/ui/tests/BufferHubBuffer_test.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define LOG_TAG "BufferHubBufferTest" #include <android/frameworks/bufferhub/1.0/IBufferClient.h> #include <android/frameworks/bufferhub/1.0/IBufferHub.h> #include <gtest/gtest.h> #include <hidl/ServiceManagement.h> Loading @@ -33,11 +34,11 @@ const int kFormat = HAL_PIXEL_FORMAT_RGBA_8888; const int kUsage = 0; const size_t kUserMetadataSize = 0; } // namespace using dvr::BufferHubDefs::IsBufferGained; using dvr::BufferHubDefs::kFirstClientBitMask; using dvr::BufferHubDefs::kMetadataHeaderSize; using frameworks::bufferhub::V1_0::BufferHubStatus; using frameworks::bufferhub::V1_0::IBufferClient; using frameworks::bufferhub::V1_0::IBufferHub; using hardware::hidl_handle; using hidl::base::V1_0::IBase; Loading Loading @@ -129,8 +130,14 @@ TEST_F(BufferHubBufferTest, ConnectHidlServer) { // TODO(b/116681016): Fill in real test once the interface gets implemented.. hidl_handle handle; sp<IBase> interface = bufferhub->importBuffer(handle); EXPECT_EQ(nullptr, interface.get()); EXPECT_TRUE(bufferhub ->importBuffer(handle, [](const auto& client, const auto& ret) { EXPECT_EQ(client, nullptr); EXPECT_EQ(ret, BufferHubStatus::NO_ERROR); }) .isOk()); } } // namespace } // namespace android
services/bufferhub/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ cc_library_shared { "-Wextra", ], srcs: [ "BufferClient.cpp", "BufferHubService.cpp", "BufferNode.cpp", ], Loading
services/bufferhub/BufferClient.cpp 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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 <bufferhub/BufferClient.h> #include <hidl/HidlSupport.h> namespace android { namespace frameworks { namespace bufferhub { namespace V1_0 { namespace implementation { using hardware::hidl_handle; using hardware::Void; Return<void> BufferClient::duplicate(duplicate_cb _hidl_cb) { // TODO(b/118614157): implement token generation and registration _hidl_cb(/*token=*/hidl_handle(), /*status=*/BufferHubStatus::NO_ERROR); return Void(); } } // namespace implementation } // namespace V1_0 } // namespace bufferhub } // namespace frameworks } // namespace android No newline at end of file
services/bufferhub/BufferHubService.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -22,16 +22,21 @@ namespace bufferhub { namespace V1_0 { namespace implementation { using ::android::status_t; using ::android::hardware::Void; using hardware::Void; Return<void> BufferHubService::allocateBuffer(const HardwareBufferDescription& /*description*/, allocateBuffer_cb /*hidl_cb*/) { const uint32_t /*userMetadataSize*/, allocateBuffer_cb _hidl_cb) { // TODO(b/118614333): implement buffer allocation _hidl_cb(/*bufferClient=*/nullptr, /*status=*/BufferHubStatus::NO_ERROR); return Void(); } Return<sp<IBase>> BufferHubService::importBuffer(const hidl_handle& /*nativeHandle*/) { return nullptr; Return<void> BufferHubService::importBuffer(const hidl_handle& /*nativeHandle*/, importBuffer_cb _hidl_cb) { // TODO(b/118614157): implement buffer import _hidl_cb(/*bufferClient=*/nullptr, /*status=*/BufferHubStatus::NO_ERROR); return Void(); } } // namespace implementation Loading
services/bufferhub/include/bufferhub/BufferClient.h 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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. */ #ifndef ANDROID_FRAMEWORKS_BUFFERHUB_V1_0_BUFFER_CLIENT_H #define ANDROID_FRAMEWORKS_BUFFERHUB_V1_0_BUFFER_CLIENT_H #include <android/frameworks/bufferhub/1.0/IBufferClient.h> namespace android { namespace frameworks { namespace bufferhub { namespace V1_0 { namespace implementation { using hardware::Return; class BufferClient : public IBufferClient { public: Return<void> duplicate(duplicate_cb _hidl_cb) override; }; } // namespace implementation } // namespace V1_0 } // namespace bufferhub } // namespace frameworks } // namespace android #endif No newline at end of file