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

Commit fa0dfec2 authored by d34d's avatar d34d
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: I1c9373fa2dd7310a908a1c806c44aadb4d231a4a
REF: THEMES-639
parent 800d811e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -378,6 +378,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
@@ -1054,6 +1054,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;
@@ -2325,6 +2328,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);