Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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_NDEBUG 0 |
| 18 | #undef LOG_TAG |
| 19 | #define LOG_TAG "BufferStateLayer" |
| 20 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS |
| 21 | |
| 22 | #include "BufferStateLayer.h" |
Valerie Hau | a72e281 | 2019-01-23 13:40:39 -0800 | [diff] [blame] | 23 | #include "ColorLayer.h" |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 24 | |
Yiwei Zhang | 7e666a5 | 2018-11-15 13:33:42 -0800 | [diff] [blame] | 25 | #include "TimeStats/TimeStats.h" |
| 26 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 27 | #include <private/gui/SyncFeatures.h> |
Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 28 | #include <renderengine/Image.h> |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 29 | |
Valerie Hau | 0bc0915 | 2018-12-20 07:42:47 -0800 | [diff] [blame] | 30 | #include <limits> |
| 31 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 32 | namespace android { |
| 33 | |
Lloyd Pique | 42ab75e | 2018-09-12 20:46:03 -0700 | [diff] [blame] | 34 | // clang-format off |
| 35 | const std::array<float, 16> BufferStateLayer::IDENTITY_MATRIX{ |
| 36 | 1, 0, 0, 0, |
| 37 | 0, 1, 0, 0, |
| 38 | 0, 0, 1, 0, |
| 39 | 0, 0, 0, 1 |
| 40 | }; |
| 41 | // clang-format on |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 42 | |
Vishnu Nair | 6035634 | 2018-11-13 13:00:45 -0800 | [diff] [blame] | 43 | BufferStateLayer::BufferStateLayer(const LayerCreationArgs& args) : BufferLayer(args) { |
| 44 | mOverrideScalingMode = NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW; |
| 45 | } |
Lloyd Pique | 42ab75e | 2018-09-12 20:46:03 -0700 | [diff] [blame] | 46 | BufferStateLayer::~BufferStateLayer() = default; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 47 | |
| 48 | // ----------------------------------------------------------------------- |
| 49 | // Interface implementation for Layer |
| 50 | // ----------------------------------------------------------------------- |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 51 | void BufferStateLayer::onLayerDisplayed(const sp<Fence>& releaseFence) { |
Marissa Wall | 5a68a77 | 2018-12-22 17:43:42 -0800 | [diff] [blame] | 52 | // The previous release fence notifies the client that SurfaceFlinger is done with the previous |
| 53 | // buffer that was presented on this layer. The first transaction that came in this frame that |
| 54 | // replaced the previous buffer on this layer needs this release fence, because the fence will |
| 55 | // let the client know when that previous buffer is removed from the screen. |
| 56 | // |
| 57 | // Every other transaction on this layer does not need a release fence because no other |
| 58 | // Transactions that were set on this layer this frame are going to have their preceeding buffer |
| 59 | // removed from the display this frame. |
| 60 | // |
| 61 | // For example, if we have 3 transactions this frame. The first transaction doesn't contain a |
| 62 | // buffer so it doesn't need a previous release fence because the layer still needs the previous |
| 63 | // buffer. The second transaction contains a buffer so it needs a previous release fence because |
| 64 | // the previous buffer will be released this frame. The third transaction also contains a |
| 65 | // buffer. It replaces the buffer in the second transaction. The buffer in the second |
| 66 | // transaction will now no longer be presented so it is released immediately and the third |
| 67 | // transaction doesn't need a previous release fence. |
| 68 | for (auto& handle : mDrawingState.callbackHandles) { |
| 69 | if (handle->releasePreviousBuffer) { |
| 70 | handle->previousReleaseFence = releaseFence; |
| 71 | break; |
| 72 | } |
| 73 | } |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | void BufferStateLayer::setTransformHint(uint32_t /*orientation*/) const { |
| 77 | // TODO(marissaw): send the transform hint to buffer owner |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | void BufferStateLayer::releasePendingBuffer(nsecs_t /*dequeueReadyTime*/) { |
Marissa Wall | 5a68a77 | 2018-12-22 17:43:42 -0800 | [diff] [blame] | 82 | mFlinger->getTransactionCompletedThread().addPresentedCallbackHandles( |
| 83 | mDrawingState.callbackHandles); |
| 84 | |
| 85 | mDrawingState.callbackHandles = {}; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 86 | } |
| 87 | |
Ana Krulec | 010d219 | 2018-10-08 06:29:54 -0700 | [diff] [blame] | 88 | bool BufferStateLayer::shouldPresentNow(nsecs_t /*expectedPresentTime*/) const { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 89 | if (getSidebandStreamChanged() || getAutoRefresh()) { |
| 90 | return true; |
| 91 | } |
| 92 | |
Marissa Wall | 024a191 | 2018-08-13 13:55:35 -0700 | [diff] [blame] | 93 | return hasFrameUpdate(); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 94 | } |
| 95 | |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 96 | bool BufferStateLayer::willPresentCurrentTransaction() const { |
| 97 | // Returns true if the most recent Transaction applied to CurrentState will be presented. |
| 98 | return getSidebandStreamChanged() || getAutoRefresh() || |
Valerie Hau | aa19456 | 2019-02-05 16:21:38 -0800 | [diff] [blame] | 99 | (mCurrentState.modified && |
| 100 | (mCurrentState.buffer != nullptr || mCurrentState.bgColorLayer != nullptr)); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 101 | } |
| 102 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 103 | bool BufferStateLayer::getTransformToDisplayInverse() const { |
| 104 | return mCurrentState.transformToDisplayInverse; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 107 | void BufferStateLayer::pushPendingState() { |
| 108 | if (!mCurrentState.modified) { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 109 | return; |
| 110 | } |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 111 | mPendingStates.push_back(mCurrentState); |
| 112 | ATRACE_INT(mTransactionName.string(), mPendingStates.size()); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | bool BufferStateLayer::applyPendingStates(Layer::State* stateToCommit) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 116 | const bool stateUpdateAvailable = !mPendingStates.empty(); |
| 117 | while (!mPendingStates.empty()) { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 118 | popPendingState(stateToCommit); |
| 119 | } |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 120 | mCurrentStateModified = stateUpdateAvailable && mCurrentState.modified; |
| 121 | mCurrentState.modified = false; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 122 | return stateUpdateAvailable; |
| 123 | } |
| 124 | |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 125 | // Crop that applies to the window |
| 126 | Rect BufferStateLayer::getCrop(const Layer::State& /*s*/) const { |
| 127 | return Rect::INVALID_RECT; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | bool BufferStateLayer::setTransform(uint32_t transform) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 131 | if (mCurrentState.transform == transform) return false; |
| 132 | mCurrentState.sequence++; |
| 133 | mCurrentState.transform = transform; |
| 134 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 135 | setTransactionFlags(eTransactionNeeded); |
| 136 | return true; |
| 137 | } |
| 138 | |
| 139 | bool BufferStateLayer::setTransformToDisplayInverse(bool transformToDisplayInverse) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 140 | if (mCurrentState.transformToDisplayInverse == transformToDisplayInverse) return false; |
| 141 | mCurrentState.sequence++; |
| 142 | mCurrentState.transformToDisplayInverse = transformToDisplayInverse; |
| 143 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 144 | setTransactionFlags(eTransactionNeeded); |
| 145 | return true; |
| 146 | } |
| 147 | |
| 148 | bool BufferStateLayer::setCrop(const Rect& crop) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 149 | if (mCurrentState.crop == crop) return false; |
| 150 | mCurrentState.sequence++; |
| 151 | mCurrentState.crop = crop; |
| 152 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 153 | setTransactionFlags(eTransactionNeeded); |
| 154 | return true; |
| 155 | } |
| 156 | |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 157 | bool BufferStateLayer::setFrame(const Rect& frame) { |
| 158 | int x = frame.left; |
| 159 | int y = frame.top; |
| 160 | int w = frame.getWidth(); |
| 161 | int h = frame.getHeight(); |
| 162 | |
Marissa Wall | 0f3242d | 2018-12-20 15:10:22 -0800 | [diff] [blame] | 163 | if (x < 0) { |
| 164 | x = 0; |
| 165 | w = frame.right; |
| 166 | } |
| 167 | |
| 168 | if (y < 0) { |
| 169 | y = 0; |
| 170 | h = frame.bottom; |
| 171 | } |
| 172 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 173 | if (mCurrentState.active.transform.tx() == x && mCurrentState.active.transform.ty() == y && |
| 174 | mCurrentState.active.w == w && mCurrentState.active.h == h) { |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 175 | return false; |
| 176 | } |
| 177 | |
| 178 | if (!frame.isValid()) { |
| 179 | x = y = w = h = 0; |
| 180 | } |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 181 | mCurrentState.active.transform.set(x, y); |
| 182 | mCurrentState.active.w = w; |
| 183 | mCurrentState.active.h = h; |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 184 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 185 | mCurrentState.sequence++; |
| 186 | mCurrentState.modified = true; |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 187 | setTransactionFlags(eTransactionNeeded); |
| 188 | return true; |
| 189 | } |
| 190 | |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 191 | bool BufferStateLayer::setBuffer(const sp<GraphicBuffer>& buffer) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 192 | if (mCurrentState.buffer) { |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 193 | mReleasePreviousBuffer = true; |
| 194 | } |
| 195 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 196 | mCurrentState.sequence++; |
| 197 | mCurrentState.buffer = buffer; |
| 198 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 199 | setTransactionFlags(eTransactionNeeded); |
| 200 | return true; |
| 201 | } |
| 202 | |
| 203 | bool BufferStateLayer::setAcquireFence(const sp<Fence>& fence) { |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 204 | // The acquire fences of BufferStateLayers have already signaled before they are set |
| 205 | mCallbackHandleAcquireTime = fence->getSignalTime(); |
| 206 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 207 | mCurrentState.acquireFence = fence; |
| 208 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 209 | setTransactionFlags(eTransactionNeeded); |
| 210 | return true; |
| 211 | } |
| 212 | |
| 213 | bool BufferStateLayer::setDataspace(ui::Dataspace dataspace) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 214 | if (mCurrentState.dataspace == dataspace) return false; |
| 215 | mCurrentState.sequence++; |
| 216 | mCurrentState.dataspace = dataspace; |
| 217 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 218 | setTransactionFlags(eTransactionNeeded); |
| 219 | return true; |
| 220 | } |
| 221 | |
| 222 | bool BufferStateLayer::setHdrMetadata(const HdrMetadata& hdrMetadata) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 223 | if (mCurrentState.hdrMetadata == hdrMetadata) return false; |
| 224 | mCurrentState.sequence++; |
| 225 | mCurrentState.hdrMetadata = hdrMetadata; |
| 226 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 227 | setTransactionFlags(eTransactionNeeded); |
| 228 | return true; |
| 229 | } |
| 230 | |
| 231 | bool BufferStateLayer::setSurfaceDamageRegion(const Region& surfaceDamage) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 232 | mCurrentState.sequence++; |
| 233 | mCurrentState.surfaceDamageRegion = surfaceDamage; |
| 234 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 235 | setTransactionFlags(eTransactionNeeded); |
| 236 | return true; |
| 237 | } |
| 238 | |
| 239 | bool BufferStateLayer::setApi(int32_t api) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 240 | if (mCurrentState.api == api) return false; |
| 241 | mCurrentState.sequence++; |
| 242 | mCurrentState.api = api; |
| 243 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 244 | setTransactionFlags(eTransactionNeeded); |
| 245 | return true; |
| 246 | } |
| 247 | |
| 248 | bool BufferStateLayer::setSidebandStream(const sp<NativeHandle>& sidebandStream) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 249 | if (mCurrentState.sidebandStream == sidebandStream) return false; |
| 250 | mCurrentState.sequence++; |
| 251 | mCurrentState.sidebandStream = sidebandStream; |
| 252 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 253 | setTransactionFlags(eTransactionNeeded); |
| 254 | |
| 255 | if (!mSidebandStreamChanged.exchange(true)) { |
| 256 | // mSidebandStreamChanged was false |
| 257 | mFlinger->signalLayerUpdate(); |
| 258 | } |
| 259 | return true; |
| 260 | } |
| 261 | |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 262 | bool BufferStateLayer::setTransactionCompletedListeners( |
| 263 | const std::vector<sp<CallbackHandle>>& handles) { |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 264 | // If there is no handle, we will not send a callback so reset mReleasePreviousBuffer and return |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 265 | if (handles.empty()) { |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 266 | mReleasePreviousBuffer = false; |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 267 | return false; |
| 268 | } |
| 269 | |
| 270 | const bool willPresent = willPresentCurrentTransaction(); |
| 271 | |
| 272 | for (const auto& handle : handles) { |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 273 | // If this transaction set a buffer on this layer, release its previous buffer |
| 274 | handle->releasePreviousBuffer = mReleasePreviousBuffer; |
| 275 | |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 276 | // If this layer will be presented in this frame |
| 277 | if (willPresent) { |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 278 | // If this transaction set an acquire fence on this layer, set its acquire time |
| 279 | handle->acquireTime = mCallbackHandleAcquireTime; |
| 280 | |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 281 | // Notify the transaction completed thread that there is a pending latched callback |
| 282 | // handle |
Marissa Wall | 5a68a77 | 2018-12-22 17:43:42 -0800 | [diff] [blame] | 283 | mFlinger->getTransactionCompletedThread().registerPendingCallbackHandle(handle); |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 284 | |
| 285 | // Store so latched time and release fence can be set |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 286 | mCurrentState.callbackHandles.push_back(handle); |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 287 | |
| 288 | } else { // If this layer will NOT need to be relatched and presented this frame |
| 289 | // Notify the transaction completed thread this handle is done |
Marissa Wall | 5a68a77 | 2018-12-22 17:43:42 -0800 | [diff] [blame] | 290 | mFlinger->getTransactionCompletedThread().addUnpresentedCallbackHandle(handle); |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 291 | } |
| 292 | } |
| 293 | |
Marissa Wall | fda30bb | 2018-10-12 11:34:28 -0700 | [diff] [blame] | 294 | mReleasePreviousBuffer = false; |
| 295 | mCallbackHandleAcquireTime = -1; |
| 296 | |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 297 | return willPresent; |
| 298 | } |
| 299 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 300 | bool BufferStateLayer::setTransparentRegionHint(const Region& transparent) { |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 301 | mCurrentState.transparentRegionHint = transparent; |
| 302 | mCurrentState.modified = true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 303 | setTransactionFlags(eTransactionNeeded); |
| 304 | return true; |
| 305 | } |
| 306 | |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 307 | Rect BufferStateLayer::getBufferSize(const State& s) const { |
| 308 | // for buffer state layers we use the display frame size as the buffer size. |
| 309 | if (getActiveWidth(s) < UINT32_MAX && getActiveHeight(s) < UINT32_MAX) { |
| 310 | return Rect(getActiveWidth(s), getActiveHeight(s)); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 311 | } |
| 312 | |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 313 | // if the display frame is not defined, use the parent bounds as the buffer size. |
| 314 | const auto& p = mDrawingParent.promote(); |
| 315 | if (p != nullptr) { |
Vishnu Nair | 4351ad5 | 2019-02-11 14:13:02 -0800 | [diff] [blame^] | 316 | Rect parentBounds = Rect(p->getBounds(Region())); |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 317 | if (!parentBounds.isEmpty()) { |
| 318 | return parentBounds; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | // if there is no parent layer, use the buffer's bounds as the buffer size |
| 323 | if (s.buffer) { |
| 324 | return s.buffer->getBounds(); |
| 325 | } |
| 326 | return Rect::INVALID_RECT; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 327 | } |
Vishnu Nair | 4351ad5 | 2019-02-11 14:13:02 -0800 | [diff] [blame^] | 328 | |
| 329 | FloatRect BufferStateLayer::computeSourceBounds(const FloatRect& parentBounds) const { |
| 330 | const State& s(getDrawingState()); |
| 331 | // for buffer state layers we use the display frame size as the buffer size. |
| 332 | if (getActiveWidth(s) < UINT32_MAX && getActiveHeight(s) < UINT32_MAX) { |
| 333 | return FloatRect(0, 0, getActiveWidth(s), getActiveHeight(s)); |
| 334 | } |
| 335 | |
| 336 | // if the display frame is not defined, use the parent bounds as the buffer size. |
| 337 | return parentBounds; |
| 338 | } |
| 339 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 340 | // ----------------------------------------------------------------------- |
| 341 | |
| 342 | // ----------------------------------------------------------------------- |
| 343 | // Interface implementation for BufferLayer |
| 344 | // ----------------------------------------------------------------------- |
| 345 | bool BufferStateLayer::fenceHasSignaled() const { |
| 346 | if (latchUnsignaledBuffers()) { |
| 347 | return true; |
| 348 | } |
| 349 | |
| 350 | return getDrawingState().acquireFence->getStatus() == Fence::Status::Signaled; |
| 351 | } |
| 352 | |
| 353 | nsecs_t BufferStateLayer::getDesiredPresentTime() { |
| 354 | // TODO(marissaw): support an equivalent to desiredPresentTime for timestats metrics |
| 355 | return 0; |
| 356 | } |
| 357 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 358 | std::shared_ptr<FenceTime> BufferStateLayer::getCurrentFenceTime() const { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 359 | return std::make_shared<FenceTime>(getDrawingState().acquireFence); |
| 360 | } |
| 361 | |
| 362 | void BufferStateLayer::getDrawingTransformMatrix(float *matrix) { |
| 363 | std::copy(std::begin(mTransformMatrix), std::end(mTransformMatrix), matrix); |
| 364 | } |
| 365 | |
| 366 | uint32_t BufferStateLayer::getDrawingTransform() const { |
| 367 | return getDrawingState().transform; |
| 368 | } |
| 369 | |
| 370 | ui::Dataspace BufferStateLayer::getDrawingDataSpace() const { |
| 371 | return getDrawingState().dataspace; |
| 372 | } |
| 373 | |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 374 | // Crop that applies to the buffer |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 375 | Rect BufferStateLayer::getDrawingCrop() const { |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 376 | const State& s(getDrawingState()); |
| 377 | |
| 378 | if (s.crop.isEmpty() && s.buffer) { |
| 379 | return s.buffer->getBounds(); |
Valerie Hau | 0bc0915 | 2018-12-20 07:42:47 -0800 | [diff] [blame] | 380 | } else if (s.buffer) { |
| 381 | Rect crop = s.crop; |
| 382 | crop.left = std::max(crop.left, 0); |
| 383 | crop.top = std::max(crop.top, 0); |
| 384 | uint32_t bufferWidth = s.buffer->getWidth(); |
| 385 | uint32_t bufferHeight = s.buffer->getHeight(); |
| 386 | if (bufferHeight <= std::numeric_limits<int32_t>::max() && |
| 387 | bufferWidth <= std::numeric_limits<int32_t>::max()) { |
| 388 | crop.right = std::min(crop.right, static_cast<int32_t>(bufferWidth)); |
| 389 | crop.bottom = std::min(crop.bottom, static_cast<int32_t>(bufferHeight)); |
| 390 | } |
| 391 | if (!crop.isValid()) { |
| 392 | // Crop rect is out of bounds, return whole buffer |
| 393 | return s.buffer->getBounds(); |
| 394 | } |
| 395 | return crop; |
Marissa Wall | 861616d | 2018-10-22 12:52:23 -0700 | [diff] [blame] | 396 | } |
| 397 | return s.crop; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | uint32_t BufferStateLayer::getDrawingScalingMode() const { |
Marissa Wall | ec463ac | 2018-10-08 12:35:04 -0700 | [diff] [blame] | 401 | return NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | Region BufferStateLayer::getDrawingSurfaceDamage() const { |
| 405 | return getDrawingState().surfaceDamageRegion; |
| 406 | } |
| 407 | |
| 408 | const HdrMetadata& BufferStateLayer::getDrawingHdrMetadata() const { |
| 409 | return getDrawingState().hdrMetadata; |
| 410 | } |
| 411 | |
| 412 | int BufferStateLayer::getDrawingApi() const { |
| 413 | return getDrawingState().api; |
| 414 | } |
| 415 | |
| 416 | PixelFormat BufferStateLayer::getPixelFormat() const { |
Marissa Wall | 5aec641 | 2018-11-14 11:49:18 -0800 | [diff] [blame] | 417 | if (!mActiveBuffer) { |
| 418 | return PIXEL_FORMAT_NONE; |
| 419 | } |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 420 | return mActiveBuffer->format; |
| 421 | } |
| 422 | |
| 423 | uint64_t BufferStateLayer::getFrameNumber() const { |
| 424 | return mFrameNumber; |
| 425 | } |
| 426 | |
| 427 | bool BufferStateLayer::getAutoRefresh() const { |
| 428 | // TODO(marissaw): support shared buffer mode |
| 429 | return false; |
| 430 | } |
| 431 | |
| 432 | bool BufferStateLayer::getSidebandStreamChanged() const { |
| 433 | return mSidebandStreamChanged.load(); |
| 434 | } |
| 435 | |
Vishnu Nair | 6194e2e | 2019-02-06 12:58:39 -0800 | [diff] [blame] | 436 | bool BufferStateLayer::latchSidebandStream(bool& recomputeVisibleRegions) { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 437 | if (mSidebandStreamChanged.exchange(false)) { |
| 438 | const State& s(getDrawingState()); |
| 439 | // mSidebandStreamChanged was true |
| 440 | // replicated in LayerBE until FE/BE is ready to be synchronized |
| 441 | getBE().compositionInfo.hwc.sidebandStream = s.sidebandStream; |
| 442 | if (getBE().compositionInfo.hwc.sidebandStream != nullptr) { |
| 443 | setTransactionFlags(eTransactionNeeded); |
| 444 | mFlinger->setTransactionFlags(eTraversalNeeded); |
| 445 | } |
| 446 | recomputeVisibleRegions = true; |
| 447 | |
Vishnu Nair | 6194e2e | 2019-02-06 12:58:39 -0800 | [diff] [blame] | 448 | return true; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 449 | } |
Vishnu Nair | 6194e2e | 2019-02-06 12:58:39 -0800 | [diff] [blame] | 450 | return false; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 451 | } |
| 452 | |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 453 | bool BufferStateLayer::hasFrameUpdate() const { |
Valerie Hau | aa19456 | 2019-02-05 16:21:38 -0800 | [diff] [blame] | 454 | const State& c(getCurrentState()); |
| 455 | return mCurrentStateModified && (c.buffer != nullptr || c.bgColorLayer != nullptr); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 456 | } |
| 457 | |
| 458 | void BufferStateLayer::setFilteringEnabled(bool enabled) { |
| 459 | GLConsumer::computeTransformMatrix(mTransformMatrix.data(), mActiveBuffer, mCurrentCrop, |
| 460 | mCurrentTransform, enabled); |
| 461 | } |
| 462 | |
Alec Mouri | 39801c0 | 2018-10-10 10:44:47 -0700 | [diff] [blame] | 463 | status_t BufferStateLayer::bindTextureImage() { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 464 | const State& s(getDrawingState()); |
| 465 | auto& engine(mFlinger->getRenderEngine()); |
| 466 | |
Alec Mouri | e7d1d4a | 2019-02-05 01:13:46 +0000 | [diff] [blame] | 467 | return engine.bindExternalTextureBuffer(mTextureName, s.buffer, s.acquireFence, false); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 468 | } |
| 469 | |
Alec Mouri | 86770e5 | 2018-09-24 22:40:58 +0000 | [diff] [blame] | 470 | status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nsecs_t latchTime, |
| 471 | const sp<Fence>& releaseFence) { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 472 | const State& s(getDrawingState()); |
| 473 | |
| 474 | if (!s.buffer) { |
Valerie Hau | aa19456 | 2019-02-05 16:21:38 -0800 | [diff] [blame] | 475 | if (s.bgColorLayer) { |
| 476 | for (auto& handle : mDrawingState.callbackHandles) { |
| 477 | handle->latchTime = latchTime; |
| 478 | } |
| 479 | } |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 480 | return NO_ERROR; |
| 481 | } |
| 482 | |
Yiwei Zhang | 9689e2f | 2018-05-11 12:33:23 -0700 | [diff] [blame] | 483 | const int32_t layerID = getSequence(); |
| 484 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 485 | // Reject if the layer is invalid |
| 486 | uint32_t bufferWidth = s.buffer->width; |
| 487 | uint32_t bufferHeight = s.buffer->height; |
| 488 | |
Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 489 | if (s.transform & ui::Transform::ROT_90) { |
Peiyong Lin | 3db4234 | 2018-08-16 09:15:59 -0700 | [diff] [blame] | 490 | std::swap(bufferWidth, bufferHeight); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 491 | } |
| 492 | |
| 493 | if (s.transformToDisplayInverse) { |
| 494 | uint32_t invTransform = DisplayDevice::getPrimaryDisplayOrientationTransform(); |
Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 495 | if (invTransform & ui::Transform::ROT_90) { |
Peiyong Lin | 3db4234 | 2018-08-16 09:15:59 -0700 | [diff] [blame] | 496 | std::swap(bufferWidth, bufferHeight); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 497 | } |
| 498 | } |
| 499 | |
Vishnu Nair | 6035634 | 2018-11-13 13:00:45 -0800 | [diff] [blame] | 500 | if (getEffectiveScalingMode() == NATIVE_WINDOW_SCALING_MODE_FREEZE && |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 501 | (s.active.w != bufferWidth || s.active.h != bufferHeight)) { |
| 502 | ALOGE("[%s] rejecting buffer: " |
| 503 | "bufferWidth=%d, bufferHeight=%d, front.active.{w=%d, h=%d}", |
| 504 | mName.string(), bufferWidth, bufferHeight, s.active.w, s.active.h); |
Yiwei Zhang | 7e666a5 | 2018-11-15 13:33:42 -0800 | [diff] [blame] | 505 | mFlinger->mTimeStats->removeTimeRecord(layerID, getFrameNumber()); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 506 | return BAD_VALUE; |
| 507 | } |
| 508 | |
Marissa Wall | 5a68a77 | 2018-12-22 17:43:42 -0800 | [diff] [blame] | 509 | for (auto& handle : mDrawingState.callbackHandles) { |
| 510 | handle->latchTime = latchTime; |
| 511 | } |
Marissa Wall | e2ffb42 | 2018-10-12 11:33:52 -0700 | [diff] [blame] | 512 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 513 | // Handle sync fences |
Alec Mouri | 86770e5 | 2018-09-24 22:40:58 +0000 | [diff] [blame] | 514 | if (SyncFeatures::getInstance().useNativeFenceSync() && releaseFence != Fence::NO_FENCE) { |
| 515 | // TODO(alecmouri): Fail somewhere upstream if the fence is invalid. |
| 516 | if (!releaseFence->isValid()) { |
Yiwei Zhang | af8ee94 | 2018-11-22 00:15:23 -0800 | [diff] [blame] | 517 | mFlinger->mTimeStats->onDestroy(layerID); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 518 | return UNKNOWN_ERROR; |
| 519 | } |
| 520 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 521 | // Check status of fences first because merging is expensive. |
| 522 | // Merging an invalid fence with any other fence results in an |
| 523 | // invalid fence. |
| 524 | auto currentStatus = s.acquireFence->getStatus(); |
| 525 | if (currentStatus == Fence::Status::Invalid) { |
| 526 | ALOGE("Existing fence has invalid state"); |
Yiwei Zhang | af8ee94 | 2018-11-22 00:15:23 -0800 | [diff] [blame] | 527 | mFlinger->mTimeStats->onDestroy(layerID); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 528 | return BAD_VALUE; |
| 529 | } |
| 530 | |
Alec Mouri | 86770e5 | 2018-09-24 22:40:58 +0000 | [diff] [blame] | 531 | auto incomingStatus = releaseFence->getStatus(); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 532 | if (incomingStatus == Fence::Status::Invalid) { |
| 533 | ALOGE("New fence has invalid state"); |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 534 | mDrawingState.acquireFence = releaseFence; |
Yiwei Zhang | af8ee94 | 2018-11-22 00:15:23 -0800 | [diff] [blame] | 535 | mFlinger->mTimeStats->onDestroy(layerID); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 536 | return BAD_VALUE; |
| 537 | } |
| 538 | |
| 539 | // If both fences are signaled or both are unsignaled, we need to merge |
| 540 | // them to get an accurate timestamp. |
| 541 | if (currentStatus == incomingStatus) { |
| 542 | char fenceName[32] = {}; |
| 543 | snprintf(fenceName, 32, "%.28s:%d", mName.string(), mFrameNumber); |
Alec Mouri | 86770e5 | 2018-09-24 22:40:58 +0000 | [diff] [blame] | 544 | sp<Fence> mergedFence = |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 545 | Fence::merge(fenceName, mDrawingState.acquireFence, releaseFence); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 546 | if (!mergedFence.get()) { |
| 547 | ALOGE("failed to merge release fences"); |
| 548 | // synchronization is broken, the best we can do is hope fences |
| 549 | // signal in order so the new fence will act like a union |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 550 | mDrawingState.acquireFence = releaseFence; |
Yiwei Zhang | af8ee94 | 2018-11-22 00:15:23 -0800 | [diff] [blame] | 551 | mFlinger->mTimeStats->onDestroy(layerID); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 552 | return BAD_VALUE; |
| 553 | } |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 554 | mDrawingState.acquireFence = mergedFence; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 555 | } else if (incomingStatus == Fence::Status::Unsignaled) { |
| 556 | // If one fence has signaled and the other hasn't, the unsignaled |
| 557 | // fence will approximately correspond with the correct timestamp. |
| 558 | // There's a small race if both fences signal at about the same time |
| 559 | // and their statuses are retrieved with unfortunate timing. However, |
| 560 | // by this point, they will have both signaled and only the timestamp |
| 561 | // will be slightly off; any dependencies after this point will |
| 562 | // already have been met. |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 563 | mDrawingState.acquireFence = releaseFence; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 564 | } |
| 565 | } else { |
| 566 | // Bind the new buffer to the GL texture. |
| 567 | // |
| 568 | // Older devices require the "implicit" synchronization provided |
| 569 | // by glEGLImageTargetTexture2DOES, which this method calls. Newer |
| 570 | // devices will either call this in Layer::onDraw, or (if it's not |
| 571 | // a GL-composited layer) not at all. |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 572 | status_t err = bindTextureImage(); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 573 | if (err != NO_ERROR) { |
Yiwei Zhang | af8ee94 | 2018-11-22 00:15:23 -0800 | [diff] [blame] | 574 | mFlinger->mTimeStats->onDestroy(layerID); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 575 | return BAD_VALUE; |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | // TODO(marissaw): properly support mTimeStats |
Yiwei Zhang | 7e666a5 | 2018-11-15 13:33:42 -0800 | [diff] [blame] | 580 | mFlinger->mTimeStats->setPostTime(layerID, getFrameNumber(), getName().c_str(), latchTime); |
Lloyd Pique | 0449b0f | 2018-12-20 16:23:45 -0800 | [diff] [blame] | 581 | mFlinger->mTimeStats->setAcquireFence(layerID, getFrameNumber(), getCurrentFenceTime()); |
Yiwei Zhang | 7e666a5 | 2018-11-15 13:33:42 -0800 | [diff] [blame] | 582 | mFlinger->mTimeStats->setLatchTime(layerID, getFrameNumber(), latchTime); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 583 | |
| 584 | return NO_ERROR; |
| 585 | } |
| 586 | |
| 587 | status_t BufferStateLayer::updateActiveBuffer() { |
| 588 | const State& s(getDrawingState()); |
| 589 | |
| 590 | if (s.buffer == nullptr) { |
| 591 | return BAD_VALUE; |
| 592 | } |
| 593 | |
| 594 | mActiveBuffer = s.buffer; |
Alec Mouri | e7d1d4a | 2019-02-05 01:13:46 +0000 | [diff] [blame] | 595 | mActiveBufferFence = s.acquireFence; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 596 | getBE().compositionInfo.mBuffer = mActiveBuffer; |
| 597 | getBE().compositionInfo.mBufferSlot = 0; |
| 598 | |
| 599 | return NO_ERROR; |
| 600 | } |
| 601 | |
Alec Mouri | e7d1d4a | 2019-02-05 01:13:46 +0000 | [diff] [blame] | 602 | bool BufferStateLayer::useCachedBufferForClientComposition() const { |
| 603 | // TODO: Store a proper staleness bit to support EGLImage caching. |
| 604 | return false; |
| 605 | } |
| 606 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 607 | status_t BufferStateLayer::updateFrameNumber(nsecs_t /*latchTime*/) { |
| 608 | // TODO(marissaw): support frame history events |
| 609 | mCurrentFrameNumber = mFrameNumber; |
| 610 | return NO_ERROR; |
| 611 | } |
| 612 | |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 613 | void BufferStateLayer::setHwcLayerBuffer(DisplayId displayId) { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 614 | auto& hwcInfo = getBE().mHwcLayers[displayId]; |
| 615 | auto& hwcLayer = hwcInfo.layer; |
| 616 | |
| 617 | const State& s(getDrawingState()); |
| 618 | |
| 619 | // TODO(marissaw): support more than one slot |
| 620 | uint32_t hwcSlot = 0; |
| 621 | |
| 622 | auto error = hwcLayer->setBuffer(hwcSlot, s.buffer, s.acquireFence); |
| 623 | if (error != HWC2::Error::None) { |
| 624 | ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), |
| 625 | s.buffer->handle, to_string(error).c_str(), static_cast<int32_t>(error)); |
| 626 | } |
| 627 | |
Marissa Wall | 024a191 | 2018-08-13 13:55:35 -0700 | [diff] [blame] | 628 | mCurrentStateModified = false; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 629 | mFrameNumber++; |
| 630 | } |
| 631 | |
| 632 | void BufferStateLayer::onFirstRef() { |
Dan Stoza | 7b1b5a8 | 2018-07-31 16:00:21 -0700 | [diff] [blame] | 633 | BufferLayer::onFirstRef(); |
| 634 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 635 | if (const auto display = mFlinger->getDefaultDisplayDevice()) { |
| 636 | updateTransformHint(display); |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | } // namespace android |