summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Huihong Luo <huisinro@google.com> 2021-12-16 14:33:46 -0800
committer Huihong Luo <huisinro@google.com> 2022-02-20 01:24:53 -0800
commitf502922b5a4869c399bebd2254039183b58c8a7d (patch)
tree4e628ab16b081af4cff25896a1e6783b852af2a3 /libs/gui/LayerState.cpp
parentc255951aaa56aef738bc50799aaaf8ba6012e54b (diff)
Migrate screenshot methods to AIDL
Additonal service, named as "SurfaceFlingerAIDL", is added to surfaceflinger during the process of migrating ISurfaceComposer interface to AIDL. New changes are put into namespace, android::gui. Once migration is complete, this service will be deleted. This CL migrates Screenshot methods to AIDL, more will come. Bug: 211037638 Test: screencap Change-Id: Idee91fa2444646639735847b1c76e983af39227f
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp92
1 files changed, 48 insertions, 44 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 9022e7d5a4..6944d38dfe 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -686,85 +686,89 @@ bool ValidateFrameRate(float frameRate, int8_t compatibility, int8_t changeFrame
// ----------------------------------------------------------------------------
-status_t CaptureArgs::write(Parcel& output) const {
- SAFE_PARCEL(output.writeInt32, static_cast<int32_t>(pixelFormat));
- SAFE_PARCEL(output.write, sourceCrop);
- SAFE_PARCEL(output.writeFloat, frameScaleX);
- SAFE_PARCEL(output.writeFloat, frameScaleY);
- SAFE_PARCEL(output.writeBool, captureSecureLayers);
- SAFE_PARCEL(output.writeInt32, uid);
- SAFE_PARCEL(output.writeInt32, static_cast<int32_t>(dataspace));
- SAFE_PARCEL(output.writeBool, allowProtected);
- SAFE_PARCEL(output.writeBool, grayscale);
+namespace gui {
+
+status_t CaptureArgs::writeToParcel(Parcel* output) const {
+ SAFE_PARCEL(output->writeInt32, static_cast<int32_t>(pixelFormat));
+ SAFE_PARCEL(output->write, sourceCrop);
+ SAFE_PARCEL(output->writeFloat, frameScaleX);
+ SAFE_PARCEL(output->writeFloat, frameScaleY);
+ SAFE_PARCEL(output->writeBool, captureSecureLayers);
+ SAFE_PARCEL(output->writeInt32, uid);
+ SAFE_PARCEL(output->writeInt32, static_cast<int32_t>(dataspace));
+ SAFE_PARCEL(output->writeBool, allowProtected);
+ SAFE_PARCEL(output->writeBool, grayscale);
return NO_ERROR;
}
-status_t CaptureArgs::read(const Parcel& input) {
+status_t CaptureArgs::readFromParcel(const Parcel* input) {
int32_t value = 0;
- SAFE_PARCEL(input.readInt32, &value);
+ SAFE_PARCEL(input->readInt32, &value);
pixelFormat = static_cast<ui::PixelFormat>(value);
- SAFE_PARCEL(input.read, sourceCrop);
- SAFE_PARCEL(input.readFloat, &frameScaleX);
- SAFE_PARCEL(input.readFloat, &frameScaleY);
- SAFE_PARCEL(input.readBool, &captureSecureLayers);
- SAFE_PARCEL(input.readInt32, &uid);
- SAFE_PARCEL(input.readInt32, &value);
+ SAFE_PARCEL(input->read, sourceCrop);
+ SAFE_PARCEL(input->readFloat, &frameScaleX);
+ SAFE_PARCEL(input->readFloat, &frameScaleY);
+ SAFE_PARCEL(input->readBool, &captureSecureLayers);
+ SAFE_PARCEL(input->readInt32, &uid);
+ SAFE_PARCEL(input->readInt32, &value);
dataspace = static_cast<ui::Dataspace>(value);
- SAFE_PARCEL(input.readBool, &allowProtected);
- SAFE_PARCEL(input.readBool, &grayscale);
+ SAFE_PARCEL(input->readBool, &allowProtected);
+ SAFE_PARCEL(input->readBool, &grayscale);
return NO_ERROR;
}
-status_t DisplayCaptureArgs::write(Parcel& output) const {
- SAFE_PARCEL(CaptureArgs::write, output);
+status_t DisplayCaptureArgs::writeToParcel(Parcel* output) const {
+ SAFE_PARCEL(CaptureArgs::writeToParcel, output);
- SAFE_PARCEL(output.writeStrongBinder, displayToken);
- SAFE_PARCEL(output.writeUint32, width);
- SAFE_PARCEL(output.writeUint32, height);
- SAFE_PARCEL(output.writeBool, useIdentityTransform);
+ SAFE_PARCEL(output->writeStrongBinder, displayToken);
+ SAFE_PARCEL(output->writeUint32, width);
+ SAFE_PARCEL(output->writeUint32, height);
+ SAFE_PARCEL(output->writeBool, useIdentityTransform);
return NO_ERROR;
}
-status_t DisplayCaptureArgs::read(const Parcel& input) {
- SAFE_PARCEL(CaptureArgs::read, input);
+status_t DisplayCaptureArgs::readFromParcel(const Parcel* input) {
+ SAFE_PARCEL(CaptureArgs::readFromParcel, input);
- SAFE_PARCEL(input.readStrongBinder, &displayToken);
- SAFE_PARCEL(input.readUint32, &width);
- SAFE_PARCEL(input.readUint32, &height);
- SAFE_PARCEL(input.readBool, &useIdentityTransform);
+ SAFE_PARCEL(input->readStrongBinder, &displayToken);
+ SAFE_PARCEL(input->readUint32, &width);
+ SAFE_PARCEL(input->readUint32, &height);
+ SAFE_PARCEL(input->readBool, &useIdentityTransform);
return NO_ERROR;
}
-status_t LayerCaptureArgs::write(Parcel& output) const {
- SAFE_PARCEL(CaptureArgs::write, output);
+status_t LayerCaptureArgs::writeToParcel(Parcel* output) const {
+ SAFE_PARCEL(CaptureArgs::writeToParcel, output);
- SAFE_PARCEL(output.writeStrongBinder, layerHandle);
- SAFE_PARCEL(output.writeInt32, excludeHandles.size());
+ SAFE_PARCEL(output->writeStrongBinder, layerHandle);
+ SAFE_PARCEL(output->writeInt32, excludeHandles.size());
for (auto el : excludeHandles) {
- SAFE_PARCEL(output.writeStrongBinder, el);
+ SAFE_PARCEL(output->writeStrongBinder, el);
}
- SAFE_PARCEL(output.writeBool, childrenOnly);
+ SAFE_PARCEL(output->writeBool, childrenOnly);
return NO_ERROR;
}
-status_t LayerCaptureArgs::read(const Parcel& input) {
- SAFE_PARCEL(CaptureArgs::read, input);
+status_t LayerCaptureArgs::readFromParcel(const Parcel* input) {
+ SAFE_PARCEL(CaptureArgs::readFromParcel, input);
- SAFE_PARCEL(input.readStrongBinder, &layerHandle);
+ SAFE_PARCEL(input->readStrongBinder, &layerHandle);
int32_t numExcludeHandles = 0;
- SAFE_PARCEL_READ_SIZE(input.readInt32, &numExcludeHandles, input.dataSize());
+ SAFE_PARCEL_READ_SIZE(input->readInt32, &numExcludeHandles, input->dataSize());
excludeHandles.reserve(numExcludeHandles);
for (int i = 0; i < numExcludeHandles; i++) {
sp<IBinder> binder;
- SAFE_PARCEL(input.readStrongBinder, &binder);
+ SAFE_PARCEL(input->readStrongBinder, &binder);
excludeHandles.emplace(binder);
}
- SAFE_PARCEL(input.readBool, &childrenOnly);
+ SAFE_PARCEL(input->readBool, &childrenOnly);
return NO_ERROR;
}
+}; // namespace gui
+
ReleaseCallbackId BufferData::generateReleaseCallbackId() const {
return {buffer->getId(), frameNumber};
}