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

Commit 9bdba12e authored by Josh Guilfoyle's avatar Josh Guilfoyle
Browse files

Fix issues with theme APKs that do not specify a styleId.

parent bc9dee97
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ public class BaseThemeInfo implements Parcelable {
     * @see styleId attribute
     *
     */
    public int styleResourceId = -1;
    public int styleResourceId = 0;

    /**
     * The name of the theme (as displayed by UI).
+3 −3
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ public final class ThemeInfo extends BaseThemeInfo {
                        break;

                    case STYLE_INDEX:
                        styleResourceId = attrs.getAttributeResourceValue(i, -1);
                        styleResourceId = attrs.getAttributeResourceValue(i, 0);
                        break;

                    case PREVIEW_INDEX:
+3 −3
Original line number Diff line number Diff line
@@ -530,12 +530,12 @@ static SharedBuffer* generateFrameworkRedirections(SharedBuffer* entriesByTypeBu
    // Load up a bag for the user-supplied theme.
    const ResTable::bag_entry* themeEnt = NULL;
    ssize_t N = rt->getBagLocked(styleId, &themeEnt);
    const ResTable::bag_entry* endThemeEnt = themeEnt + N;
    const ResTable::bag_entry* endThemeEnt = themeEnt + (N >= 0 ? N : 0);

    // ...and a bag for the framework default.
    const ResTable::bag_entry* frameworkEnt = NULL;
    N = rt->getBagLocked(0x01030005, &frameworkEnt);
    const ResTable::bag_entry* endFrameworkEnt = frameworkEnt + N;
    const ResTable::bag_entry* endFrameworkEnt = frameworkEnt + (N >= 0 ? N : 0);

    // The first entry should be for the theme itself.
    entriesByTypeBuf = addToEntriesByTypeBuffer(entriesByTypeBuf, 0x01030005, styleId);
@@ -719,7 +719,7 @@ bool AssetManager::generateAndWriteRedirections(ResTable* rt,
    AssetManager* am = (AssetManager*)this;

    SharedBuffer* buf = NULL;
    if (isFramework) {
    if (isFramework && themeStyleId != 0) {
        // Special framework theme heuristic...
        buf = generateFrameworkRedirections(buf, rt, themePackageName,
            themeStyleId, redirPath);