From 833f3ccbc8f4dd1ec8abb9121988b99ff34ec4c1 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 18 Jun 2014 15:06:01 -0700 Subject: AAPT support for feature splits This change allows the developer to add a base package for which to build a feature split. The generated resource types will begin after the base APK's defined types so as not to collide or override resources. Multiple features can be generated by first choosing an arbitrary order for the features. Then for each feature, the base APK and any preceding features are specified with the --feature-of flags. So with a base APK 'A' and features, 'B', and 'C', 'B' would be built with aapt package [...] --feature-of A [...] and 'C' would be built with aapt package [...] --feature-of A --feature-of B [...] Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780 --- tools/aapt/ResourceTable.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'tools/aapt/ResourceTable.h') diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h index a73993c9022f..d4f47ef9555d 100644 --- a/tools/aapt/ResourceTable.h +++ b/tools/aapt/ResourceTable.h @@ -74,11 +74,23 @@ struct AccessorCookie class ResourceTable : public ResTable::Accessor { public: + // The type of package to build. + enum PackageType { + App, + System, + SharedLibrary, + AppFeature + }; + class Package; class Type; class Entry; - ResourceTable(Bundle* bundle, const String16& assetsPackage); + ResourceTable(Bundle* bundle, const String16& assetsPackage, PackageType type); + + const String16& getAssetsPackage() const { + return mAssetsPackage; + } status_t addIncludedResources(Bundle* bundle, const sp& assets); @@ -448,7 +460,7 @@ public: class Package : public RefBase { public: - Package(const String16& name, ssize_t includedId=-1); + Package(const String16& name, size_t packageId); virtual ~Package() { } String16 getName() const { return mName; } @@ -456,7 +468,7 @@ public: const SourcePos& pos, bool doSetIndex = false); - ssize_t getAssignedId() const { return mIncludedId; } + size_t getAssignedId() const { return mPackageId; } const ResStringPool& getTypeStrings() const { return mTypeStrings; } uint32_t indexOfTypeString(const String16& s) const { return mTypeStringsMapping.valueFor(s); } @@ -479,7 +491,7 @@ public: DefaultKeyedVector* mappings); const String16 mName; - const ssize_t mIncludedId; + const size_t mPackageId; DefaultKeyedVector > mTypes; Vector > mOrderedTypes; sp mTypeStringsData; @@ -512,13 +524,11 @@ private: String16 mAssetsPackage; + PackageType mPackageType; sp mAssets; + uint32_t mTypeIdOffset; DefaultKeyedVector > mPackages; Vector > mOrderedPackages; - uint32_t mNextPackageId; - bool mHaveAppPackage; - bool mIsAppPackage; - bool mIsSharedLibrary; size_t mNumLocal; SourcePos mCurrentXmlPos; Bundle* mBundle; -- cgit v1.2.3-59-g8ed1b