From 59a6be3c5d547a02850bf486cfe1036f4008df83 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Mon, 29 Jan 2024 10:26:21 -0800 Subject: Introduce eCanOccludePresentation layer flag Sets a property on a layer hierarchy indicating that its visible region should be considered when computing TrustedPresentation Thresholds. This property is set on a layer and inherited by all its children. The property is then passed via windowinfos so the TrustedPresentation controller can determine which windows to use when computing the thresholds. Test: presubmit Bug: b/275574214 Change-Id: Ide384c64cb7b5a9b2b3ce293b20e2be64da8ad69 --- libs/gui/LayerState.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libs/gui/LayerState.cpp') diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 38fab9cdaa..7564c26316 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -199,7 +199,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeParcelable, trustedPresentationListener); SAFE_PARCEL(output.writeFloat, currentHdrSdrRatio); SAFE_PARCEL(output.writeFloat, desiredHdrSdrRatio); - SAFE_PARCEL(output.writeInt32, static_cast(cachingHint)) + SAFE_PARCEL(output.writeInt32, static_cast(cachingHint)); return NO_ERROR; } @@ -484,6 +484,12 @@ void layer_state_t::sanitize(int32_t permissions) { flags &= ~eLayerIsDisplayDecoration; ALOGE("Stripped attempt to set LayerIsDisplayDecoration in sanitize"); } + if ((mask & eCanOccludePresentation) && + !(permissions & Permission::ACCESS_SURFACE_FLINGER)) { + flags &= ~eCanOccludePresentation; + mask &= ~eCanOccludePresentation; + ALOGE("Stripped attempt to set eCanOccludePresentation in sanitize"); + } } if (what & layer_state_t::eInputInfoChanged) { -- cgit v1.2.3-59-g8ed1b