Skip to content

Commit 7171a46

Browse files
committed
Error fix from enabling Clang thread-safety checks in aosp_panther
Parent bug: b/353324127. Enabling `thread-safety-reference-return` to allow developers to utilize Clang thread safety guardrails (GUARDED_BY, REQUIRES, EXCLUDES). Added NO_THREAD_SAFETY_ANALYSIS annotations to violating functions. If this is not desired, please respond with concerns or preferred fix. Bug: 354740314 Test: lunch aosp_panther_hwasan-trunk_staging-userdebug && m out/soong/.intermediates/frameworks/native/services/surfaceflinger/tests/unittests/libsurfaceflinger_unittest/android_arm64_armv8-2a_cortex-a55_hwasan/obj/frameworks/native/services/surfaceflinger/tests/unittests/RefreshRateSelectorTest.o Change-Id: Iaad37f1eee5837ac79ea0551124eca060ff5d514
1 parent 39dd7ff commit 7171a46

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

services/surfaceflinger/tests/unittests/RefreshRateSelectorTest.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ struct TestableRefreshRateSelector : RefreshRateSelector {
100100
const std::vector<Fps>& knownFrameRates() const { return mKnownFrameRates; }
101101

102102
using RefreshRateSelector::GetRankedFrameRatesCache;
103-
auto& mutableGetRankedRefreshRatesCache() { return mGetRankedFrameRatesCache; }
103+
auto& mutableGetRankedRefreshRatesCache() NO_THREAD_SAFETY_ANALYSIS {
104+
return mGetRankedFrameRatesCache;
105+
}
104106

105107
auto getRankedFrameRates(const std::vector<LayerRequirement>& layers,
106108
GlobalSignals signals = {}, Fps pacesetterFps = {}) const {
@@ -138,7 +140,9 @@ struct TestableRefreshRateSelector : RefreshRateSelector {
138140
return setPolicy(policy);
139141
}
140142

141-
const auto& getPrimaryFrameRates() const { return mPrimaryFrameRates; }
143+
const auto& getPrimaryFrameRates() const NO_THREAD_SAFETY_ANALYSIS {
144+
return mPrimaryFrameRates;
145+
}
142146
};
143147

144148
class RefreshRateSelectorTest : public testing::TestWithParam<Config::FrameRateOverride> {

0 commit comments

Comments
 (0)