Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93811532 authored by Adam Lesinski's avatar Adam Lesinski
Browse files

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
parent 09726a5d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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) {