Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "BLASTBufferQueue_test" |
| 18 | |
| 19 | #include <gui/BLASTBufferQueue.h> |
| 20 | |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 21 | #include <android/hardware/graphics/common/1.2/types.h> |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 22 | #include <gui/BufferQueueCore.h> |
| 23 | #include <gui/BufferQueueProducer.h> |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 24 | #include <gui/IGraphicBufferProducer.h> |
| 25 | #include <gui/IProducerListener.h> |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 26 | #include <gui/SurfaceComposerClient.h> |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 27 | #include <private/gui/ComposerService.h> |
Dominik Laskowski | 3cb3d4e | 2019-11-21 11:14:45 -0800 | [diff] [blame^] | 28 | #include <ui/DisplayConfig.h> |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 29 | #include <ui/GraphicBuffer.h> |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 30 | #include <ui/GraphicTypes.h> |
Valerie Hau | 8cee3f9 | 2019-11-06 10:06:28 -0800 | [diff] [blame] | 31 | #include <ui/Transform.h> |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 32 | |
| 33 | #include <gtest/gtest.h> |
| 34 | |
| 35 | using namespace std::chrono_literals; |
| 36 | |
| 37 | namespace android { |
| 38 | |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 39 | using Transaction = SurfaceComposerClient::Transaction; |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 40 | using android::hardware::graphics::common::V1_2::BufferUsage; |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 41 | |
| 42 | class BLASTBufferQueueHelper { |
| 43 | public: |
| 44 | BLASTBufferQueueHelper(const sp<SurfaceControl>& sc, int width, int height) { |
| 45 | mBlastBufferQueueAdapter = new BLASTBufferQueue(sc, width, height); |
| 46 | } |
| 47 | |
| 48 | void update(const sp<SurfaceControl>& sc, int width, int height) { |
| 49 | mBlastBufferQueueAdapter->update(sc, width, height); |
| 50 | } |
| 51 | |
| 52 | void setNextTransaction(Transaction* next) { |
| 53 | mBlastBufferQueueAdapter->setNextTransaction(next); |
| 54 | } |
| 55 | |
| 56 | int getWidth() { return mBlastBufferQueueAdapter->mWidth; } |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 57 | |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 58 | int getHeight() { return mBlastBufferQueueAdapter->mHeight; } |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 59 | |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 60 | Transaction* getNextTransaction() { return mBlastBufferQueueAdapter->mNextTransaction; } |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 61 | |
| 62 | sp<IGraphicBufferProducer> getIGraphicBufferProducer() { |
| 63 | return mBlastBufferQueueAdapter->getIGraphicBufferProducer(); |
| 64 | } |
| 65 | |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 66 | const sp<SurfaceControl> getSurfaceControl() { |
| 67 | return mBlastBufferQueueAdapter->mSurfaceControl; |
| 68 | } |
| 69 | |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 70 | void waitForCallbacks() { |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 71 | std::unique_lock lock{mBlastBufferQueueAdapter->mMutex}; |
Valerie Hau | a32c552 | 2019-12-09 10:11:08 -0800 | [diff] [blame] | 72 | while (mBlastBufferQueueAdapter->mSubmitted.size() > 0) { |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 73 | mBlastBufferQueueAdapter->mCallbackCV.wait(lock); |
| 74 | } |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 75 | } |
| 76 | |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 77 | private: |
| 78 | sp<BLASTBufferQueue> mBlastBufferQueueAdapter; |
| 79 | }; |
| 80 | |
| 81 | class BLASTBufferQueueTest : public ::testing::Test { |
| 82 | public: |
| 83 | protected: |
| 84 | BLASTBufferQueueTest() { |
| 85 | const ::testing::TestInfo* const testInfo = |
| 86 | ::testing::UnitTest::GetInstance()->current_test_info(); |
| 87 | ALOGV("Begin test: %s.%s", testInfo->test_case_name(), testInfo->name()); |
| 88 | } |
| 89 | |
| 90 | ~BLASTBufferQueueTest() { |
| 91 | const ::testing::TestInfo* const testInfo = |
| 92 | ::testing::UnitTest::GetInstance()->current_test_info(); |
| 93 | ALOGV("End test: %s.%s", testInfo->test_case_name(), testInfo->name()); |
| 94 | } |
| 95 | |
| 96 | void SetUp() { |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 97 | mComposer = ComposerService::getComposerService(); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 98 | mClient = new SurfaceComposerClient(); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 99 | mDisplayToken = mClient->getInternalDisplayToken(); |
| 100 | ASSERT_NE(nullptr, mDisplayToken.get()); |
| 101 | Transaction t; |
| 102 | t.setDisplayLayerStack(mDisplayToken, 0); |
| 103 | t.apply(); |
| 104 | t.clear(); |
| 105 | |
Dominik Laskowski | 3cb3d4e | 2019-11-21 11:14:45 -0800 | [diff] [blame^] | 106 | DisplayConfig config; |
| 107 | ASSERT_EQ(NO_ERROR, SurfaceComposerClient::getActiveDisplayConfig(mDisplayToken, &config)); |
| 108 | const ui::Size& resolution = config.resolution; |
| 109 | mDisplayWidth = resolution.getWidth(); |
| 110 | mDisplayHeight = resolution.getHeight(); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 111 | |
| 112 | mSurfaceControl = mClient->createSurface(String8("TestSurface"), mDisplayWidth, |
| 113 | mDisplayHeight, PIXEL_FORMAT_RGBA_8888, |
| 114 | ISurfaceComposerClient::eFXSurfaceBufferState, |
| 115 | /*parent*/ nullptr); |
| 116 | t.setLayerStack(mSurfaceControl, 0) |
| 117 | .setLayer(mSurfaceControl, std::numeric_limits<int32_t>::max()) |
Dominik Laskowski | 3cb3d4e | 2019-11-21 11:14:45 -0800 | [diff] [blame^] | 118 | .setFrame(mSurfaceControl, Rect(resolution)) |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 119 | .show(mSurfaceControl) |
| 120 | .setDataspace(mSurfaceControl, ui::Dataspace::V0_SRGB) |
| 121 | .apply(); |
| 122 | } |
| 123 | |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 124 | void setUpProducer(BLASTBufferQueueHelper adapter, sp<IGraphicBufferProducer>& producer) { |
| 125 | auto igbProducer = adapter.getIGraphicBufferProducer(); |
| 126 | ASSERT_NE(nullptr, igbProducer.get()); |
Valerie Hau | c78c43a | 2020-01-09 17:34:14 -0800 | [diff] [blame] | 127 | ASSERT_EQ(NO_ERROR, igbProducer->setMaxDequeuedBufferCount(2)); |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 128 | IGraphicBufferProducer::QueueBufferOutput qbOutput; |
| 129 | ASSERT_EQ(NO_ERROR, |
| 130 | igbProducer->connect(new DummyProducerListener, NATIVE_WINDOW_API_CPU, false, |
| 131 | &qbOutput)); |
Dominik Laskowski | 718f960 | 2019-11-09 20:01:35 -0800 | [diff] [blame] | 132 | ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 133 | producer = igbProducer; |
| 134 | } |
| 135 | |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 136 | void fillBuffer(uint32_t* bufData, Rect rect, uint32_t stride, uint8_t r, uint8_t g, |
| 137 | uint8_t b) { |
| 138 | for (uint32_t row = rect.top; row < rect.bottom; row++) { |
| 139 | for (uint32_t col = rect.left; col < rect.right; col++) { |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 140 | uint8_t* pixel = (uint8_t*)(bufData + (row * stride) + col); |
| 141 | *pixel = r; |
| 142 | *(pixel + 1) = g; |
| 143 | *(pixel + 2) = b; |
| 144 | *(pixel + 3) = 255; |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | |
Valerie Hau | 5977fc8 | 2019-12-05 15:56:39 -0800 | [diff] [blame] | 149 | void fillQuadrants(sp<GraphicBuffer>& buf) { |
| 150 | const auto bufWidth = buf->getWidth(); |
| 151 | const auto bufHeight = buf->getHeight(); |
| 152 | uint32_t* bufData; |
| 153 | buf->lock(static_cast<uint32_t>(GraphicBuffer::USAGE_SW_WRITE_OFTEN), |
| 154 | reinterpret_cast<void**>(&bufData)); |
| 155 | fillBuffer(bufData, Rect(0, 0, bufWidth / 2, bufHeight / 2), buf->getStride(), 0, 0, 0); |
| 156 | fillBuffer(bufData, Rect(bufWidth / 2, 0, bufWidth, bufHeight / 2), buf->getStride(), 255, |
| 157 | 0, 0); |
| 158 | fillBuffer(bufData, Rect(bufWidth / 2, bufHeight / 2, bufWidth, bufHeight), |
| 159 | buf->getStride(), 0, 255, 0); |
| 160 | fillBuffer(bufData, Rect(0, bufHeight / 2, bufWidth / 2, bufHeight), buf->getStride(), 0, 0, |
| 161 | 255); |
| 162 | buf->unlock(); |
| 163 | } |
| 164 | |
| 165 | void checkScreenCapture(uint8_t r, uint8_t g, uint8_t b, Rect region, int32_t border = 0, |
| 166 | bool outsideRegion = false) { |
| 167 | const auto epsilon = 3; |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 168 | const auto width = mScreenCaptureBuf->getWidth(); |
| 169 | const auto height = mScreenCaptureBuf->getHeight(); |
| 170 | const auto stride = mScreenCaptureBuf->getStride(); |
| 171 | |
| 172 | uint32_t* bufData; |
| 173 | mScreenCaptureBuf->lock(static_cast<uint32_t>(GraphicBuffer::USAGE_SW_READ_OFTEN), |
| 174 | reinterpret_cast<void**>(&bufData)); |
| 175 | |
| 176 | for (uint32_t row = 0; row < height; row++) { |
| 177 | for (uint32_t col = 0; col < width; col++) { |
| 178 | uint8_t* pixel = (uint8_t*)(bufData + (row * stride) + col); |
Valerie Hau | 5977fc8 | 2019-12-05 15:56:39 -0800 | [diff] [blame] | 179 | bool inRegion; |
| 180 | if (!outsideRegion) { |
| 181 | inRegion = row >= region.top + border && row < region.bottom - border && |
| 182 | col >= region.left + border && col < region.right - border; |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 183 | } else { |
Valerie Hau | 5977fc8 | 2019-12-05 15:56:39 -0800 | [diff] [blame] | 184 | inRegion = row >= region.top - border && row < region.bottom + border && |
| 185 | col >= region.left - border && col < region.right + border; |
| 186 | } |
| 187 | if (!outsideRegion && inRegion) { |
| 188 | EXPECT_GE(epsilon, abs(r - *(pixel))); |
| 189 | EXPECT_GE(epsilon, abs(g - *(pixel + 1))); |
| 190 | EXPECT_GE(epsilon, abs(b - *(pixel + 2))); |
| 191 | } else if (outsideRegion && !inRegion) { |
| 192 | EXPECT_GE(epsilon, abs(r - *(pixel))); |
| 193 | EXPECT_GE(epsilon, abs(g - *(pixel + 1))); |
| 194 | EXPECT_GE(epsilon, abs(b - *(pixel + 2))); |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 195 | } |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 196 | } |
| 197 | } |
| 198 | mScreenCaptureBuf->unlock(); |
| 199 | ASSERT_EQ(false, ::testing::Test::HasFailure()); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | sp<SurfaceComposerClient> mClient; |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 203 | sp<ISurfaceComposer> mComposer; |
| 204 | |
| 205 | sp<IBinder> mDisplayToken; |
| 206 | |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 207 | sp<SurfaceControl> mSurfaceControl; |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 208 | sp<GraphicBuffer> mScreenCaptureBuf; |
| 209 | |
| 210 | uint32_t mDisplayWidth; |
| 211 | uint32_t mDisplayHeight; |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 212 | }; |
| 213 | |
| 214 | TEST_F(BLASTBufferQueueTest, CreateBLASTBufferQueue) { |
| 215 | // create BLASTBufferQueue adapter associated with this surface |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 216 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 217 | ASSERT_EQ(mSurfaceControl, adapter.getSurfaceControl()); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 218 | ASSERT_EQ(mDisplayWidth, adapter.getWidth()); |
| 219 | ASSERT_EQ(mDisplayHeight, adapter.getHeight()); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 220 | ASSERT_EQ(nullptr, adapter.getNextTransaction()); |
| 221 | } |
| 222 | |
| 223 | TEST_F(BLASTBufferQueueTest, Update) { |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 224 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 225 | sp<SurfaceControl> updateSurface = |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 226 | mClient->createSurface(String8("UpdateTest"), mDisplayWidth / 2, mDisplayHeight / 2, |
| 227 | PIXEL_FORMAT_RGBA_8888); |
| 228 | adapter.update(updateSurface, mDisplayWidth / 2, mDisplayHeight / 2); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 229 | ASSERT_EQ(updateSurface, adapter.getSurfaceControl()); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 230 | ASSERT_EQ(mDisplayWidth / 2, adapter.getWidth()); |
| 231 | ASSERT_EQ(mDisplayHeight / 2, adapter.getHeight()); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | TEST_F(BLASTBufferQueueTest, SetNextTransaction) { |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 235 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 236 | Transaction next; |
| 237 | adapter.setNextTransaction(&next); |
| 238 | ASSERT_EQ(&next, adapter.getNextTransaction()); |
| 239 | } |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 240 | |
Valerie Hau | 181abd3 | 2020-01-27 14:18:28 -0800 | [diff] [blame] | 241 | TEST_F(BLASTBufferQueueTest, onFrameAvailable_ApplyDesiredPresentTime) { |
| 242 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
| 243 | sp<IGraphicBufferProducer> igbProducer; |
| 244 | setUpProducer(adapter, igbProducer); |
| 245 | |
| 246 | int slot; |
| 247 | sp<Fence> fence; |
| 248 | sp<GraphicBuffer> buf; |
| 249 | auto ret = igbProducer->dequeueBuffer(&slot, &fence, mDisplayWidth, mDisplayHeight, |
| 250 | PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 251 | nullptr, nullptr); |
| 252 | ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); |
| 253 | ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); |
| 254 | |
| 255 | nsecs_t desiredPresentTime = systemTime() + nsecs_t(5 * 1e8); |
| 256 | IGraphicBufferProducer::QueueBufferOutput qbOutput; |
| 257 | IGraphicBufferProducer::QueueBufferInput input(desiredPresentTime, false, HAL_DATASPACE_UNKNOWN, |
| 258 | Rect(mDisplayWidth, mDisplayHeight), |
| 259 | NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, |
| 260 | Fence::NO_FENCE); |
| 261 | igbProducer->queueBuffer(slot, input, &qbOutput); |
| 262 | ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); |
| 263 | |
| 264 | adapter.waitForCallbacks(); |
| 265 | ASSERT_GE(systemTime(), desiredPresentTime); |
| 266 | } |
| 267 | |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 268 | TEST_F(BLASTBufferQueueTest, onFrameAvailable_Apply) { |
| 269 | uint8_t r = 255; |
| 270 | uint8_t g = 0; |
| 271 | uint8_t b = 0; |
| 272 | |
| 273 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 274 | sp<IGraphicBufferProducer> igbProducer; |
| 275 | setUpProducer(adapter, igbProducer); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 276 | |
| 277 | int slot; |
| 278 | sp<Fence> fence; |
| 279 | sp<GraphicBuffer> buf; |
| 280 | auto ret = igbProducer->dequeueBuffer(&slot, &fence, mDisplayWidth, mDisplayHeight, |
| 281 | PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 282 | nullptr, nullptr); |
| 283 | ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); |
| 284 | ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); |
| 285 | |
| 286 | uint32_t* bufData; |
| 287 | buf->lock(static_cast<uint32_t>(GraphicBuffer::USAGE_SW_WRITE_OFTEN), |
| 288 | reinterpret_cast<void**>(&bufData)); |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 289 | fillBuffer(bufData, Rect(buf->getWidth(), buf->getHeight()), buf->getStride(), r, g, b); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 290 | buf->unlock(); |
| 291 | |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 292 | IGraphicBufferProducer::QueueBufferOutput qbOutput; |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 293 | IGraphicBufferProducer::QueueBufferInput input(systemTime(), false, HAL_DATASPACE_UNKNOWN, |
| 294 | Rect(mDisplayWidth, mDisplayHeight), |
| 295 | NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, |
| 296 | Fence::NO_FENCE); |
| 297 | igbProducer->queueBuffer(slot, input, &qbOutput); |
Dominik Laskowski | 718f960 | 2019-11-09 20:01:35 -0800 | [diff] [blame] | 298 | ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 299 | |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 300 | adapter.waitForCallbacks(); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 301 | |
| 302 | // capture screen and verify that it is red |
| 303 | bool capturedSecureLayers; |
| 304 | ASSERT_EQ(NO_ERROR, |
| 305 | mComposer->captureScreen(mDisplayToken, &mScreenCaptureBuf, capturedSecureLayers, |
| 306 | ui::Dataspace::V0_SRGB, ui::PixelFormat::RGBA_8888, Rect(), |
| 307 | mDisplayWidth, mDisplayHeight, |
| 308 | /*useIdentityTransform*/ false)); |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 309 | ASSERT_NO_FATAL_FAILURE( |
| 310 | checkScreenCapture(r, g, b, {0, 0, (int32_t)mDisplayWidth, (int32_t)mDisplayHeight})); |
Valerie Hau | da3446e | 2019-10-14 15:49:22 -0700 | [diff] [blame] | 311 | } |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 312 | |
| 313 | TEST_F(BLASTBufferQueueTest, TripleBuffering) { |
| 314 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
| 315 | sp<IGraphicBufferProducer> igbProducer; |
| 316 | setUpProducer(adapter, igbProducer); |
| 317 | |
| 318 | std::vector<std::pair<int, sp<Fence>>> allocated; |
| 319 | for (int i = 0; i < 3; i++) { |
| 320 | int slot; |
| 321 | sp<Fence> fence; |
| 322 | sp<GraphicBuffer> buf; |
| 323 | auto ret = igbProducer->dequeueBuffer(&slot, &fence, mDisplayWidth, mDisplayHeight, |
| 324 | PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 325 | nullptr, nullptr); |
| 326 | ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); |
| 327 | ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); |
| 328 | allocated.push_back({slot, fence}); |
| 329 | } |
| 330 | for (int i = 0; i < allocated.size(); i++) { |
| 331 | igbProducer->cancelBuffer(allocated[i].first, allocated[i].second); |
| 332 | } |
| 333 | |
Valerie Hau | a32c552 | 2019-12-09 10:11:08 -0800 | [diff] [blame] | 334 | for (int i = 0; i < 100; i++) { |
Valerie Hau | d3b90d2 | 2019-11-06 09:37:31 -0800 | [diff] [blame] | 335 | int slot; |
| 336 | sp<Fence> fence; |
| 337 | sp<GraphicBuffer> buf; |
| 338 | auto ret = igbProducer->dequeueBuffer(&slot, &fence, mDisplayWidth, mDisplayHeight, |
| 339 | PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 340 | nullptr, nullptr); |
| 341 | ASSERT_EQ(NO_ERROR, ret); |
| 342 | IGraphicBufferProducer::QueueBufferOutput qbOutput; |
| 343 | IGraphicBufferProducer::QueueBufferInput input(systemTime(), false, HAL_DATASPACE_UNKNOWN, |
| 344 | Rect(mDisplayWidth, mDisplayHeight), |
| 345 | NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, |
| 346 | Fence::NO_FENCE); |
| 347 | igbProducer->queueBuffer(slot, input, &qbOutput); |
| 348 | } |
| 349 | adapter.waitForCallbacks(); |
| 350 | } |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 351 | |
| 352 | TEST_F(BLASTBufferQueueTest, SetCrop_Item) { |
| 353 | uint8_t r = 255; |
| 354 | uint8_t g = 0; |
| 355 | uint8_t b = 0; |
| 356 | |
| 357 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
| 358 | sp<IGraphicBufferProducer> igbProducer; |
| 359 | setUpProducer(adapter, igbProducer); |
| 360 | int slot; |
| 361 | sp<Fence> fence; |
| 362 | sp<GraphicBuffer> buf; |
| 363 | auto ret = igbProducer->dequeueBuffer(&slot, &fence, mDisplayWidth, mDisplayHeight, |
| 364 | PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 365 | nullptr, nullptr); |
| 366 | ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); |
| 367 | ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); |
| 368 | |
| 369 | uint32_t* bufData; |
| 370 | buf->lock(static_cast<uint32_t>(GraphicBuffer::USAGE_SW_WRITE_OFTEN), |
| 371 | reinterpret_cast<void**>(&bufData)); |
| 372 | fillBuffer(bufData, Rect(buf->getWidth(), buf->getHeight() / 2), buf->getStride(), r, g, b); |
| 373 | buf->unlock(); |
| 374 | |
| 375 | IGraphicBufferProducer::QueueBufferOutput qbOutput; |
| 376 | IGraphicBufferProducer::QueueBufferInput input(systemTime(), false, HAL_DATASPACE_UNKNOWN, |
| 377 | Rect(mDisplayWidth, mDisplayHeight / 2), |
| 378 | NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, |
| 379 | Fence::NO_FENCE); |
| 380 | igbProducer->queueBuffer(slot, input, &qbOutput); |
Dominik Laskowski | 718f960 | 2019-11-09 20:01:35 -0800 | [diff] [blame] | 381 | ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 382 | |
| 383 | adapter.waitForCallbacks(); |
| 384 | // capture screen and verify that it is red |
| 385 | bool capturedSecureLayers; |
| 386 | ASSERT_EQ(NO_ERROR, |
| 387 | mComposer->captureScreen(mDisplayToken, &mScreenCaptureBuf, capturedSecureLayers, |
| 388 | ui::Dataspace::V0_SRGB, ui::PixelFormat::RGBA_8888, Rect(), |
| 389 | mDisplayWidth, mDisplayHeight, |
| 390 | /*useIdentityTransform*/ false)); |
| 391 | ASSERT_NO_FATAL_FAILURE( |
| 392 | checkScreenCapture(r, g, b, {0, 0, (int32_t)mDisplayWidth, (int32_t)mDisplayHeight})); |
| 393 | } |
| 394 | |
| 395 | TEST_F(BLASTBufferQueueTest, SetCrop_ScalingModeScaleCrop) { |
| 396 | uint8_t r = 255; |
| 397 | uint8_t g = 0; |
| 398 | uint8_t b = 0; |
| 399 | |
| 400 | int32_t bufferSideLength = |
| 401 | (mDisplayWidth < mDisplayHeight) ? mDisplayWidth / 2 : mDisplayHeight / 2; |
| 402 | int32_t finalCropSideLength = bufferSideLength / 2; |
| 403 | |
| 404 | auto bg = mClient->createSurface(String8("BGTest"), 0, 0, PIXEL_FORMAT_RGBA_8888, |
| 405 | ISurfaceComposerClient::eFXSurfaceColor); |
| 406 | ASSERT_NE(nullptr, bg.get()); |
| 407 | Transaction t; |
| 408 | t.setLayerStack(bg, 0) |
| 409 | .setCrop_legacy(bg, Rect(0, 0, mDisplayWidth, mDisplayHeight)) |
| 410 | .setColor(bg, half3{0, 0, 0}) |
| 411 | .setLayer(bg, 0) |
| 412 | .apply(); |
| 413 | |
| 414 | BLASTBufferQueueHelper adapter(mSurfaceControl, bufferSideLength, bufferSideLength); |
| 415 | sp<IGraphicBufferProducer> igbProducer; |
| 416 | setUpProducer(adapter, igbProducer); |
| 417 | int slot; |
| 418 | sp<Fence> fence; |
| 419 | sp<GraphicBuffer> buf; |
| 420 | auto ret = igbProducer->dequeueBuffer(&slot, &fence, bufferSideLength, bufferSideLength, |
| 421 | PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 422 | nullptr, nullptr); |
| 423 | ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); |
| 424 | ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); |
| 425 | |
| 426 | uint32_t* bufData; |
| 427 | buf->lock(static_cast<uint32_t>(GraphicBuffer::USAGE_SW_WRITE_OFTEN), |
| 428 | reinterpret_cast<void**>(&bufData)); |
| 429 | fillBuffer(bufData, Rect(buf->getWidth(), buf->getHeight()), buf->getStride(), 0, 0, 0); |
| 430 | fillBuffer(bufData, |
| 431 | Rect(finalCropSideLength / 2, 0, buf->getWidth() - finalCropSideLength / 2, |
| 432 | buf->getHeight()), |
| 433 | buf->getStride(), r, g, b); |
| 434 | buf->unlock(); |
| 435 | |
| 436 | IGraphicBufferProducer::QueueBufferOutput qbOutput; |
| 437 | IGraphicBufferProducer::QueueBufferInput input(systemTime(), false, HAL_DATASPACE_UNKNOWN, |
| 438 | Rect(bufferSideLength, finalCropSideLength), |
| 439 | NATIVE_WINDOW_SCALING_MODE_SCALE_CROP, 0, |
| 440 | Fence::NO_FENCE); |
| 441 | igbProducer->queueBuffer(slot, input, &qbOutput); |
Dominik Laskowski | 718f960 | 2019-11-09 20:01:35 -0800 | [diff] [blame] | 442 | ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 443 | |
| 444 | adapter.waitForCallbacks(); |
| 445 | // capture screen and verify that it is red |
| 446 | bool capturedSecureLayers; |
| 447 | ASSERT_EQ(NO_ERROR, |
| 448 | mComposer->captureScreen(mDisplayToken, &mScreenCaptureBuf, capturedSecureLayers, |
| 449 | ui::Dataspace::V0_SRGB, ui::PixelFormat::RGBA_8888, Rect(), |
| 450 | mDisplayWidth, mDisplayHeight, |
| 451 | /*useIdentityTransform*/ false)); |
| 452 | ASSERT_NO_FATAL_FAILURE( |
| 453 | checkScreenCapture(r, g, b, |
| 454 | {0, 0, (int32_t)bufferSideLength, (int32_t)bufferSideLength})); |
Valerie Hau | 5977fc8 | 2019-12-05 15:56:39 -0800 | [diff] [blame] | 455 | ASSERT_NO_FATAL_FAILURE( |
| 456 | checkScreenCapture(0, 0, 0, |
| 457 | {0, 0, (int32_t)bufferSideLength, (int32_t)bufferSideLength}, |
| 458 | /*border*/ 0, /*outsideRegion*/ true)); |
Valerie Hau | 45e4b3b | 2019-12-03 10:49:17 -0800 | [diff] [blame] | 459 | } |
| 460 | |
Valerie Hau | 5977fc8 | 2019-12-05 15:56:39 -0800 | [diff] [blame] | 461 | class BLASTBufferQueueTransformTest : public BLASTBufferQueueTest { |
| 462 | public: |
| 463 | void test(uint32_t tr) { |
| 464 | BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); |
| 465 | sp<IGraphicBufferProducer> igbProducer; |
| 466 | setUpProducer(adapter, igbProducer); |
| 467 | |
| 468 | auto bufWidth = mDisplayWidth; |
| 469 | auto bufHeight = mDisplayHeight; |
| 470 | int slot; |
| 471 | sp<Fence> fence; |
| 472 | sp<GraphicBuffer> buf; |
| 473 | |
| 474 | auto ret = igbProducer->dequeueBuffer(&slot, &fence, bufWidth, bufHeight, |
| 475 | PIXEL_FORMAT_RGBA_8888, GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 476 | nullptr, nullptr); |
| 477 | ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, ret); |
| 478 | ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); |
| 479 | |
| 480 | fillQuadrants(buf); |
| 481 | |
| 482 | IGraphicBufferProducer::QueueBufferOutput qbOutput; |
| 483 | IGraphicBufferProducer::QueueBufferInput input(systemTime(), false, HAL_DATASPACE_UNKNOWN, |
| 484 | Rect(bufWidth, bufHeight), |
| 485 | NATIVE_WINDOW_SCALING_MODE_FREEZE, tr, |
| 486 | Fence::NO_FENCE); |
| 487 | igbProducer->queueBuffer(slot, input, &qbOutput); |
Dominik Laskowski | 718f960 | 2019-11-09 20:01:35 -0800 | [diff] [blame] | 488 | ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint); |
Valerie Hau | 5977fc8 | 2019-12-05 15:56:39 -0800 | [diff] [blame] | 489 | |
| 490 | adapter.waitForCallbacks(); |
| 491 | bool capturedSecureLayers; |
| 492 | ASSERT_EQ(NO_ERROR, |
| 493 | mComposer->captureScreen(mDisplayToken, &mScreenCaptureBuf, capturedSecureLayers, |
| 494 | ui::Dataspace::V0_SRGB, ui::PixelFormat::RGBA_8888, |
| 495 | Rect(), mDisplayWidth, mDisplayHeight, |
| 496 | /*useIdentityTransform*/ false)); |
| 497 | switch (tr) { |
| 498 | case ui::Transform::ROT_0: |
| 499 | ASSERT_NO_FATAL_FAILURE(checkScreenCapture(0, 0, 0, |
| 500 | {0, 0, (int32_t)mDisplayWidth / 2, |
| 501 | (int32_t)mDisplayHeight / 2}, |
| 502 | 1)); |
| 503 | ASSERT_NO_FATAL_FAILURE( |
| 504 | checkScreenCapture(255, 0, 0, |
| 505 | {(int32_t)mDisplayWidth / 2, 0, (int32_t)mDisplayWidth, |
| 506 | (int32_t)mDisplayHeight / 2}, |
| 507 | 1)); |
| 508 | ASSERT_NO_FATAL_FAILURE( |
| 509 | checkScreenCapture(0, 255, 0, |
| 510 | {(int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight / 2, |
| 511 | (int32_t)mDisplayWidth, (int32_t)mDisplayHeight}, |
| 512 | 1)); |
| 513 | ASSERT_NO_FATAL_FAILURE( |
| 514 | checkScreenCapture(0, 0, 255, |
| 515 | {0, (int32_t)mDisplayHeight / 2, |
| 516 | (int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight}, |
| 517 | 1)); |
| 518 | break; |
| 519 | case ui::Transform::FLIP_H: |
| 520 | ASSERT_NO_FATAL_FAILURE(checkScreenCapture(255, 0, 0, |
| 521 | {0, 0, (int32_t)mDisplayWidth / 2, |
| 522 | (int32_t)mDisplayHeight / 2}, |
| 523 | 1)); |
| 524 | ASSERT_NO_FATAL_FAILURE( |
| 525 | checkScreenCapture(0, 0, 0, |
| 526 | {(int32_t)mDisplayWidth / 2, 0, (int32_t)mDisplayWidth, |
| 527 | (int32_t)mDisplayHeight / 2}, |
| 528 | 1)); |
| 529 | ASSERT_NO_FATAL_FAILURE( |
| 530 | checkScreenCapture(0, 0, 255, |
| 531 | {(int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight / 2, |
| 532 | (int32_t)mDisplayWidth, (int32_t)mDisplayHeight}, |
| 533 | 1)); |
| 534 | ASSERT_NO_FATAL_FAILURE( |
| 535 | checkScreenCapture(0, 255, 0, |
| 536 | {0, (int32_t)mDisplayHeight / 2, |
| 537 | (int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight}, |
| 538 | 1)); |
| 539 | break; |
| 540 | case ui::Transform::FLIP_V: |
| 541 | ASSERT_NO_FATAL_FAILURE(checkScreenCapture(0, 0, 255, |
| 542 | {0, 0, (int32_t)mDisplayWidth / 2, |
| 543 | (int32_t)mDisplayHeight / 2}, |
| 544 | 1)); |
| 545 | ASSERT_NO_FATAL_FAILURE( |
| 546 | checkScreenCapture(0, 255, 0, |
| 547 | {(int32_t)mDisplayWidth / 2, 0, (int32_t)mDisplayWidth, |
| 548 | (int32_t)mDisplayHeight / 2}, |
| 549 | 1)); |
| 550 | ASSERT_NO_FATAL_FAILURE( |
| 551 | checkScreenCapture(255, 0, 0, |
| 552 | {(int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight / 2, |
| 553 | (int32_t)mDisplayWidth, (int32_t)mDisplayHeight}, |
| 554 | 1)); |
| 555 | ASSERT_NO_FATAL_FAILURE( |
| 556 | checkScreenCapture(0, 0, 0, |
| 557 | {0, (int32_t)mDisplayHeight / 2, |
| 558 | (int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight}, |
| 559 | 1)); |
| 560 | break; |
| 561 | case ui::Transform::ROT_90: |
| 562 | ASSERT_NO_FATAL_FAILURE(checkScreenCapture(0, 0, 255, |
| 563 | {0, 0, (int32_t)mDisplayWidth / 2, |
| 564 | (int32_t)mDisplayHeight / 2}, |
| 565 | 1)); |
| 566 | ASSERT_NO_FATAL_FAILURE( |
| 567 | checkScreenCapture(0, 0, 0, |
| 568 | {(int32_t)mDisplayWidth / 2, 0, (int32_t)mDisplayWidth, |
| 569 | (int32_t)mDisplayHeight / 2}, |
| 570 | 1)); |
| 571 | ASSERT_NO_FATAL_FAILURE( |
| 572 | checkScreenCapture(255, 0, 0, |
| 573 | {(int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight / 2, |
| 574 | (int32_t)mDisplayWidth, (int32_t)mDisplayHeight}, |
| 575 | 1)); |
| 576 | ASSERT_NO_FATAL_FAILURE( |
| 577 | checkScreenCapture(0, 255, 0, |
| 578 | {0, (int32_t)mDisplayHeight / 2, |
| 579 | (int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight}, |
| 580 | 1)); |
| 581 | break; |
| 582 | case ui::Transform::ROT_180: |
| 583 | ASSERT_NO_FATAL_FAILURE(checkScreenCapture(0, 255, 0, |
| 584 | {0, 0, (int32_t)mDisplayWidth / 2, |
| 585 | (int32_t)mDisplayHeight / 2}, |
| 586 | 1)); |
| 587 | ASSERT_NO_FATAL_FAILURE( |
| 588 | checkScreenCapture(0, 0, 255, |
| 589 | {(int32_t)mDisplayWidth / 2, 0, (int32_t)mDisplayWidth, |
| 590 | (int32_t)mDisplayHeight / 2}, |
| 591 | 1)); |
| 592 | ASSERT_NO_FATAL_FAILURE( |
| 593 | checkScreenCapture(0, 0, 0, |
| 594 | {(int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight / 2, |
| 595 | (int32_t)mDisplayWidth, (int32_t)mDisplayHeight}, |
| 596 | 1)); |
| 597 | ASSERT_NO_FATAL_FAILURE( |
| 598 | checkScreenCapture(255, 0, 0, |
| 599 | {0, (int32_t)mDisplayHeight / 2, |
| 600 | (int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight}, |
| 601 | 1)); |
| 602 | break; |
| 603 | case ui::Transform::ROT_270: |
| 604 | ASSERT_NO_FATAL_FAILURE(checkScreenCapture(255, 0, 0, |
| 605 | {0, 0, (int32_t)mDisplayWidth / 2, |
| 606 | (int32_t)mDisplayHeight / 2}, |
| 607 | 1)); |
| 608 | ASSERT_NO_FATAL_FAILURE( |
| 609 | checkScreenCapture(0, 255, 0, |
| 610 | {(int32_t)mDisplayWidth / 2, 0, (int32_t)mDisplayWidth, |
| 611 | (int32_t)mDisplayHeight / 2}, |
| 612 | 1)); |
| 613 | ASSERT_NO_FATAL_FAILURE( |
| 614 | checkScreenCapture(0, 0, 255, |
| 615 | {(int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight / 2, |
| 616 | (int32_t)mDisplayWidth, (int32_t)mDisplayHeight}, |
| 617 | 1)); |
| 618 | ASSERT_NO_FATAL_FAILURE( |
| 619 | checkScreenCapture(0, 0, 0, |
| 620 | {0, (int32_t)mDisplayHeight / 2, |
| 621 | (int32_t)mDisplayWidth / 2, (int32_t)mDisplayHeight}, |
| 622 | 1)); |
| 623 | } |
| 624 | } |
| 625 | }; |
| 626 | |
| 627 | TEST_F(BLASTBufferQueueTransformTest, setTransform_ROT_0) { |
| 628 | test(ui::Transform::ROT_0); |
| 629 | } |
| 630 | |
| 631 | TEST_F(BLASTBufferQueueTransformTest, setTransform_FLIP_H) { |
| 632 | test(ui::Transform::FLIP_H); |
| 633 | } |
| 634 | |
| 635 | TEST_F(BLASTBufferQueueTransformTest, setTransform_FLIP_V) { |
| 636 | test(ui::Transform::FLIP_V); |
| 637 | } |
| 638 | |
| 639 | TEST_F(BLASTBufferQueueTransformTest, setTransform_ROT_90) { |
| 640 | test(ui::Transform::ROT_90); |
| 641 | } |
| 642 | |
| 643 | TEST_F(BLASTBufferQueueTransformTest, setTransform_ROT_180) { |
| 644 | test(ui::Transform::ROT_180); |
| 645 | } |
| 646 | |
| 647 | TEST_F(BLASTBufferQueueTransformTest, setTransform_ROT_270) { |
| 648 | test(ui::Transform::ROT_270); |
| 649 | } |
Valerie Hau | c5011f9 | 2019-10-11 09:52:07 -0700 | [diff] [blame] | 650 | } // namespace android |