summaryrefslogtreecommitdiff
path: root/libs/androidfw/AssetsProvider.cpp
diff options
context:
space:
mode:
author Eric Miao <ericymiao@google.com> 2024-07-10 17:11:10 -0700
committer Eric Miao <ericymiao@google.com> 2024-07-24 09:49:17 -0700
commit6e5ce89b93f46a94febfe1433f167181b1174586 (patch)
tree49f49da3f40caae475cb2f631e5acc7db25fb33c /libs/androidfw/AssetsProvider.cpp
parente0b7812fa517db725a3e0ca31365a9d94ef521d7 (diff)
Initialize some global variables in Bitmap.cpp when needed
Bug: 331243037 Flag: EXEMPT bugfix This allows Bitmap class to have a static NativeAllocationRegistry, which can be used to register native allocations of different sizes without creating multiple registries. To make this possible, the static native method nativeGetNativeFinalizer needs to be available during static initialization time in Bitmap class. However, there is a deadlock as shown below which needs to be removed e.g. class Bitmap { private static long sFinalizer = nativeGetNativeFinalizer(); private static native long nativeGetNativeFinalizer(); } The static initialization of sFinalizer depends on the native JNI call nativeGetNativeFinalizer() to be available/registered. However, during JNI registration time in Bitmap.cpp, the calls of GetMethodID() requires the static initialization to be done, this causes deadlock, and hence the code above wouldn't work. To remove this deadlock and thus allow static native methods to be called during static initialization, we moved the initialization of these global variables in Bitmap.cpp, which depends on GetMethodID(), to be done later when they are needed first time. Change-Id: I87bebdbe128a2dad48b162d31ed275ad7908bcd7
Diffstat (limited to 'libs/androidfw/AssetsProvider.cpp')
0 files changed, 0 insertions, 0 deletions