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

Commit 733da724 authored by d34d's avatar d34d Committed by Clark Scheff
Browse files

Remove resources.apk from ZipSet when removing overlay

When a theme that is currently applied is updated, the resources.apk
prior to the update remains in the AssetManager ZipSet and is still
used when loading themed assets.  This patch removes the resources.apk
from the ZipSet so that the new one can be correctly loaded in.

Change-Id: Ia0b415a3598779825090f365581d374bf51c812d
REF: THEMES-639
parent 7739ab7e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -380,6 +380,8 @@ private:
        void addOverlay(const String8& path, const asset_path& overlay);
        bool getOverlay(const String8& path, size_t idx, asset_path* out) const;

        void closeZip(const String8& zip);
        
    private:
        void closeZip(int idx);

+7 −0
Original line number Diff line number Diff line
@@ -1018,6 +1018,9 @@ bool AssetManager::removeOverlayPath(const String8& packageName, int32_t cookie)
        return false;
    }

    const asset_path& oap = mAssetPaths.itemAt(which);
    mZipSet.closeZip(oap.resApkPath);

    mAssetPaths.removeAt(which);

    ResTable* rt = mResources;
@@ -2291,6 +2294,10 @@ ZipFileRO* AssetManager::ZipSet::getZip(const String8& path)
    return zip->getZip();
}

void AssetManager::ZipSet::closeZip(const String8& zip) {
    closeZip(getIndex(zip));
}

Asset* AssetManager::ZipSet::getZipResourceTableAsset(const String8& path)
{
    int idx = getIndex(path);