Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 5260e525 authored by Ryan Prichard's avatar Ryan Prichard Committed by Android Build Cherrypicker Worker
Browse files

[sf] HdrOutputControlTest: fix strategy arguments

The code was previously passing an
aidl::[...]::common::HdrConversionStrategy* argument to
gui::ISurfaceComposer::setHdrConversionStrategy, which accepts a
const gui::HdrConversionStrategy& parameter. Converting between these
two kinds of HdrConversionStrategy is laborious -- see
SurfaceFlinger::setHdrConversionStrategy.

This code was previously avoiding the conversion difficulty by passing
a pointer to HdrConversionStrategy, which is wrong because the function
actually accepts a const reference. It worked, though, because
gui::HdrConversionStrategy's _value has type:

    std::variant<bool, ::std::vector<int32_t>, int32_t>

... and aidl::[...]::common::HdrConversionStrategy* can be coerced to
bool. The pointer is always non-nullptr, so each
sf->setHdrConversionStrategy was actually passing a {passthrough==true}
strategy.

The C++ standard tightened the rules around variant conversion
(P0608R3, P1957R2), and after upgrading libc++, this code no longer
compiles. Fix the compile error by using gui::HdrConversionStrategy for
the type of the strategy vector elements.

Bug: 175635923
Test: m MODULES-IN-frameworks-native-services-surfaceflinger
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:0dfa358c79fc8047dd622d82020c37559871c8e7)
Merged-In: I820ac945113da0317d0eaa44f581fd6ab1b61645
Change-Id: I820ac945113da0317d0eaa44f581fd6ab1b61645
parent 91600505
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment