From b7195c9da541575e2beabef44ac9c506e6c973fd Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Wed, 2 Jun 2010 15:42:28 +0200 Subject: [PATCH] Support changing style parent in overlays MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Package overlays makes it possible for vendors to tweak the look of the platform and the applications without touching any platform or application code directly. This makes package overlays an important mechanism in the Android build system. There is currently a limitation that forbids changing the parent of a style. If vendors could change the parent of e.g. ‘CalendarTheme’ from Android’s vanilla ‘Theme’ to ‘VendorTheme’, then vendor specific adjustments could be done without changing any code directly. From looking at the code it can be seen that the parent value of a style is stored temporarily in ResourceTable::Entry::mParent while overlays are gone through in buildResources(), and processed (in ResourceTable::Entry::assignResourceIds()) at first after all overlays have been handled, so there aren’t any obvious reasons why changing parent in an overlay should be forbidden. Change-Id: I5969bb8aab90df437e1967fc504cc0da79107d13 --- ResourceTable.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/ResourceTable.cpp b/ResourceTable.cpp index a2f085a..82c143d 100644 --- a/ResourceTable.cpp +++ b/ResourceTable.cpp @@ -1629,13 +1629,6 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos, // If a parent is explicitly specified, set it. if (bagParent.size() > 0) { - String16 curPar = e->getParent(); - if (curPar.size() > 0 && curPar != bagParent) { - sourcePos.error("Conflicting parents specified, was '%s', now '%s'\n", - String8(e->getParent()).string(), - String8(bagParent).string()); - return UNKNOWN_ERROR; - } e->setParent(bagParent); } @@ -1683,13 +1676,6 @@ status_t ResourceTable::addBag(const SourcePos& sourcePos, // If a parent is explicitly specified, set it. if (bagParent.size() > 0) { - String16 curPar = e->getParent(); - if (curPar.size() > 0 && curPar != bagParent) { - sourcePos.error("Conflicting parents specified, was '%s', now '%s'\n", - String8(e->getParent()).string(), - String8(bagParent).string()); - return UNKNOWN_ERROR; - } e->setParent(bagParent); } -- 2.45.2