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