From 93811532096a2d0d822f64d6271dca4f1147841d Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Thu, 8 Feb 2018 22:57:00 -0800 Subject: 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 --- native/android/configuration.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'native/android/configuration.cpp') 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 -#include +#include #include +#include using namespace android; @@ -34,7 +35,11 @@ void AConfiguration_delete(AConfiguration* config) { } void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am) { - ((AssetManager*)am)->getConfiguration(out); + ScopedLock 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) { -- cgit v1.2.3-59-g8ed1b