From 032141ea6963b22047bdbba3983b42010030864d Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Tue, 15 Feb 2022 05:30:01 -0800 Subject: WindowInfo: Cleanup reading from parcel Bug: None Test: atest libgui_test Change-Id: Ie5724d990a8a6c1480be3cb1a457920db1c39689 --- libs/gui/WindowInfo.cpp | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'libs/gui/WindowInfo.cpp') diff --git a/libs/gui/WindowInfo.cpp b/libs/gui/WindowInfo.cpp index b02bae49d3..2312a8cf0d 100644 --- a/libs/gui/WindowInfo.cpp +++ b/libs/gui/WindowInfo.cpp @@ -145,12 +145,14 @@ status_t WindowInfo::readFromParcel(const android::Parcel* parcel) { return status; } - layoutParamsFlags = Flags(parcel->readInt32()); - layoutParamsType = static_cast(parcel->readInt32()); float dsdx, dtdx, tx, dtdy, dsdy, ty; - int32_t touchOcclusionModeInt; + int32_t lpFlags, lpType, touchOcclusionModeInt, inputConfigInt; + sp touchableRegionCropHandleSp; + // clang-format off - status = parcel->readInt32(&frameLeft) ?: + status = parcel->readInt32(&lpFlags) ?: + parcel->readInt32(&lpType) ?: + parcel->readInt32(&frameLeft) ?: parcel->readInt32(&frameTop) ?: parcel->readInt32(&frameRight) ?: parcel->readInt32(&frameBottom) ?: @@ -166,32 +168,28 @@ status_t WindowInfo::readFromParcel(const android::Parcel* parcel) { parcel->readInt32(&touchOcclusionModeInt) ?: parcel->readInt32(&ownerPid) ?: parcel->readInt32(&ownerUid) ?: - parcel->readUtf8FromUtf16(&packageName); - // clang-format on - - if (status != OK) { - return status; - } - - touchOcclusionMode = static_cast(touchOcclusionModeInt); - - inputConfig = Flags(parcel->readInt32()); - // clang-format off - status = parcel->readInt32(&displayId) ?: + parcel->readUtf8FromUtf16(&packageName) ?: + parcel->readInt32(&inputConfigInt) ?: + parcel->readInt32(&displayId) ?: applicationInfo.readFromParcel(parcel) ?: parcel->read(touchableRegion) ?: - parcel->readBool(&replaceTouchableRegionWithCrop); + parcel->readBool(&replaceTouchableRegionWithCrop) ?: + parcel->readNullableStrongBinder(&touchableRegionCropHandleSp) ?: + parcel->readNullableStrongBinder(&windowToken); // clang-format on if (status != OK) { return status; } - touchableRegionCropHandle = parcel->readStrongBinder(); + layoutParamsFlags = Flags(lpFlags); + layoutParamsType = static_cast(lpType); transform.set({dsdx, dtdx, tx, dtdy, dsdy, ty, 0, 0, 1}); + touchOcclusionMode = static_cast(touchOcclusionModeInt); + inputConfig = Flags(inputConfigInt); + touchableRegionCropHandle = touchableRegionCropHandleSp; - status = parcel->readNullableStrongBinder(&windowToken); - return status; + return OK; } // --- WindowInfoHandle --- -- cgit v1.2.3-59-g8ed1b