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

Commit 30113131 authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Zoran Jovanovic
Browse files

RRO: reintroduce lost ResTable insert of assets

With the recent introduction of AssetManager::appendPathToResTable,
overlay packages were not properly added to the AssetManager, and once
added, were not properly inserted into the ResTable.

Bug: 17765434
Change-Id: Ie21f227c654c98730f74a687d0e16ee2b80e747e
parent 840796a3
Loading
Loading
Loading
Loading
+15 −1
Original line number Original line Diff line number Diff line
@@ -627,7 +627,21 @@ public final class AssetManager implements AutoCloseable {
     *
     *
     * {@hide}
     * {@hide}
     */
     */
    public native final int addOverlayPath(String idmapPath);

    public final int addOverlayPath(String idmapPath) {
        synchronized (this) {
            int res = addOverlayPathNative(idmapPath);
            makeStringBlocks(mStringBlocks);
            return res;
        }
    }

    /**
     * See addOverlayPath.
     *
     * {@hide}
     */
    public native final int addOverlayPathNative(String idmapPath);


    /**
    /**
     * Add multiple sets of assets to the asset manager at once.  See
     * Add multiple sets of assets to the asset manager at once.  See
+1 −1
Original line number Original line Diff line number Diff line
@@ -2001,7 +2001,7 @@ static JNINativeMethod gAssetManagerMethods[] = {
        (void*) android_content_AssetManager_getAssetRemainingLength },
        (void*) android_content_AssetManager_getAssetRemainingLength },
    { "addAssetPathNative", "(Ljava/lang/String;)I",
    { "addAssetPathNative", "(Ljava/lang/String;)I",
        (void*) android_content_AssetManager_addAssetPath },
        (void*) android_content_AssetManager_addAssetPath },
    { "addOverlayPath",   "(Ljava/lang/String;)I",
    { "addOverlayPathNative",   "(Ljava/lang/String;)I",
        (void*) android_content_AssetManager_addOverlayPath },
        (void*) android_content_AssetManager_addOverlayPath },
    { "isUpToDate",     "()Z",
    { "isUpToDate",     "()Z",
        (void*) android_content_AssetManager_isUpToDate },
        (void*) android_content_AssetManager_isUpToDate },
+4 −0
Original line number Original line Diff line number Diff line
@@ -296,6 +296,10 @@ bool AssetManager::addOverlayPath(const String8& packagePath, int32_t* cookie)
    mAssetPaths.add(oap);
    mAssetPaths.add(oap);
    *cookie = static_cast<int32_t>(mAssetPaths.size());
    *cookie = static_cast<int32_t>(mAssetPaths.size());


    if (mResources != NULL) {
        appendPathToResTable(oap);
    }

    return true;
    return true;
 }
 }