From 96a5aaf57b4432cb3d5cb4a2327ab548b262354b Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Wed, 26 Jun 2024 17:17:51 -0700 Subject: Fix region sampling for secure layers We were swapping a couple of boolean params when requesting screenshots for region sampling, breaking region sampling for secure layers in the process. Fix this by passing flags instead of booleans in a long list of arguments and add a test to verify the code path. FLAG: EXEMPT bugfix Fixes: 348944802 Test: presubmit (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:871886eebe469fc21568ff363993bde9a6593837) Merged-In: I58f12e5cf81cb59115c1b9c500ac1e18a8ec72e5 Change-Id: I58f12e5cf81cb59115c1b9c500ac1e18a8ec72e5 --- services/surfaceflinger/DisplayRenderArea.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'services/surfaceflinger/DisplayRenderArea.cpp') diff --git a/services/surfaceflinger/DisplayRenderArea.cpp b/services/surfaceflinger/DisplayRenderArea.cpp index 55b395b458..c63c738d34 100644 --- a/services/surfaceflinger/DisplayRenderArea.cpp +++ b/services/surfaceflinger/DisplayRenderArea.cpp @@ -22,22 +22,20 @@ namespace android { std::unique_ptr DisplayRenderArea::create(wp displayWeak, const Rect& sourceCrop, ui::Size reqSize, ui::Dataspace reqDataSpace, - bool hintForSeamlessTransition, - bool allowSecureLayers) { + ftl::Flags options) { if (auto display = displayWeak.promote()) { // Using new to access a private constructor. - return std::unique_ptr( - new DisplayRenderArea(std::move(display), sourceCrop, reqSize, reqDataSpace, - hintForSeamlessTransition, allowSecureLayers)); + return std::unique_ptr(new DisplayRenderArea(std::move(display), + sourceCrop, reqSize, + reqDataSpace, options)); } return nullptr; } DisplayRenderArea::DisplayRenderArea(sp display, const Rect& sourceCrop, ui::Size reqSize, ui::Dataspace reqDataSpace, - bool hintForSeamlessTransition, bool allowSecureLayers) - : RenderArea(reqSize, CaptureFill::OPAQUE, reqDataSpace, hintForSeamlessTransition, - allowSecureLayers), + ftl::Flags options) + : RenderArea(reqSize, CaptureFill::OPAQUE, reqDataSpace, options), mDisplay(std::move(display)), mSourceCrop(sourceCrop) {} @@ -46,7 +44,7 @@ const ui::Transform& DisplayRenderArea::getTransform() const { } bool DisplayRenderArea::isSecure() const { - return mAllowSecureLayers && mDisplay->isSecure(); + return mOptions.test(Options::CAPTURE_SECURE_LAYERS) && mDisplay->isSecure(); } sp DisplayRenderArea::getDisplayDevice() const { -- cgit v1.2.3-59-g8ed1b