diff options
author | Adam Lesinski <adamlesinski@google.com> | 2018-02-08 22:57:00 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2018-02-08 23:23:08 -0800 |
commit | 93811532096a2d0d822f64d6271dca4f1147841d (patch) | |
tree | 5b8f4c3107c10fade103a24bb196e0d082685897 /native/android/configuration.cpp | |
parent | 09726a5d9dc691762a9bdd52221fbb76bac9dd3b (diff) |
AssetManager2: Fix issue with native cast
The NDK wasn't fully updated to be aware of the fact that
the implementation of AAssetManager changed.
Bug: 73120367
Test: manual - YouTube TV doesn't crash
Change-Id: I6d897ddf197bdcac8118d26e55f40ab9542f5013
Diffstat (limited to 'native/android/configuration.cpp')
-rw-r--r-- | native/android/configuration.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/native/android/configuration.cpp b/native/android/configuration.cpp index 77237ae97ff5..87fe9edb49c5 100644 --- a/native/android/configuration.cpp +++ b/native/android/configuration.cpp @@ -17,9 +17,10 @@ #define LOG_TAG "Configuration" #include <utils/Log.h> -#include <androidfw/AssetManager.h> +#include <androidfw/AssetManager2.h> #include <android_runtime/android_content_res_Configuration.h> +#include <android_runtime/android_util_AssetManager.h> using namespace android; @@ -34,7 +35,11 @@ void AConfiguration_delete(AConfiguration* config) { } void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am) { - ((AssetManager*)am)->getConfiguration(out); + ScopedLock<AssetManager2> locked_mgr(*AssetManagerForNdkAssetManager(am)); + ResTable_config config = locked_mgr->GetConfiguration(); + + // AConfiguration is not a virtual subclass, so we can memcpy. + memcpy(out, &config, sizeof(config)); } void AConfiguration_copy(AConfiguration* dest, AConfiguration* src) { |