The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | |
Vishnu Nair | 217d8e6 | 2018-09-12 16:34:49 -0700 | [diff] [blame] | 17 | #define LOG_TAG "LayerState" |
| 18 | |
Dominik Laskowski | 1f6fc70 | 2022-03-21 08:34:50 -0700 | [diff] [blame] | 19 | #include <cinttypes> |
| 20 | #include <cmath> |
Garfield Tan | 8a3083e | 2018-12-03 13:21:07 -0800 | [diff] [blame] | 21 | |
Huihong Luo | d3d8f8e | 2022-03-08 14:48:46 -0800 | [diff] [blame] | 22 | #include <android/gui/ISurfaceComposerClient.h> |
Marin Shalamanov | c598677 | 2021-03-16 16:09:49 +0100 | [diff] [blame] | 23 | #include <android/native_window.h> |
Mathias Agopian | c5b2c0b | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 24 | #include <binder/Parcel.h> |
Ady Abraham | 6cdd3fd | 2023-09-07 18:45:58 -0700 | [diff] [blame] | 25 | #include <gui/FrameRateUtils.h> |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 26 | #include <gui/IGraphicBufferProducer.h> |
Robert Carr | 4cdc58f | 2017-08-23 14:22:20 -0700 | [diff] [blame] | 27 | #include <gui/LayerState.h> |
Vishnu Nair | aa799bd | 2022-11-16 23:09:09 +0000 | [diff] [blame] | 28 | #include <gui/SurfaceControl.h> |
Marin Shalamanov | 3b1f7bc | 2021-03-16 15:51:53 +0100 | [diff] [blame] | 29 | #include <private/gui/ParcelUtils.h> |
Dominik Laskowski | 1f6fc70 | 2022-03-21 08:34:50 -0700 | [diff] [blame] | 30 | #include <system/window.h> |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 31 | #include <utils/Errors.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | |
Vishnu Nair | aa799bd | 2022-11-16 23:09:09 +0000 | [diff] [blame] | 33 | #define CHECK_DIFF(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD) \ |
| 34 | { \ |
| 35 | if ((OTHER.what & CHANGE_FLAG) && (FIELD != OTHER.FIELD)) { \ |
| 36 | DIFF_RESULT |= CHANGE_FLAG; \ |
| 37 | } \ |
| 38 | } |
| 39 | |
| 40 | #define CHECK_DIFF2(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD1, FIELD2) \ |
| 41 | { \ |
| 42 | CHECK_DIFF(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD1) \ |
| 43 | CHECK_DIFF(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD2) \ |
| 44 | } |
| 45 | |
| 46 | #define CHECK_DIFF3(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD1, FIELD2, FIELD3) \ |
| 47 | { \ |
| 48 | CHECK_DIFF(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD1) \ |
| 49 | CHECK_DIFF(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD2) \ |
| 50 | CHECK_DIFF(DIFF_RESULT, CHANGE_FLAG, OTHER, FIELD3) \ |
| 51 | } |
| 52 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | namespace android { |
| 54 | |
chaviw | 98318de | 2021-05-19 16:45:23 -0500 | [diff] [blame] | 55 | using gui::FocusRequest; |
| 56 | using gui::WindowInfoHandle; |
| 57 | |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 58 | layer_state_t::layer_state_t() |
Vishnu Nair | 685cfef | 2022-02-02 10:01:25 -0800 | [diff] [blame] | 59 | : surface(nullptr), |
| 60 | layerId(-1), |
| 61 | what(0), |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 62 | x(0), |
| 63 | y(0), |
| 64 | z(0), |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 65 | flags(0), |
| 66 | mask(0), |
| 67 | reserved(0), |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 68 | cornerRadius(0.0f), |
| 69 | backgroundBlurRadius(0), |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 70 | color(0), |
| 71 | bufferTransform(0), |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 72 | transformToDisplayInverse(false), |
| 73 | crop(Rect::INVALID_RECT), |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 74 | dataspace(ui::Dataspace::UNKNOWN), |
| 75 | surfaceDamageRegion(), |
| 76 | api(-1), |
| 77 | colorTransform(mat4()), |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 78 | bgColor(0), |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 79 | bgColorDataspace(ui::Dataspace::UNKNOWN), |
| 80 | colorSpaceAgnostic(false), |
| 81 | shadowRadius(0.0f), |
| 82 | frameRateSelectionPriority(-1), |
| 83 | frameRate(0.0f), |
| 84 | frameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT), |
Marin Shalamanov | c598677 | 2021-03-16 16:09:49 +0100 | [diff] [blame] | 85 | changeFrameRateStrategy(ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS), |
Andy Labrada | 096227e | 2022-06-15 16:58:11 +0000 | [diff] [blame] | 86 | defaultFrameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT), |
Rachel Lee | ce6e004 | 2023-06-27 11:22:54 -0700 | [diff] [blame] | 87 | frameRateCategory(ANATIVEWINDOW_FRAME_RATE_CATEGORY_DEFAULT), |
Rachel Lee | 67afbea | 2023-09-28 15:35:07 -0700 | [diff] [blame] | 88 | frameRateCategorySmoothSwitchOnly(false), |
Rachel Lee | 70f7b69 | 2023-11-22 11:24:02 -0800 | [diff] [blame^] | 89 | frameRateSelectionStrategy(ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_PROPAGATE), |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 90 | fixedTransformHint(ui::Transform::ROT_INVALID), |
Vishnu Nair | 1506b18 | 2021-02-22 14:35:15 -0800 | [diff] [blame] | 91 | autoRefresh(false), |
Winson Chung | a30f7c9 | 2021-06-29 15:42:56 -0700 | [diff] [blame] | 92 | isTrustedOverlay(false), |
Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 93 | borderEnabled(false), |
Vishnu Nair | 6bdec7d | 2021-05-10 15:01:13 -0700 | [diff] [blame] | 94 | bufferCrop(Rect::INVALID_RECT), |
| 95 | destinationFrame(Rect::INVALID_RECT), |
Vishnu Nair | 9cf4a4d | 2021-09-17 12:16:08 -0700 | [diff] [blame] | 96 | dropInputMode(gui::DropInputMode::NONE) { |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 97 | matrix.dsdx = matrix.dtdy = 1.0f; |
| 98 | matrix.dsdy = matrix.dtdx = 0.0f; |
| 99 | hdrMetadata.validTypes = 0; |
| 100 | } |
| 101 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 102 | status_t layer_state_t::write(Parcel& output) const |
| 103 | { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 104 | SAFE_PARCEL(output.writeStrongBinder, surface); |
Pablo Gamito | dbc3167 | 2020-09-01 18:28:58 +0000 | [diff] [blame] | 105 | SAFE_PARCEL(output.writeInt32, layerId); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 106 | SAFE_PARCEL(output.writeUint64, what); |
| 107 | SAFE_PARCEL(output.writeFloat, x); |
| 108 | SAFE_PARCEL(output.writeFloat, y); |
| 109 | SAFE_PARCEL(output.writeInt32, z); |
Dominik Laskowski | 29fa146 | 2021-04-27 15:51:50 -0700 | [diff] [blame] | 110 | SAFE_PARCEL(output.writeUint32, layerStack.id); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 111 | SAFE_PARCEL(output.writeUint32, flags); |
| 112 | SAFE_PARCEL(output.writeUint32, mask); |
| 113 | SAFE_PARCEL(matrix.write, output); |
chaviw | 2571450 | 2021-02-11 10:01:08 -0800 | [diff] [blame] | 114 | SAFE_PARCEL(output.write, crop); |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 115 | SAFE_PARCEL(SurfaceControl::writeNullableToParcel, output, relativeLayerSurfaceControl); |
| 116 | SAFE_PARCEL(SurfaceControl::writeNullableToParcel, output, parentSurfaceControlForChild); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 117 | SAFE_PARCEL(output.writeFloat, color.r); |
| 118 | SAFE_PARCEL(output.writeFloat, color.g); |
| 119 | SAFE_PARCEL(output.writeFloat, color.b); |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 120 | SAFE_PARCEL(output.writeFloat, color.a); |
chaviw | 98318de | 2021-05-19 16:45:23 -0500 | [diff] [blame] | 121 | SAFE_PARCEL(windowInfoHandle->writeToParcel, &output); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 122 | SAFE_PARCEL(output.write, transparentRegion); |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 123 | SAFE_PARCEL(output.writeUint32, bufferTransform); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 124 | SAFE_PARCEL(output.writeBool, transformToDisplayInverse); |
Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 125 | SAFE_PARCEL(output.writeBool, borderEnabled); |
Tianhao Yao | 10cea3c | 2022-03-30 01:37:22 +0000 | [diff] [blame] | 126 | SAFE_PARCEL(output.writeFloat, borderWidth); |
| 127 | SAFE_PARCEL(output.writeFloat, borderColor.r); |
| 128 | SAFE_PARCEL(output.writeFloat, borderColor.g); |
| 129 | SAFE_PARCEL(output.writeFloat, borderColor.b); |
| 130 | SAFE_PARCEL(output.writeFloat, borderColor.a); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 131 | SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dataspace)); |
| 132 | SAFE_PARCEL(output.write, hdrMetadata); |
| 133 | SAFE_PARCEL(output.write, surfaceDamageRegion); |
| 134 | SAFE_PARCEL(output.writeInt32, api); |
| 135 | |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 136 | if (sidebandStream) { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 137 | SAFE_PARCEL(output.writeBool, true); |
| 138 | SAFE_PARCEL(output.writeNativeHandle, sidebandStream->handle()); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 139 | } else { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 140 | SAFE_PARCEL(output.writeBool, false); |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 141 | } |
| 142 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 143 | SAFE_PARCEL(output.write, colorTransform.asArray(), 16 * sizeof(float)); |
| 144 | SAFE_PARCEL(output.writeFloat, cornerRadius); |
| 145 | SAFE_PARCEL(output.writeUint32, backgroundBlurRadius); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 146 | SAFE_PARCEL(output.writeParcelable, metadata); |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 147 | SAFE_PARCEL(output.writeFloat, bgColor.r); |
| 148 | SAFE_PARCEL(output.writeFloat, bgColor.g); |
| 149 | SAFE_PARCEL(output.writeFloat, bgColor.b); |
| 150 | SAFE_PARCEL(output.writeFloat, bgColor.a); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 151 | SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(bgColorDataspace)); |
| 152 | SAFE_PARCEL(output.writeBool, colorSpaceAgnostic); |
| 153 | SAFE_PARCEL(output.writeVectorSize, listeners); |
Valerie Hau | 9dab973 | 2019-08-20 09:29:25 -0700 | [diff] [blame] | 154 | |
| 155 | for (auto listener : listeners) { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 156 | SAFE_PARCEL(output.writeStrongBinder, listener.transactionCompletedListener); |
Vishnu Nair | fc46c1e | 2021-04-21 08:31:32 -0700 | [diff] [blame] | 157 | SAFE_PARCEL(output.writeParcelableVector, listener.callbackIds); |
Valerie Hau | 9dab973 | 2019-08-20 09:29:25 -0700 | [diff] [blame] | 158 | } |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 159 | SAFE_PARCEL(output.writeFloat, shadowRadius); |
| 160 | SAFE_PARCEL(output.writeInt32, frameRateSelectionPriority); |
| 161 | SAFE_PARCEL(output.writeFloat, frameRate); |
| 162 | SAFE_PARCEL(output.writeByte, frameRateCompatibility); |
Marin Shalamanov | c598677 | 2021-03-16 16:09:49 +0100 | [diff] [blame] | 163 | SAFE_PARCEL(output.writeByte, changeFrameRateStrategy); |
Andy Labrada | 096227e | 2022-06-15 16:58:11 +0000 | [diff] [blame] | 164 | SAFE_PARCEL(output.writeByte, defaultFrameRateCompatibility); |
Rachel Lee | ce6e004 | 2023-06-27 11:22:54 -0700 | [diff] [blame] | 165 | SAFE_PARCEL(output.writeByte, frameRateCategory); |
Rachel Lee | 67afbea | 2023-09-28 15:35:07 -0700 | [diff] [blame] | 166 | SAFE_PARCEL(output.writeBool, frameRateCategorySmoothSwitchOnly); |
Rachel Lee | 58cc90d | 2023-09-05 18:50:20 -0700 | [diff] [blame] | 167 | SAFE_PARCEL(output.writeByte, frameRateSelectionStrategy); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 168 | SAFE_PARCEL(output.writeUint32, fixedTransformHint); |
Vishnu Nair | cf26a0a | 2020-11-13 12:56:20 -0800 | [diff] [blame] | 169 | SAFE_PARCEL(output.writeBool, autoRefresh); |
Sally Qi | 81d95e6 | 2022-03-21 19:41:33 -0700 | [diff] [blame] | 170 | SAFE_PARCEL(output.writeBool, dimmingEnabled); |
Lucas Dupin | c3800b8 | 2020-10-02 16:24:48 -0700 | [diff] [blame] | 171 | |
| 172 | SAFE_PARCEL(output.writeUint32, blurRegions.size()); |
| 173 | for (auto region : blurRegions) { |
| 174 | SAFE_PARCEL(output.writeUint32, region.blurRadius); |
| 175 | SAFE_PARCEL(output.writeFloat, region.cornerRadiusTL); |
| 176 | SAFE_PARCEL(output.writeFloat, region.cornerRadiusTR); |
| 177 | SAFE_PARCEL(output.writeFloat, region.cornerRadiusBL); |
| 178 | SAFE_PARCEL(output.writeFloat, region.cornerRadiusBR); |
| 179 | SAFE_PARCEL(output.writeFloat, region.alpha); |
| 180 | SAFE_PARCEL(output.writeInt32, region.left); |
| 181 | SAFE_PARCEL(output.writeInt32, region.top); |
| 182 | SAFE_PARCEL(output.writeInt32, region.right); |
| 183 | SAFE_PARCEL(output.writeInt32, region.bottom); |
| 184 | } |
John Reck | cdb4ed7 | 2021-02-04 13:39:33 -0500 | [diff] [blame] | 185 | |
| 186 | SAFE_PARCEL(output.write, stretchEffect); |
chaviw | f3f40fe | 2021-04-27 15:54:02 -0500 | [diff] [blame] | 187 | SAFE_PARCEL(output.write, bufferCrop); |
Vishnu Nair | 6bdec7d | 2021-05-10 15:01:13 -0700 | [diff] [blame] | 188 | SAFE_PARCEL(output.write, destinationFrame); |
Winson Chung | a30f7c9 | 2021-06-29 15:42:56 -0700 | [diff] [blame] | 189 | SAFE_PARCEL(output.writeBool, isTrustedOverlay); |
John Reck | cdb4ed7 | 2021-02-04 13:39:33 -0500 | [diff] [blame] | 190 | |
Vishnu Nair | 9cf4a4d | 2021-09-17 12:16:08 -0700 | [diff] [blame] | 191 | SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); |
Vishnu Nair | 685cfef | 2022-02-02 10:01:25 -0800 | [diff] [blame] | 192 | |
| 193 | const bool hasBufferData = (bufferData != nullptr); |
| 194 | SAFE_PARCEL(output.writeBool, hasBufferData); |
| 195 | if (hasBufferData) { |
| 196 | SAFE_PARCEL(output.writeParcelable, *bufferData); |
| 197 | } |
Chavi Weingarten | 076acac | 2023-01-19 17:20:43 +0000 | [diff] [blame] | 198 | SAFE_PARCEL(output.writeParcelable, trustedPresentationThresholds); |
| 199 | SAFE_PARCEL(output.writeParcelable, trustedPresentationListener); |
Sally Qi | 963049b | 2023-03-23 14:06:21 -0700 | [diff] [blame] | 200 | SAFE_PARCEL(output.writeFloat, currentHdrSdrRatio); |
| 201 | SAFE_PARCEL(output.writeFloat, desiredHdrSdrRatio); |
Alec Mouri | f4af03e | 2023-02-11 00:25:24 +0000 | [diff] [blame] | 202 | SAFE_PARCEL(output.writeInt32, static_cast<int32_t>(cachingHint)) |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 203 | return NO_ERROR; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | status_t layer_state_t::read(const Parcel& input) |
| 207 | { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 208 | SAFE_PARCEL(input.readNullableStrongBinder, &surface); |
Pablo Gamito | dbc3167 | 2020-09-01 18:28:58 +0000 | [diff] [blame] | 209 | SAFE_PARCEL(input.readInt32, &layerId); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 210 | SAFE_PARCEL(input.readUint64, &what); |
| 211 | SAFE_PARCEL(input.readFloat, &x); |
| 212 | SAFE_PARCEL(input.readFloat, &y); |
| 213 | SAFE_PARCEL(input.readInt32, &z); |
Dominik Laskowski | 29fa146 | 2021-04-27 15:51:50 -0700 | [diff] [blame] | 214 | SAFE_PARCEL(input.readUint32, &layerStack.id); |
Robert Carr | 2c358bf | 2018-08-08 15:58:15 -0700 | [diff] [blame] | 215 | |
Vishnu Nair | f6eddb6 | 2021-01-27 22:02:11 -0800 | [diff] [blame] | 216 | SAFE_PARCEL(input.readUint32, &flags); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 217 | |
Vishnu Nair | f6eddb6 | 2021-01-27 22:02:11 -0800 | [diff] [blame] | 218 | SAFE_PARCEL(input.readUint32, &mask); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 219 | |
| 220 | SAFE_PARCEL(matrix.read, input); |
chaviw | 2571450 | 2021-02-11 10:01:08 -0800 | [diff] [blame] | 221 | SAFE_PARCEL(input.read, crop); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 222 | |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 223 | SAFE_PARCEL(SurfaceControl::readNullableFromParcel, input, &relativeLayerSurfaceControl); |
| 224 | SAFE_PARCEL(SurfaceControl::readNullableFromParcel, input, &parentSurfaceControlForChild); |
| 225 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 226 | float tmpFloat = 0; |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 227 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 228 | color.r = tmpFloat; |
| 229 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 230 | color.g = tmpFloat; |
| 231 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 232 | color.b = tmpFloat; |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 233 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 234 | color.a = tmpFloat; |
| 235 | |
chaviw | 98318de | 2021-05-19 16:45:23 -0500 | [diff] [blame] | 236 | SAFE_PARCEL(windowInfoHandle->readFromParcel, &input); |
Robert Carr | 2c358bf | 2018-08-08 15:58:15 -0700 | [diff] [blame] | 237 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 238 | SAFE_PARCEL(input.read, transparentRegion); |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 239 | SAFE_PARCEL(input.readUint32, &bufferTransform); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 240 | SAFE_PARCEL(input.readBool, &transformToDisplayInverse); |
Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 241 | SAFE_PARCEL(input.readBool, &borderEnabled); |
Tianhao Yao | 10cea3c | 2022-03-30 01:37:22 +0000 | [diff] [blame] | 242 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 243 | borderWidth = tmpFloat; |
| 244 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 245 | borderColor.r = tmpFloat; |
| 246 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 247 | borderColor.g = tmpFloat; |
| 248 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 249 | borderColor.b = tmpFloat; |
| 250 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 251 | borderColor.a = tmpFloat; |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 252 | |
Vishnu Nair | f6eddb6 | 2021-01-27 22:02:11 -0800 | [diff] [blame] | 253 | uint32_t tmpUint32 = 0; |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 254 | SAFE_PARCEL(input.readUint32, &tmpUint32); |
| 255 | dataspace = static_cast<ui::Dataspace>(tmpUint32); |
| 256 | |
| 257 | SAFE_PARCEL(input.read, hdrMetadata); |
| 258 | SAFE_PARCEL(input.read, surfaceDamageRegion); |
| 259 | SAFE_PARCEL(input.readInt32, &api); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 260 | |
| 261 | bool tmpBool = false; |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 262 | SAFE_PARCEL(input.readBool, &tmpBool); |
| 263 | if (tmpBool) { |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 264 | sidebandStream = NativeHandle::create(input.readNativeHandle(), true); |
| 265 | } |
| 266 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 267 | SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float)); |
| 268 | SAFE_PARCEL(input.readFloat, &cornerRadius); |
| 269 | SAFE_PARCEL(input.readUint32, &backgroundBlurRadius); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 270 | SAFE_PARCEL(input.readParcelable, &metadata); |
Marissa Wall | ebc2c05 | 2019-01-16 19:16:55 -0800 | [diff] [blame] | 271 | |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 272 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 273 | bgColor.r = tmpFloat; |
| 274 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 275 | bgColor.g = tmpFloat; |
| 276 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 277 | bgColor.b = tmpFloat; |
| 278 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
| 279 | bgColor.a = tmpFloat; |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 280 | SAFE_PARCEL(input.readUint32, &tmpUint32); |
| 281 | bgColorDataspace = static_cast<ui::Dataspace>(tmpUint32); |
| 282 | SAFE_PARCEL(input.readBool, &colorSpaceAgnostic); |
Valerie Hau | ed54efa | 2019-01-11 20:03:14 -0800 | [diff] [blame] | 283 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 284 | int32_t numListeners = 0; |
| 285 | SAFE_PARCEL_READ_SIZE(input.readInt32, &numListeners, input.dataSize()); |
Valerie Hau | 9dab973 | 2019-08-20 09:29:25 -0700 | [diff] [blame] | 286 | listeners.clear(); |
| 287 | for (int i = 0; i < numListeners; i++) { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 288 | sp<IBinder> listener; |
Valerie Hau | 9dab973 | 2019-08-20 09:29:25 -0700 | [diff] [blame] | 289 | std::vector<CallbackId> callbackIds; |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 290 | SAFE_PARCEL(input.readNullableStrongBinder, &listener); |
Vishnu Nair | fc46c1e | 2021-04-21 08:31:32 -0700 | [diff] [blame] | 291 | SAFE_PARCEL(input.readParcelableVector, &callbackIds); |
Valerie Hau | 9dab973 | 2019-08-20 09:29:25 -0700 | [diff] [blame] | 292 | listeners.emplace_back(listener, callbackIds); |
| 293 | } |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 294 | SAFE_PARCEL(input.readFloat, &shadowRadius); |
| 295 | SAFE_PARCEL(input.readInt32, &frameRateSelectionPriority); |
| 296 | SAFE_PARCEL(input.readFloat, &frameRate); |
| 297 | SAFE_PARCEL(input.readByte, &frameRateCompatibility); |
Marin Shalamanov | c598677 | 2021-03-16 16:09:49 +0100 | [diff] [blame] | 298 | SAFE_PARCEL(input.readByte, &changeFrameRateStrategy); |
Andy Labrada | 096227e | 2022-06-15 16:58:11 +0000 | [diff] [blame] | 299 | SAFE_PARCEL(input.readByte, &defaultFrameRateCompatibility); |
Rachel Lee | ce6e004 | 2023-06-27 11:22:54 -0700 | [diff] [blame] | 300 | SAFE_PARCEL(input.readByte, &frameRateCategory); |
Rachel Lee | 67afbea | 2023-09-28 15:35:07 -0700 | [diff] [blame] | 301 | SAFE_PARCEL(input.readBool, &frameRateCategorySmoothSwitchOnly); |
Rachel Lee | 58cc90d | 2023-09-05 18:50:20 -0700 | [diff] [blame] | 302 | SAFE_PARCEL(input.readByte, &frameRateSelectionStrategy); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 303 | SAFE_PARCEL(input.readUint32, &tmpUint32); |
| 304 | fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32); |
Vishnu Nair | cf26a0a | 2020-11-13 12:56:20 -0800 | [diff] [blame] | 305 | SAFE_PARCEL(input.readBool, &autoRefresh); |
Sally Qi | 81d95e6 | 2022-03-21 19:41:33 -0700 | [diff] [blame] | 306 | SAFE_PARCEL(input.readBool, &dimmingEnabled); |
Lucas Dupin | c3800b8 | 2020-10-02 16:24:48 -0700 | [diff] [blame] | 307 | |
| 308 | uint32_t numRegions = 0; |
| 309 | SAFE_PARCEL(input.readUint32, &numRegions); |
| 310 | blurRegions.clear(); |
| 311 | for (uint32_t i = 0; i < numRegions; i++) { |
| 312 | BlurRegion region; |
| 313 | SAFE_PARCEL(input.readUint32, ®ion.blurRadius); |
| 314 | SAFE_PARCEL(input.readFloat, ®ion.cornerRadiusTL); |
| 315 | SAFE_PARCEL(input.readFloat, ®ion.cornerRadiusTR); |
| 316 | SAFE_PARCEL(input.readFloat, ®ion.cornerRadiusBL); |
| 317 | SAFE_PARCEL(input.readFloat, ®ion.cornerRadiusBR); |
| 318 | SAFE_PARCEL(input.readFloat, ®ion.alpha); |
| 319 | SAFE_PARCEL(input.readInt32, ®ion.left); |
| 320 | SAFE_PARCEL(input.readInt32, ®ion.top); |
| 321 | SAFE_PARCEL(input.readInt32, ®ion.right); |
| 322 | SAFE_PARCEL(input.readInt32, ®ion.bottom); |
| 323 | blurRegions.push_back(region); |
| 324 | } |
John Reck | cdb4ed7 | 2021-02-04 13:39:33 -0500 | [diff] [blame] | 325 | |
| 326 | SAFE_PARCEL(input.read, stretchEffect); |
chaviw | f3f40fe | 2021-04-27 15:54:02 -0500 | [diff] [blame] | 327 | SAFE_PARCEL(input.read, bufferCrop); |
Vishnu Nair | 6bdec7d | 2021-05-10 15:01:13 -0700 | [diff] [blame] | 328 | SAFE_PARCEL(input.read, destinationFrame); |
Winson Chung | a30f7c9 | 2021-06-29 15:42:56 -0700 | [diff] [blame] | 329 | SAFE_PARCEL(input.readBool, &isTrustedOverlay); |
John Reck | cdb4ed7 | 2021-02-04 13:39:33 -0500 | [diff] [blame] | 330 | |
Vishnu Nair | 9cf4a4d | 2021-09-17 12:16:08 -0700 | [diff] [blame] | 331 | uint32_t mode; |
| 332 | SAFE_PARCEL(input.readUint32, &mode); |
| 333 | dropInputMode = static_cast<gui::DropInputMode>(mode); |
Vishnu Nair | 685cfef | 2022-02-02 10:01:25 -0800 | [diff] [blame] | 334 | |
| 335 | bool hasBufferData; |
| 336 | SAFE_PARCEL(input.readBool, &hasBufferData); |
| 337 | if (hasBufferData) { |
| 338 | bufferData = std::make_shared<BufferData>(); |
| 339 | SAFE_PARCEL(input.readParcelable, bufferData.get()); |
| 340 | } else { |
| 341 | bufferData = nullptr; |
| 342 | } |
Chavi Weingarten | 076acac | 2023-01-19 17:20:43 +0000 | [diff] [blame] | 343 | |
| 344 | SAFE_PARCEL(input.readParcelable, &trustedPresentationThresholds); |
| 345 | SAFE_PARCEL(input.readParcelable, &trustedPresentationListener); |
| 346 | |
John Reck | 6879659 | 2023-01-25 13:47:12 -0500 | [diff] [blame] | 347 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
Sally Qi | 963049b | 2023-03-23 14:06:21 -0700 | [diff] [blame] | 348 | currentHdrSdrRatio = tmpFloat; |
John Reck | 6879659 | 2023-01-25 13:47:12 -0500 | [diff] [blame] | 349 | SAFE_PARCEL(input.readFloat, &tmpFloat); |
Sally Qi | 963049b | 2023-03-23 14:06:21 -0700 | [diff] [blame] | 350 | desiredHdrSdrRatio = tmpFloat; |
John Reck | 6879659 | 2023-01-25 13:47:12 -0500 | [diff] [blame] | 351 | |
Alec Mouri | f4af03e | 2023-02-11 00:25:24 +0000 | [diff] [blame] | 352 | int32_t tmpInt32; |
| 353 | SAFE_PARCEL(input.readInt32, &tmpInt32); |
| 354 | cachingHint = static_cast<gui::CachingHint>(tmpInt32); |
| 355 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 356 | return NO_ERROR; |
| 357 | } |
| 358 | |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 359 | status_t ComposerState::write(Parcel& output) const { |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 360 | return state.write(output); |
| 361 | } |
| 362 | |
| 363 | status_t ComposerState::read(const Parcel& input) { |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 364 | return state.read(input); |
| 365 | } |
| 366 | |
Dominik Laskowski | 29fa146 | 2021-04-27 15:51:50 -0700 | [diff] [blame] | 367 | DisplayState::DisplayState() = default; |
Pablo Ceballos | 60d6922 | 2015-08-07 14:47:20 -0700 | [diff] [blame] | 368 | |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 369 | status_t DisplayState::write(Parcel& output) const { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 370 | SAFE_PARCEL(output.writeStrongBinder, token); |
| 371 | SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(surface)); |
| 372 | SAFE_PARCEL(output.writeUint32, what); |
Evan Rosky | 2239b37 | 2021-05-20 13:43:47 -0700 | [diff] [blame] | 373 | SAFE_PARCEL(output.writeUint32, flags); |
Dominik Laskowski | 29fa146 | 2021-04-27 15:51:50 -0700 | [diff] [blame] | 374 | SAFE_PARCEL(output.writeUint32, layerStack.id); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 375 | SAFE_PARCEL(output.writeUint32, toRotationInt(orientation)); |
| 376 | SAFE_PARCEL(output.write, layerStackSpaceRect); |
| 377 | SAFE_PARCEL(output.write, orientedDisplaySpaceRect); |
| 378 | SAFE_PARCEL(output.writeUint32, width); |
| 379 | SAFE_PARCEL(output.writeUint32, height); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 380 | return NO_ERROR; |
| 381 | } |
| 382 | |
| 383 | status_t DisplayState::read(const Parcel& input) { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 384 | SAFE_PARCEL(input.readStrongBinder, &token); |
| 385 | sp<IBinder> tmpBinder; |
| 386 | SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder); |
| 387 | surface = interface_cast<IGraphicBufferProducer>(tmpBinder); |
| 388 | |
| 389 | SAFE_PARCEL(input.readUint32, &what); |
Evan Rosky | 2239b37 | 2021-05-20 13:43:47 -0700 | [diff] [blame] | 390 | SAFE_PARCEL(input.readUint32, &flags); |
Dominik Laskowski | 29fa146 | 2021-04-27 15:51:50 -0700 | [diff] [blame] | 391 | SAFE_PARCEL(input.readUint32, &layerStack.id); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 392 | uint32_t tmpUint = 0; |
| 393 | SAFE_PARCEL(input.readUint32, &tmpUint); |
| 394 | orientation = ui::toRotation(tmpUint); |
| 395 | |
| 396 | SAFE_PARCEL(input.read, layerStackSpaceRect); |
| 397 | SAFE_PARCEL(input.read, orientedDisplaySpaceRect); |
| 398 | SAFE_PARCEL(input.readUint32, &width); |
| 399 | SAFE_PARCEL(input.readUint32, &height); |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 400 | return NO_ERROR; |
| 401 | } |
| 402 | |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 403 | void DisplayState::merge(const DisplayState& other) { |
| 404 | if (other.what & eSurfaceChanged) { |
| 405 | what |= eSurfaceChanged; |
| 406 | surface = other.surface; |
| 407 | } |
| 408 | if (other.what & eLayerStackChanged) { |
| 409 | what |= eLayerStackChanged; |
| 410 | layerStack = other.layerStack; |
| 411 | } |
Evan Rosky | 2239b37 | 2021-05-20 13:43:47 -0700 | [diff] [blame] | 412 | if (other.what & eFlagsChanged) { |
| 413 | what |= eFlagsChanged; |
| 414 | flags = other.flags; |
| 415 | } |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 416 | if (other.what & eDisplayProjectionChanged) { |
| 417 | what |= eDisplayProjectionChanged; |
| 418 | orientation = other.orientation; |
Marin Shalamanov | 6ad317c | 2020-07-29 23:34:07 +0200 | [diff] [blame] | 419 | layerStackSpaceRect = other.layerStackSpaceRect; |
| 420 | orientedDisplaySpaceRect = other.orientedDisplaySpaceRect; |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 421 | } |
| 422 | if (other.what & eDisplaySizeChanged) { |
| 423 | what |= eDisplaySizeChanged; |
| 424 | width = other.width; |
| 425 | height = other.height; |
| 426 | } |
| 427 | } |
| 428 | |
Sally Qi | 6bb1282 | 2022-10-05 11:42:30 -0700 | [diff] [blame] | 429 | void DisplayState::sanitize(int32_t permissions) { |
| 430 | if (what & DisplayState::eLayerStackChanged) { |
| 431 | if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { |
| 432 | what &= ~DisplayState::eLayerStackChanged; |
| 433 | ALOGE("Stripped attempt to set eLayerStackChanged in sanitize"); |
| 434 | } |
| 435 | } |
| 436 | if (what & DisplayState::eDisplayProjectionChanged) { |
| 437 | if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { |
| 438 | what &= ~DisplayState::eDisplayProjectionChanged; |
| 439 | ALOGE("Stripped attempt to set eDisplayProjectionChanged in sanitize"); |
| 440 | } |
| 441 | } |
| 442 | if (what & DisplayState::eSurfaceChanged) { |
| 443 | if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { |
| 444 | what &= ~DisplayState::eSurfaceChanged; |
| 445 | ALOGE("Stripped attempt to set eSurfaceChanged in sanitize"); |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | |
Robert Carr | de6d7b4 | 2022-01-07 18:23:06 -0800 | [diff] [blame] | 450 | void layer_state_t::sanitize(int32_t permissions) { |
| 451 | // TODO: b/109894387 |
| 452 | // |
| 453 | // SurfaceFlinger's renderer is not prepared to handle cropping in the face of arbitrary |
| 454 | // rotation. To see the problem observe that if we have a square parent, and a child |
| 455 | // of the same size, then we rotate the child 45 degrees around its center, the child |
| 456 | // must now be cropped to a non rectangular 8 sided region. |
| 457 | // |
| 458 | // Of course we can fix this in the future. For now, we are lucky, SurfaceControl is |
| 459 | // private API, and arbitrary rotation is used in limited use cases, for instance: |
| 460 | // - WindowManager only uses rotation in one case, which is on a top level layer in which |
| 461 | // cropping is not an issue. |
| 462 | // - Launcher, as a privileged app, uses this to transition an application to PiP |
| 463 | // (picture-in-picture) mode. |
| 464 | // |
| 465 | // However given that abuse of rotation matrices could lead to surfaces extending outside |
| 466 | // of cropped areas, we need to prevent non-root clients without permission |
| 467 | // ACCESS_SURFACE_FLINGER nor ROTATE_SURFACE_FLINGER |
| 468 | // (a.k.a. everyone except WindowManager / tests / Launcher) from setting non rectangle |
| 469 | // preserving transformations. |
| 470 | if (what & eMatrixChanged) { |
| 471 | if (!(permissions & Permission::ROTATE_SURFACE_FLINGER)) { |
| 472 | ui::Transform t; |
| 473 | t.set(matrix.dsdx, matrix.dtdy, matrix.dtdx, matrix.dsdy); |
| 474 | if (!t.preserveRects()) { |
| 475 | what &= ~eMatrixChanged; |
| 476 | ALOGE("Stripped non rect preserving matrix in sanitize"); |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | if (what & eFlagsChanged) { |
| 482 | if ((flags & eLayerIsDisplayDecoration) && |
| 483 | !(permissions & Permission::INTERNAL_SYSTEM_WINDOW)) { |
| 484 | flags &= ~eLayerIsDisplayDecoration; |
| 485 | ALOGE("Stripped attempt to set LayerIsDisplayDecoration in sanitize"); |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | if (what & layer_state_t::eInputInfoChanged) { |
| 490 | if (!(permissions & Permission::ACCESS_SURFACE_FLINGER)) { |
| 491 | what &= ~eInputInfoChanged; |
| 492 | ALOGE("Stripped attempt to set eInputInfoChanged in sanitize"); |
| 493 | } |
| 494 | } |
| 495 | if (what & layer_state_t::eTrustedOverlayChanged) { |
| 496 | if (!(permissions & Permission::ACCESS_SURFACE_FLINGER)) { |
| 497 | what &= ~eTrustedOverlayChanged; |
| 498 | ALOGE("Stripped attempt to set eTrustedOverlay in sanitize"); |
| 499 | } |
| 500 | } |
| 501 | if (what & layer_state_t::eDropInputModeChanged) { |
| 502 | if (!(permissions & Permission::ACCESS_SURFACE_FLINGER)) { |
| 503 | what &= ~eDropInputModeChanged; |
| 504 | ALOGE("Stripped attempt to set eDropInputModeChanged in sanitize"); |
| 505 | } |
| 506 | } |
| 507 | if (what & layer_state_t::eFrameRateSelectionPriority) { |
| 508 | if (!(permissions & Permission::ACCESS_SURFACE_FLINGER)) { |
| 509 | what &= ~eFrameRateSelectionPriority; |
| 510 | ALOGE("Stripped attempt to set eFrameRateSelectionPriority in sanitize"); |
| 511 | } |
| 512 | } |
| 513 | if (what & layer_state_t::eFrameRateChanged) { |
| 514 | if (!ValidateFrameRate(frameRate, frameRateCompatibility, |
| 515 | changeFrameRateStrategy, |
| 516 | "layer_state_t::sanitize", |
| 517 | permissions & Permission::ACCESS_SURFACE_FLINGER)) { |
| 518 | what &= ~eFrameRateChanged; // logged in ValidateFrameRate |
| 519 | } |
| 520 | } |
| 521 | } |
| 522 | |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 523 | void layer_state_t::merge(const layer_state_t& other) { |
| 524 | if (other.what & ePositionChanged) { |
| 525 | what |= ePositionChanged; |
| 526 | x = other.x; |
| 527 | y = other.y; |
| 528 | } |
| 529 | if (other.what & eLayerChanged) { |
| 530 | what |= eLayerChanged; |
chaviw | 3237758 | 2019-05-13 11:15:19 -0700 | [diff] [blame] | 531 | what &= ~eRelativeLayerChanged; |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 532 | z = other.z; |
| 533 | } |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 534 | if (other.what & eAlphaChanged) { |
| 535 | what |= eAlphaChanged; |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 536 | color.a = other.color.a; |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 537 | } |
| 538 | if (other.what & eMatrixChanged) { |
| 539 | what |= eMatrixChanged; |
| 540 | matrix = other.matrix; |
| 541 | } |
| 542 | if (other.what & eTransparentRegionChanged) { |
| 543 | what |= eTransparentRegionChanged; |
| 544 | transparentRegion = other.transparentRegion; |
| 545 | } |
| 546 | if (other.what & eFlagsChanged) { |
| 547 | what |= eFlagsChanged; |
Vishnu Nair | 996bc42 | 2019-07-16 14:15:33 -0700 | [diff] [blame] | 548 | flags &= ~other.mask; |
| 549 | flags |= (other.flags & other.mask); |
| 550 | mask |= other.mask; |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 551 | } |
| 552 | if (other.what & eLayerStackChanged) { |
| 553 | what |= eLayerStackChanged; |
| 554 | layerStack = other.layerStack; |
| 555 | } |
Lucas Dupin | 1b6531c | 2018-07-05 17:18:21 -0700 | [diff] [blame] | 556 | if (other.what & eCornerRadiusChanged) { |
| 557 | what |= eCornerRadiusChanged; |
| 558 | cornerRadius = other.cornerRadius; |
| 559 | } |
Lucas Dupin | 19c8f0e | 2019-11-25 17:55:44 -0800 | [diff] [blame] | 560 | if (other.what & eBackgroundBlurRadiusChanged) { |
| 561 | what |= eBackgroundBlurRadiusChanged; |
| 562 | backgroundBlurRadius = other.backgroundBlurRadius; |
| 563 | } |
Lucas Dupin | c3800b8 | 2020-10-02 16:24:48 -0700 | [diff] [blame] | 564 | if (other.what & eBlurRegionsChanged) { |
| 565 | what |= eBlurRegionsChanged; |
| 566 | blurRegions = other.blurRegions; |
| 567 | } |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 568 | if (other.what & eRelativeLayerChanged) { |
| 569 | what |= eRelativeLayerChanged; |
chaviw | 3237758 | 2019-05-13 11:15:19 -0700 | [diff] [blame] | 570 | what &= ~eLayerChanged; |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 571 | z = other.z; |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 572 | relativeLayerSurfaceControl = other.relativeLayerSurfaceControl; |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 573 | } |
| 574 | if (other.what & eReparent) { |
| 575 | what |= eReparent; |
Pablo Gamito | 11dcc22 | 2020-09-12 15:49:39 +0000 | [diff] [blame] | 576 | parentSurfaceControlForChild = other.parentSurfaceControlForChild; |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 577 | } |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 578 | if (other.what & eBufferTransformChanged) { |
| 579 | what |= eBufferTransformChanged; |
| 580 | bufferTransform = other.bufferTransform; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 581 | } |
| 582 | if (other.what & eTransformToDisplayInverseChanged) { |
| 583 | what |= eTransformToDisplayInverseChanged; |
| 584 | transformToDisplayInverse = other.transformToDisplayInverse; |
| 585 | } |
| 586 | if (other.what & eCropChanged) { |
| 587 | what |= eCropChanged; |
| 588 | crop = other.crop; |
| 589 | } |
| 590 | if (other.what & eBufferChanged) { |
| 591 | what |= eBufferChanged; |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 592 | bufferData = other.bufferData; |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 593 | } |
Chavi Weingarten | 076acac | 2023-01-19 17:20:43 +0000 | [diff] [blame] | 594 | if (other.what & eTrustedPresentationInfoChanged) { |
| 595 | what |= eTrustedPresentationInfoChanged; |
| 596 | trustedPresentationListener = other.trustedPresentationListener; |
| 597 | trustedPresentationThresholds = other.trustedPresentationThresholds; |
| 598 | } |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 599 | if (other.what & eDataspaceChanged) { |
| 600 | what |= eDataspaceChanged; |
| 601 | dataspace = other.dataspace; |
| 602 | } |
John Reck | 6879659 | 2023-01-25 13:47:12 -0500 | [diff] [blame] | 603 | if (other.what & eExtendedRangeBrightnessChanged) { |
| 604 | what |= eExtendedRangeBrightnessChanged; |
Sally Qi | 963049b | 2023-03-23 14:06:21 -0700 | [diff] [blame] | 605 | desiredHdrSdrRatio = other.desiredHdrSdrRatio; |
| 606 | currentHdrSdrRatio = other.currentHdrSdrRatio; |
John Reck | 6879659 | 2023-01-25 13:47:12 -0500 | [diff] [blame] | 607 | } |
Alec Mouri | f4af03e | 2023-02-11 00:25:24 +0000 | [diff] [blame] | 608 | if (other.what & eCachingHintChanged) { |
| 609 | what |= eCachingHintChanged; |
| 610 | cachingHint = other.cachingHint; |
| 611 | } |
Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 612 | if (other.what & eHdrMetadataChanged) { |
| 613 | what |= eHdrMetadataChanged; |
| 614 | hdrMetadata = other.hdrMetadata; |
| 615 | } |
| 616 | if (other.what & eSurfaceDamageRegionChanged) { |
| 617 | what |= eSurfaceDamageRegionChanged; |
| 618 | surfaceDamageRegion = other.surfaceDamageRegion; |
| 619 | } |
| 620 | if (other.what & eApiChanged) { |
| 621 | what |= eApiChanged; |
| 622 | api = other.api; |
| 623 | } |
| 624 | if (other.what & eSidebandStreamChanged) { |
| 625 | what |= eSidebandStreamChanged; |
| 626 | sidebandStream = other.sidebandStream; |
| 627 | } |
Peiyong Lin | d378863 | 2018-09-18 16:01:31 -0700 | [diff] [blame] | 628 | if (other.what & eColorTransformChanged) { |
| 629 | what |= eColorTransformChanged; |
| 630 | colorTransform = other.colorTransform; |
| 631 | } |
Marissa Wall | 3dad52d | 2019-03-22 14:03:19 -0700 | [diff] [blame] | 632 | if (other.what & eHasListenerCallbacksChanged) { |
| 633 | what |= eHasListenerCallbacksChanged; |
Marissa Wall | c837b5e | 2018-10-12 10:04:44 -0700 | [diff] [blame] | 634 | } |
Robert Carr | 2c358bf | 2018-08-08 15:58:15 -0700 | [diff] [blame] | 635 | if (other.what & eInputInfoChanged) { |
| 636 | what |= eInputInfoChanged; |
chaviw | 98318de | 2021-05-19 16:45:23 -0500 | [diff] [blame] | 637 | windowInfoHandle = new WindowInfoHandle(*other.windowInfoHandle); |
Robert Carr | 2c358bf | 2018-08-08 15:58:15 -0700 | [diff] [blame] | 638 | } |
Valerie Hau | dd0b757 | 2019-01-29 14:59:27 -0800 | [diff] [blame] | 639 | if (other.what & eBackgroundColorChanged) { |
| 640 | what |= eBackgroundColorChanged; |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 641 | bgColor = other.bgColor; |
Valerie Hau | dd0b757 | 2019-01-29 14:59:27 -0800 | [diff] [blame] | 642 | bgColorDataspace = other.bgColorDataspace; |
Valerie Hau | ed54efa | 2019-01-11 20:03:14 -0800 | [diff] [blame] | 643 | } |
Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 644 | if (other.what & eMetadataChanged) { |
| 645 | what |= eMetadataChanged; |
| 646 | metadata.merge(other.metadata); |
| 647 | } |
Vishnu Nair | c97b8db | 2019-10-29 18:19:35 -0700 | [diff] [blame] | 648 | if (other.what & eShadowRadiusChanged) { |
| 649 | what |= eShadowRadiusChanged; |
| 650 | shadowRadius = other.shadowRadius; |
| 651 | } |
Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 652 | if (other.what & eRenderBorderChanged) { |
| 653 | what |= eRenderBorderChanged; |
| 654 | borderEnabled = other.borderEnabled; |
Tianhao Yao | 10cea3c | 2022-03-30 01:37:22 +0000 | [diff] [blame] | 655 | borderWidth = other.borderWidth; |
| 656 | borderColor = other.borderColor; |
Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 657 | } |
Andy Labrada | 096227e | 2022-06-15 16:58:11 +0000 | [diff] [blame] | 658 | if (other.what & eDefaultFrameRateCompatibilityChanged) { |
| 659 | what |= eDefaultFrameRateCompatibilityChanged; |
| 660 | defaultFrameRateCompatibility = other.defaultFrameRateCompatibility; |
| 661 | } |
Ana Krulec | c84d09b | 2019-11-02 23:10:29 +0100 | [diff] [blame] | 662 | if (other.what & eFrameRateSelectionPriority) { |
| 663 | what |= eFrameRateSelectionPriority; |
| 664 | frameRateSelectionPriority = other.frameRateSelectionPriority; |
| 665 | } |
Steven Thomas | 3172e20 | 2020-01-06 19:25:30 -0800 | [diff] [blame] | 666 | if (other.what & eFrameRateChanged) { |
| 667 | what |= eFrameRateChanged; |
| 668 | frameRate = other.frameRate; |
Steven Thomas | 62a4cf8 | 2020-01-31 12:04:03 -0800 | [diff] [blame] | 669 | frameRateCompatibility = other.frameRateCompatibility; |
Marin Shalamanov | c598677 | 2021-03-16 16:09:49 +0100 | [diff] [blame] | 670 | changeFrameRateStrategy = other.changeFrameRateStrategy; |
Steven Thomas | 3172e20 | 2020-01-06 19:25:30 -0800 | [diff] [blame] | 671 | } |
Rachel Lee | ce6e004 | 2023-06-27 11:22:54 -0700 | [diff] [blame] | 672 | if (other.what & eFrameRateCategoryChanged) { |
| 673 | what |= eFrameRateCategoryChanged; |
| 674 | frameRateCategory = other.frameRateCategory; |
Rachel Lee | 67afbea | 2023-09-28 15:35:07 -0700 | [diff] [blame] | 675 | frameRateCategorySmoothSwitchOnly = other.frameRateCategorySmoothSwitchOnly; |
Rachel Lee | ce6e004 | 2023-06-27 11:22:54 -0700 | [diff] [blame] | 676 | } |
Rachel Lee | 58cc90d | 2023-09-05 18:50:20 -0700 | [diff] [blame] | 677 | if (other.what & eFrameRateSelectionStrategyChanged) { |
| 678 | what |= eFrameRateSelectionStrategyChanged; |
| 679 | frameRateSelectionStrategy = other.frameRateSelectionStrategy; |
| 680 | } |
Vishnu Nair | 6213bd9 | 2020-05-08 17:42:25 -0700 | [diff] [blame] | 681 | if (other.what & eFixedTransformHintChanged) { |
| 682 | what |= eFixedTransformHintChanged; |
| 683 | fixedTransformHint = other.fixedTransformHint; |
| 684 | } |
Vishnu Nair | cf26a0a | 2020-11-13 12:56:20 -0800 | [diff] [blame] | 685 | if (other.what & eAutoRefreshChanged) { |
| 686 | what |= eAutoRefreshChanged; |
| 687 | autoRefresh = other.autoRefresh; |
| 688 | } |
Winson Chung | a30f7c9 | 2021-06-29 15:42:56 -0700 | [diff] [blame] | 689 | if (other.what & eTrustedOverlayChanged) { |
| 690 | what |= eTrustedOverlayChanged; |
| 691 | isTrustedOverlay = other.isTrustedOverlay; |
| 692 | } |
John Reck | c00c669 | 2021-02-16 11:37:33 -0500 | [diff] [blame] | 693 | if (other.what & eStretchChanged) { |
| 694 | what |= eStretchChanged; |
| 695 | stretchEffect = other.stretchEffect; |
| 696 | } |
chaviw | f3f40fe | 2021-04-27 15:54:02 -0500 | [diff] [blame] | 697 | if (other.what & eBufferCropChanged) { |
| 698 | what |= eBufferCropChanged; |
| 699 | bufferCrop = other.bufferCrop; |
| 700 | } |
Vishnu Nair | 6bdec7d | 2021-05-10 15:01:13 -0700 | [diff] [blame] | 701 | if (other.what & eDestinationFrameChanged) { |
| 702 | what |= eDestinationFrameChanged; |
| 703 | destinationFrame = other.destinationFrame; |
| 704 | } |
Vishnu Nair | 0e81687 | 2021-07-14 10:53:04 -0700 | [diff] [blame] | 705 | if (other.what & eProducerDisconnect) { |
| 706 | what |= eProducerDisconnect; |
| 707 | } |
Vishnu Nair | 9cf4a4d | 2021-09-17 12:16:08 -0700 | [diff] [blame] | 708 | if (other.what & eDropInputModeChanged) { |
| 709 | what |= eDropInputModeChanged; |
| 710 | dropInputMode = other.dropInputMode; |
| 711 | } |
chaviw | 4c36cd8 | 2021-11-18 10:37:33 -0600 | [diff] [blame] | 712 | if (other.what & eColorChanged) { |
| 713 | what |= eColorChanged; |
Vishnu Nair | bbceb46 | 2022-10-10 04:52:13 +0000 | [diff] [blame] | 714 | color.rgb = other.color.rgb; |
chaviw | 4c36cd8 | 2021-11-18 10:37:33 -0600 | [diff] [blame] | 715 | } |
Arthur Hung | 91b346a | 2022-03-14 21:36:22 +0800 | [diff] [blame] | 716 | if (other.what & eColorSpaceAgnosticChanged) { |
| 717 | what |= eColorSpaceAgnosticChanged; |
| 718 | colorSpaceAgnostic = other.colorSpaceAgnostic; |
| 719 | } |
Sally Qi | 81d95e6 | 2022-03-21 19:41:33 -0700 | [diff] [blame] | 720 | if (other.what & eDimmingEnabledChanged) { |
| 721 | what |= eDimmingEnabledChanged; |
| 722 | dimmingEnabled = other.dimmingEnabled; |
| 723 | } |
Pascal Muetschard | b39918f | 2023-01-27 11:36:11 +0100 | [diff] [blame] | 724 | if (other.what & eFlushJankData) { |
| 725 | what |= eFlushJankData; |
| 726 | } |
Vishnu Nair | 217d8e6 | 2018-09-12 16:34:49 -0700 | [diff] [blame] | 727 | if ((other.what & what) != other.what) { |
| 728 | ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? " |
Vishnu Nair | 0e81687 | 2021-07-14 10:53:04 -0700 | [diff] [blame] | 729 | "other.what=0x%" PRIX64 " what=0x%" PRIX64 " unmerged flags=0x%" PRIX64, |
| 730 | other.what, what, (other.what & what) ^ other.what); |
Robert Carr | d314f16 | 2018-08-15 13:12:42 -0700 | [diff] [blame] | 731 | } |
Robert Carr | 2c5f6d2 | 2017-09-26 12:30:35 -0700 | [diff] [blame] | 732 | } |
Mathias Agopian | 8b33f03 | 2012-07-24 20:43:54 -0700 | [diff] [blame] | 733 | |
Vishnu Nair | aa799bd | 2022-11-16 23:09:09 +0000 | [diff] [blame] | 734 | uint64_t layer_state_t::diff(const layer_state_t& other) const { |
| 735 | uint64_t diff = 0; |
| 736 | CHECK_DIFF2(diff, ePositionChanged, other, x, y); |
| 737 | if (other.what & eLayerChanged) { |
| 738 | diff |= eLayerChanged; |
| 739 | diff &= ~eRelativeLayerChanged; |
| 740 | } |
| 741 | CHECK_DIFF(diff, eAlphaChanged, other, color.a); |
| 742 | CHECK_DIFF(diff, eMatrixChanged, other, matrix); |
| 743 | if (other.what & eTransparentRegionChanged && |
| 744 | (!transparentRegion.hasSameRects(other.transparentRegion))) { |
| 745 | diff |= eTransparentRegionChanged; |
| 746 | } |
| 747 | if (other.what & eFlagsChanged) { |
| 748 | uint64_t changedFlags = (flags & other.mask) ^ (other.flags & other.mask); |
| 749 | if (changedFlags) diff |= eFlagsChanged; |
| 750 | } |
| 751 | CHECK_DIFF(diff, eLayerStackChanged, other, layerStack); |
| 752 | CHECK_DIFF(diff, eCornerRadiusChanged, other, cornerRadius); |
| 753 | CHECK_DIFF(diff, eBackgroundBlurRadiusChanged, other, backgroundBlurRadius); |
| 754 | if (other.what & eBlurRegionsChanged) diff |= eBlurRegionsChanged; |
| 755 | if (other.what & eRelativeLayerChanged) { |
| 756 | diff |= eRelativeLayerChanged; |
| 757 | diff &= ~eLayerChanged; |
| 758 | } |
| 759 | if (other.what & eReparent && |
| 760 | !SurfaceControl::isSameSurface(parentSurfaceControlForChild, |
| 761 | other.parentSurfaceControlForChild)) { |
| 762 | diff |= eReparent; |
| 763 | } |
| 764 | CHECK_DIFF(diff, eBufferTransformChanged, other, bufferTransform); |
| 765 | CHECK_DIFF(diff, eTransformToDisplayInverseChanged, other, transformToDisplayInverse); |
| 766 | CHECK_DIFF(diff, eCropChanged, other, crop); |
| 767 | if (other.what & eBufferChanged) diff |= eBufferChanged; |
| 768 | CHECK_DIFF(diff, eDataspaceChanged, other, dataspace); |
Sally Qi | 963049b | 2023-03-23 14:06:21 -0700 | [diff] [blame] | 769 | CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentHdrSdrRatio, |
| 770 | desiredHdrSdrRatio); |
Alec Mouri | f4af03e | 2023-02-11 00:25:24 +0000 | [diff] [blame] | 771 | CHECK_DIFF(diff, eCachingHintChanged, other, cachingHint); |
Vishnu Nair | aa799bd | 2022-11-16 23:09:09 +0000 | [diff] [blame] | 772 | CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata); |
| 773 | if (other.what & eSurfaceDamageRegionChanged && |
| 774 | (!surfaceDamageRegion.hasSameRects(other.surfaceDamageRegion))) { |
| 775 | diff |= eSurfaceDamageRegionChanged; |
| 776 | } |
| 777 | CHECK_DIFF(diff, eApiChanged, other, api); |
| 778 | if (other.what & eSidebandStreamChanged) diff |= eSidebandStreamChanged; |
| 779 | CHECK_DIFF(diff, eApiChanged, other, api); |
| 780 | CHECK_DIFF(diff, eColorTransformChanged, other, colorTransform); |
| 781 | if (other.what & eHasListenerCallbacksChanged) diff |= eHasListenerCallbacksChanged; |
| 782 | if (other.what & eInputInfoChanged) diff |= eInputInfoChanged; |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 783 | CHECK_DIFF2(diff, eBackgroundColorChanged, other, bgColor, bgColorDataspace); |
Vishnu Nair | aa799bd | 2022-11-16 23:09:09 +0000 | [diff] [blame] | 784 | if (other.what & eMetadataChanged) diff |= eMetadataChanged; |
| 785 | CHECK_DIFF(diff, eShadowRadiusChanged, other, shadowRadius); |
| 786 | CHECK_DIFF3(diff, eRenderBorderChanged, other, borderEnabled, borderWidth, borderColor); |
| 787 | CHECK_DIFF(diff, eDefaultFrameRateCompatibilityChanged, other, defaultFrameRateCompatibility); |
| 788 | CHECK_DIFF(diff, eFrameRateSelectionPriority, other, frameRateSelectionPriority); |
| 789 | CHECK_DIFF3(diff, eFrameRateChanged, other, frameRate, frameRateCompatibility, |
| 790 | changeFrameRateStrategy); |
Rachel Lee | 67afbea | 2023-09-28 15:35:07 -0700 | [diff] [blame] | 791 | CHECK_DIFF2(diff, eFrameRateCategoryChanged, other, frameRateCategory, |
| 792 | frameRateCategorySmoothSwitchOnly); |
Rachel Lee | 58cc90d | 2023-09-05 18:50:20 -0700 | [diff] [blame] | 793 | CHECK_DIFF(diff, eFrameRateSelectionStrategyChanged, other, frameRateSelectionStrategy); |
Vishnu Nair | aa799bd | 2022-11-16 23:09:09 +0000 | [diff] [blame] | 794 | CHECK_DIFF(diff, eFixedTransformHintChanged, other, fixedTransformHint); |
| 795 | CHECK_DIFF(diff, eAutoRefreshChanged, other, autoRefresh); |
| 796 | CHECK_DIFF(diff, eTrustedOverlayChanged, other, isTrustedOverlay); |
| 797 | CHECK_DIFF(diff, eStretchChanged, other, stretchEffect); |
| 798 | CHECK_DIFF(diff, eBufferCropChanged, other, bufferCrop); |
| 799 | CHECK_DIFF(diff, eDestinationFrameChanged, other, destinationFrame); |
| 800 | if (other.what & eProducerDisconnect) diff |= eProducerDisconnect; |
| 801 | CHECK_DIFF(diff, eDropInputModeChanged, other, dropInputMode); |
| 802 | CHECK_DIFF(diff, eColorChanged, other, color.rgb); |
| 803 | CHECK_DIFF(diff, eColorSpaceAgnosticChanged, other, colorSpaceAgnostic); |
| 804 | CHECK_DIFF(diff, eDimmingEnabledChanged, other, dimmingEnabled); |
| 805 | return diff; |
| 806 | } |
| 807 | |
Vishnu Nair | ddf9b5c | 2021-03-29 18:53:41 -0700 | [diff] [blame] | 808 | bool layer_state_t::hasBufferChanges() const { |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 809 | return what & layer_state_t::eBufferChanged; |
Vishnu Nair | ddf9b5c | 2021-03-29 18:53:41 -0700 | [diff] [blame] | 810 | } |
| 811 | |
Ady Abraham | 6e8e364 | 2021-07-08 19:44:07 -0700 | [diff] [blame] | 812 | bool layer_state_t::hasValidBuffer() const { |
Vishnu Nair | 59f6d2d | 2022-10-05 16:59:56 -0700 | [diff] [blame] | 813 | return bufferData && (bufferData->hasBuffer() || bufferData->cachedBuffer.isValid()); |
Ady Abraham | 6e8e364 | 2021-07-08 19:44:07 -0700 | [diff] [blame] | 814 | } |
| 815 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 816 | status_t layer_state_t::matrix22_t::write(Parcel& output) const { |
| 817 | SAFE_PARCEL(output.writeFloat, dsdx); |
| 818 | SAFE_PARCEL(output.writeFloat, dtdx); |
| 819 | SAFE_PARCEL(output.writeFloat, dtdy); |
| 820 | SAFE_PARCEL(output.writeFloat, dsdy); |
| 821 | return NO_ERROR; |
| 822 | } |
| 823 | |
| 824 | status_t layer_state_t::matrix22_t::read(const Parcel& input) { |
| 825 | SAFE_PARCEL(input.readFloat, &dsdx); |
| 826 | SAFE_PARCEL(input.readFloat, &dtdx); |
| 827 | SAFE_PARCEL(input.readFloat, &dtdy); |
| 828 | SAFE_PARCEL(input.readFloat, &dsdy); |
| 829 | return NO_ERROR; |
| 830 | } |
| 831 | |
chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 832 | // ------------------------------- InputWindowCommands ---------------------------------------- |
| 833 | |
Vishnu Nair | e798b47 | 2020-07-23 13:52:21 -0700 | [diff] [blame] | 834 | bool InputWindowCommands::merge(const InputWindowCommands& other) { |
| 835 | bool changes = false; |
Vishnu Nair | e798b47 | 2020-07-23 13:52:21 -0700 | [diff] [blame] | 836 | changes |= !other.focusRequests.empty(); |
| 837 | focusRequests.insert(focusRequests.end(), std::make_move_iterator(other.focusRequests.begin()), |
| 838 | std::make_move_iterator(other.focusRequests.end())); |
Patrick Williams | 641f7f2 | 2022-06-22 19:25:35 +0000 | [diff] [blame] | 839 | changes |= !other.windowInfosReportedListeners.empty(); |
| 840 | windowInfosReportedListeners.insert(other.windowInfosReportedListeners.begin(), |
| 841 | other.windowInfosReportedListeners.end()); |
Vishnu Nair | e798b47 | 2020-07-23 13:52:21 -0700 | [diff] [blame] | 842 | return changes; |
chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 843 | } |
| 844 | |
Vishnu Nair | 958da93 | 2020-08-21 17:12:37 -0700 | [diff] [blame] | 845 | bool InputWindowCommands::empty() const { |
Patrick Williams | 641f7f2 | 2022-06-22 19:25:35 +0000 | [diff] [blame] | 846 | return focusRequests.empty() && windowInfosReportedListeners.empty(); |
Vishnu Nair | 958da93 | 2020-08-21 17:12:37 -0700 | [diff] [blame] | 847 | } |
| 848 | |
chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 849 | void InputWindowCommands::clear() { |
Vishnu Nair | e798b47 | 2020-07-23 13:52:21 -0700 | [diff] [blame] | 850 | focusRequests.clear(); |
Patrick Williams | 641f7f2 | 2022-06-22 19:25:35 +0000 | [diff] [blame] | 851 | windowInfosReportedListeners.clear(); |
chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 852 | } |
| 853 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 854 | status_t InputWindowCommands::write(Parcel& output) const { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 855 | SAFE_PARCEL(output.writeParcelableVector, focusRequests); |
Patrick Williams | 641f7f2 | 2022-06-22 19:25:35 +0000 | [diff] [blame] | 856 | |
| 857 | SAFE_PARCEL(output.writeInt32, windowInfosReportedListeners.size()); |
| 858 | for (const auto& listener : windowInfosReportedListeners) { |
| 859 | SAFE_PARCEL(output.writeStrongBinder, listener); |
| 860 | } |
| 861 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 862 | return NO_ERROR; |
chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 863 | } |
| 864 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 865 | status_t InputWindowCommands::read(const Parcel& input) { |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 866 | SAFE_PARCEL(input.readParcelableVector, &focusRequests); |
Patrick Williams | 641f7f2 | 2022-06-22 19:25:35 +0000 | [diff] [blame] | 867 | |
| 868 | int listenerSize = 0; |
| 869 | SAFE_PARCEL_READ_SIZE(input.readInt32, &listenerSize, input.dataSize()); |
| 870 | windowInfosReportedListeners.reserve(listenerSize); |
| 871 | for (int i = 0; i < listenerSize; i++) { |
| 872 | sp<gui::IWindowInfosReportedListener> listener; |
| 873 | SAFE_PARCEL(input.readStrongBinder, &listener); |
| 874 | windowInfosReportedListeners.insert(listener); |
| 875 | } |
| 876 | |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 877 | return NO_ERROR; |
chaviw | 273171b | 2018-12-26 11:46:30 -0800 | [diff] [blame] | 878 | } |
| 879 | |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 880 | // ---------------------------------------------------------------------------- |
| 881 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 882 | namespace gui { |
| 883 | |
| 884 | status_t CaptureArgs::writeToParcel(Parcel* output) const { |
| 885 | SAFE_PARCEL(output->writeInt32, static_cast<int32_t>(pixelFormat)); |
| 886 | SAFE_PARCEL(output->write, sourceCrop); |
| 887 | SAFE_PARCEL(output->writeFloat, frameScaleX); |
| 888 | SAFE_PARCEL(output->writeFloat, frameScaleY); |
| 889 | SAFE_PARCEL(output->writeBool, captureSecureLayers); |
| 890 | SAFE_PARCEL(output->writeInt32, uid); |
| 891 | SAFE_PARCEL(output->writeInt32, static_cast<int32_t>(dataspace)); |
| 892 | SAFE_PARCEL(output->writeBool, allowProtected); |
| 893 | SAFE_PARCEL(output->writeBool, grayscale); |
Ajinkya Chalke | 0284463 | 2023-03-01 12:10:14 +0000 | [diff] [blame] | 894 | SAFE_PARCEL(output->writeInt32, excludeHandles.size()); |
| 895 | for (auto& excludeHandle : excludeHandles) { |
| 896 | SAFE_PARCEL(output->writeStrongBinder, excludeHandle); |
| 897 | } |
Alec Mouri | 3e5965f | 2023-04-07 18:00:58 +0000 | [diff] [blame] | 898 | SAFE_PARCEL(output->writeBool, hintForSeamlessTransition); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 899 | return NO_ERROR; |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 900 | } |
| 901 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 902 | status_t CaptureArgs::readFromParcel(const Parcel* input) { |
Peiyong Lin | cd26147 | 2020-10-06 18:05:25 -0700 | [diff] [blame] | 903 | int32_t value = 0; |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 904 | SAFE_PARCEL(input->readInt32, &value); |
Peiyong Lin | cd26147 | 2020-10-06 18:05:25 -0700 | [diff] [blame] | 905 | pixelFormat = static_cast<ui::PixelFormat>(value); |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 906 | SAFE_PARCEL(input->read, sourceCrop); |
| 907 | SAFE_PARCEL(input->readFloat, &frameScaleX); |
| 908 | SAFE_PARCEL(input->readFloat, &frameScaleY); |
| 909 | SAFE_PARCEL(input->readBool, &captureSecureLayers); |
| 910 | SAFE_PARCEL(input->readInt32, &uid); |
| 911 | SAFE_PARCEL(input->readInt32, &value); |
Peiyong Lin | cd26147 | 2020-10-06 18:05:25 -0700 | [diff] [blame] | 912 | dataspace = static_cast<ui::Dataspace>(value); |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 913 | SAFE_PARCEL(input->readBool, &allowProtected); |
| 914 | SAFE_PARCEL(input->readBool, &grayscale); |
Ajinkya Chalke | 0284463 | 2023-03-01 12:10:14 +0000 | [diff] [blame] | 915 | int32_t numExcludeHandles = 0; |
| 916 | SAFE_PARCEL_READ_SIZE(input->readInt32, &numExcludeHandles, input->dataSize()); |
| 917 | excludeHandles.reserve(numExcludeHandles); |
| 918 | for (int i = 0; i < numExcludeHandles; i++) { |
| 919 | sp<IBinder> binder; |
| 920 | SAFE_PARCEL(input->readStrongBinder, &binder); |
| 921 | excludeHandles.emplace(binder); |
| 922 | } |
Alec Mouri | 3e5965f | 2023-04-07 18:00:58 +0000 | [diff] [blame] | 923 | SAFE_PARCEL(input->readBool, &hintForSeamlessTransition); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 924 | return NO_ERROR; |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 925 | } |
| 926 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 927 | status_t DisplayCaptureArgs::writeToParcel(Parcel* output) const { |
| 928 | SAFE_PARCEL(CaptureArgs::writeToParcel, output); |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 929 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 930 | SAFE_PARCEL(output->writeStrongBinder, displayToken); |
| 931 | SAFE_PARCEL(output->writeUint32, width); |
| 932 | SAFE_PARCEL(output->writeUint32, height); |
| 933 | SAFE_PARCEL(output->writeBool, useIdentityTransform); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 934 | return NO_ERROR; |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 935 | } |
| 936 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 937 | status_t DisplayCaptureArgs::readFromParcel(const Parcel* input) { |
| 938 | SAFE_PARCEL(CaptureArgs::readFromParcel, input); |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 939 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 940 | SAFE_PARCEL(input->readStrongBinder, &displayToken); |
| 941 | SAFE_PARCEL(input->readUint32, &width); |
| 942 | SAFE_PARCEL(input->readUint32, &height); |
| 943 | SAFE_PARCEL(input->readBool, &useIdentityTransform); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 944 | return NO_ERROR; |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 945 | } |
| 946 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 947 | status_t LayerCaptureArgs::writeToParcel(Parcel* output) const { |
| 948 | SAFE_PARCEL(CaptureArgs::writeToParcel, output); |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 949 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 950 | SAFE_PARCEL(output->writeStrongBinder, layerHandle); |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 951 | SAFE_PARCEL(output->writeBool, childrenOnly); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 952 | return NO_ERROR; |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 953 | } |
| 954 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 955 | status_t LayerCaptureArgs::readFromParcel(const Parcel* input) { |
| 956 | SAFE_PARCEL(CaptureArgs::readFromParcel, input); |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 957 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 958 | SAFE_PARCEL(input->readStrongBinder, &layerHandle); |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 959 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 960 | SAFE_PARCEL(input->readBool, &childrenOnly); |
chaviw | 308ddba | 2020-08-11 16:23:51 -0700 | [diff] [blame] | 961 | return NO_ERROR; |
chaviw | 618c42d | 2020-07-24 15:25:08 -0700 | [diff] [blame] | 962 | } |
| 963 | |
Huihong Luo | 9e84f33 | 2021-12-16 14:33:46 -0800 | [diff] [blame] | 964 | }; // namespace gui |
| 965 | |
chaviw | 8dd181f | 2022-01-05 18:36:46 -0600 | [diff] [blame] | 966 | ReleaseCallbackId BufferData::generateReleaseCallbackId() const { |
chaviw | dcba9e0 | 2022-03-21 17:54:23 -0500 | [diff] [blame] | 967 | uint64_t bufferId; |
| 968 | if (buffer) { |
| 969 | bufferId = buffer->getId(); |
| 970 | } else { |
| 971 | bufferId = cachedBuffer.id; |
| 972 | } |
| 973 | return {bufferId, frameNumber}; |
chaviw | 8dd181f | 2022-01-05 18:36:46 -0600 | [diff] [blame] | 974 | } |
| 975 | |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 976 | status_t BufferData::writeToParcel(Parcel* output) const { |
| 977 | SAFE_PARCEL(output->writeInt32, flags.get()); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 978 | |
| 979 | if (buffer) { |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 980 | SAFE_PARCEL(output->writeBool, true); |
| 981 | SAFE_PARCEL(output->write, *buffer); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 982 | } else { |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 983 | SAFE_PARCEL(output->writeBool, false); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 984 | } |
| 985 | |
| 986 | if (acquireFence) { |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 987 | SAFE_PARCEL(output->writeBool, true); |
| 988 | SAFE_PARCEL(output->write, *acquireFence); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 989 | } else { |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 990 | SAFE_PARCEL(output->writeBool, false); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 991 | } |
| 992 | |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 993 | SAFE_PARCEL(output->writeUint64, frameNumber); |
| 994 | SAFE_PARCEL(output->writeStrongBinder, IInterface::asBinder(releaseBufferListener)); |
| 995 | SAFE_PARCEL(output->writeStrongBinder, releaseBufferEndpoint); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 996 | |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 997 | SAFE_PARCEL(output->writeStrongBinder, cachedBuffer.token.promote()); |
| 998 | SAFE_PARCEL(output->writeUint64, cachedBuffer.id); |
Robert Carr | 79dc06a | 2022-02-22 15:28:59 -0800 | [diff] [blame] | 999 | SAFE_PARCEL(output->writeBool, hasBarrier); |
| 1000 | SAFE_PARCEL(output->writeUint64, barrierFrameNumber); |
liulijun | eb489f6 | 2022-10-17 22:02:14 +0800 | [diff] [blame] | 1001 | SAFE_PARCEL(output->writeUint32, producerId); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1002 | |
| 1003 | return NO_ERROR; |
| 1004 | } |
| 1005 | |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1006 | status_t BufferData::readFromParcel(const Parcel* input) { |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1007 | int32_t tmpInt32; |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1008 | SAFE_PARCEL(input->readInt32, &tmpInt32); |
Dominik Laskowski | 2f01d77 | 2022-03-23 16:01:29 -0700 | [diff] [blame] | 1009 | flags = ftl::Flags<BufferDataChange>(tmpInt32); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1010 | |
| 1011 | bool tmpBool = false; |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1012 | SAFE_PARCEL(input->readBool, &tmpBool); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1013 | if (tmpBool) { |
| 1014 | buffer = new GraphicBuffer(); |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1015 | SAFE_PARCEL(input->read, *buffer); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1016 | } |
| 1017 | |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1018 | SAFE_PARCEL(input->readBool, &tmpBool); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1019 | if (tmpBool) { |
| 1020 | acquireFence = new Fence(); |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1021 | SAFE_PARCEL(input->read, *acquireFence); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1022 | } |
| 1023 | |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1024 | SAFE_PARCEL(input->readUint64, &frameNumber); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1025 | |
| 1026 | sp<IBinder> tmpBinder = nullptr; |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1027 | SAFE_PARCEL(input->readNullableStrongBinder, &tmpBinder); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1028 | if (tmpBinder) { |
| 1029 | releaseBufferListener = checked_interface_cast<ITransactionCompletedListener>(tmpBinder); |
| 1030 | } |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1031 | SAFE_PARCEL(input->readNullableStrongBinder, &releaseBufferEndpoint); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1032 | |
| 1033 | tmpBinder = nullptr; |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1034 | SAFE_PARCEL(input->readNullableStrongBinder, &tmpBinder); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1035 | cachedBuffer.token = tmpBinder; |
Vishnu Nair | 9f0835e | 2022-01-07 09:33:19 -0800 | [diff] [blame] | 1036 | SAFE_PARCEL(input->readUint64, &cachedBuffer.id); |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1037 | |
Robert Carr | 79dc06a | 2022-02-22 15:28:59 -0800 | [diff] [blame] | 1038 | SAFE_PARCEL(input->readBool, &hasBarrier); |
| 1039 | SAFE_PARCEL(input->readUint64, &barrierFrameNumber); |
liulijun | eb489f6 | 2022-10-17 22:02:14 +0800 | [diff] [blame] | 1040 | SAFE_PARCEL(input->readUint32, &producerId); |
Robert Carr | 79dc06a | 2022-02-22 15:28:59 -0800 | [diff] [blame] | 1041 | |
chaviw | ba4320c | 2021-09-15 15:20:53 -0500 | [diff] [blame] | 1042 | return NO_ERROR; |
| 1043 | } |
| 1044 | |
Chavi Weingarten | 076acac | 2023-01-19 17:20:43 +0000 | [diff] [blame] | 1045 | status_t TrustedPresentationListener::writeToParcel(Parcel* parcel) const { |
| 1046 | SAFE_PARCEL(parcel->writeStrongBinder, callbackInterface); |
| 1047 | SAFE_PARCEL(parcel->writeInt32, callbackId); |
| 1048 | return NO_ERROR; |
| 1049 | } |
| 1050 | |
| 1051 | status_t TrustedPresentationListener::readFromParcel(const Parcel* parcel) { |
| 1052 | sp<IBinder> tmpBinder = nullptr; |
| 1053 | SAFE_PARCEL(parcel->readNullableStrongBinder, &tmpBinder); |
| 1054 | if (tmpBinder) { |
| 1055 | callbackInterface = checked_interface_cast<ITransactionCompletedListener>(tmpBinder); |
| 1056 | } |
| 1057 | SAFE_PARCEL(parcel->readInt32, &callbackId); |
| 1058 | return NO_ERROR; |
| 1059 | } |
| 1060 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1061 | }; // namespace android |