summaryrefslogtreecommitdiff
path: root/libs/androidfw/Util.cpp
diff options
context:
space:
mode:
author Neil Fuller <nfuller@google.com> 2022-11-21 15:12:12 +0000
committer Neil Fuller <nfuller@google.com> 2022-11-22 10:01:06 +0000
commit8e65afd594bcf01045182d5751bfb03888fdb4d3 (patch)
tree1bf083419e94bdd5018c8e9dc55a2993a455269d /libs/androidfw/Util.cpp
parent266adbb2d27b021af311457e393a39b974606830 (diff)
Follow best practice for listener notification
When notifying listeners, it's best practice not to hold any locks. Holding locks during synchronous notifications can cause deadlocks. One case has been caught where: A flag affecting the ConfigurationInternal managed by timezonedector.ServiceConfigAccessorImpl was updated: this caused the main thread to hold the ServiceConfigAccessorImpl "this" monitor while notifying the TimeZoneDetectorStrategyImpl (requiring the TimeZoneDetectorStrategyImpl "this" lock). Simultaneously, another (binder) thread was calling into TimeZoneDetectorStrategyImpl to update user configuration, thus holding the TimeZoneDetectorStrategyImpl "this" lock but attempting to read the ConfigurationInternal from the ServiceConfigAccessorImpl, and requiring the ServiceConfigAccessorImpl "this" monitor. Classic deadlock. This commit modifies (or comments) listener notification code to prevent deadlocks. Bug: 259562789 Test: Treehugger Change-Id: I93b1d9d82ca96062f760c77043e6837398f03cc5
Diffstat (limited to 'libs/androidfw/Util.cpp')
0 files changed, 0 insertions, 0 deletions