summaryrefslogtreecommitdiff
path: root/libs/androidfw/StringPool.cpp
diff options
context:
space:
mode:
author Avichal Rakesh <arakesh@google.com> 2022-06-23 16:04:03 -0700
committer Avichal Rakesh <arakesh@google.com> 2022-07-27 13:24:45 -0700
commit78fb893f47376bf1ca3db615daa548b36cb793ff (patch)
tree872456b3969ec2beb022d94e2896adff828f1457 /libs/androidfw/StringPool.cpp
parent14e6daeabfce8fa3fecc658fa7cdda22ab190aff (diff)
ImageReader: Fix rogue RuntimeException in #detachImage
ImageReader#detach documents that an IllegalStateException will be thrown if there are any errors detaching Image from a Surface. As ImageReaders are set up, it is common for this exception to be thrown. Applications are expected to catch and recover from the exception. However, ImageReader#nativeDetachImage, that ImageReader#detachImage calls into, explicitly threw a RuntimeException causing applications that didn't expect RuntimeException to crash. This behavior has stuck around for a few years, so changing the behavior to match the documentation will break backwards compatibility for many apps. However, RuntimeException is an incredibly generic exception that applications shouldn't be forced to catch as it can hide more serious bugs. This CL updates #nativeDetachImage to accept an additional flag. When this flag is set to True, #nativeDetachImage only throws IllegalStateException and preserves previous behavior when the flag is set to False. The flag is populated through the App Compatibility Framework which changes the behavior only for apps that set their targetSdk to > 33. Bug: 236825255 Bug: 204438677 Test: Manually tested that the flag is set to true for Apps targetting Android SDK > 33 Change-Id: I20bd986f11dbe7acf4898cf0ce794c27f42e1ee2
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions