Merge "Build overlay packages just like regular packages."
This commit is contained in:
@@ -9,6 +9,4 @@ LOCAL_SDK_VERSION := current
|
|||||||
|
|
||||||
LOCAL_PACKAGE_NAME := com.android.overlaytest.overlay
|
LOCAL_PACKAGE_NAME := com.android.overlaytest.overlay
|
||||||
|
|
||||||
LOCAL_AAPT_FLAGS := -o
|
|
||||||
|
|
||||||
include $(BUILD_PACKAGE)
|
include $(BUILD_PACKAGE)
|
||||||
|
|||||||
@@ -4341,7 +4341,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui
|
|||||||
}
|
}
|
||||||
Vector<uint32_t>& vector = map.editItemAt(mapIndex);
|
Vector<uint32_t>& vector = map.editItemAt(mapIndex);
|
||||||
for (size_t entryIndex = 0; entryIndex < typeConfigs->entryCount; ++entryIndex) {
|
for (size_t entryIndex = 0; entryIndex < typeConfigs->entryCount; ++entryIndex) {
|
||||||
uint32_t resID = (0xff000000 & ((pkg->package->id)<<24))
|
uint32_t resID = pkg_id
|
||||||
| (0x00ff0000 & ((typeIndex+1)<<16))
|
| (0x00ff0000 & ((typeIndex+1)<<16))
|
||||||
| (0x0000ffff & (entryIndex));
|
| (0x0000ffff & (entryIndex));
|
||||||
resource_name resName;
|
resource_name resName;
|
||||||
@@ -4359,8 +4359,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui
|
|||||||
overlayPackage.string(),
|
overlayPackage.string(),
|
||||||
overlayPackage.size());
|
overlayPackage.size());
|
||||||
if (overlayResID != 0) {
|
if (overlayResID != 0) {
|
||||||
// overlay package has package ID == 0, use original package's ID instead
|
overlayResID = pkg_id | (0x00ffffff & overlayResID);
|
||||||
overlayResID |= pkg_id;
|
|
||||||
}
|
}
|
||||||
vector.push(overlayResID);
|
vector.push(overlayResID);
|
||||||
if (overlayResID != 0 && offset == -1) {
|
if (overlayResID != 0 && offset == -1) {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ public:
|
|||||||
mWantUTF16(false), mValues(false),
|
mWantUTF16(false), mValues(false),
|
||||||
mCompressionMethod(0), mOutputAPKFile(NULL),
|
mCompressionMethod(0), mOutputAPKFile(NULL),
|
||||||
mManifestPackageNameOverride(NULL), mInstrumentationPackageNameOverride(NULL),
|
mManifestPackageNameOverride(NULL), mInstrumentationPackageNameOverride(NULL),
|
||||||
mIsOverlayPackage(false),
|
|
||||||
mAutoAddOverlay(false), mGenDependencies(false),
|
mAutoAddOverlay(false), mGenDependencies(false),
|
||||||
mAssetSourceDir(NULL),
|
mAssetSourceDir(NULL),
|
||||||
mCrunchedOutputDir(NULL), mProguardFile(NULL),
|
mCrunchedOutputDir(NULL), mProguardFile(NULL),
|
||||||
@@ -96,8 +95,6 @@ public:
|
|||||||
void setManifestPackageNameOverride(const char * val) { mManifestPackageNameOverride = val; }
|
void setManifestPackageNameOverride(const char * val) { mManifestPackageNameOverride = val; }
|
||||||
const char* getInstrumentationPackageNameOverride() const { return mInstrumentationPackageNameOverride; }
|
const char* getInstrumentationPackageNameOverride() const { return mInstrumentationPackageNameOverride; }
|
||||||
void setInstrumentationPackageNameOverride(const char * val) { mInstrumentationPackageNameOverride = val; }
|
void setInstrumentationPackageNameOverride(const char * val) { mInstrumentationPackageNameOverride = val; }
|
||||||
bool getIsOverlayPackage() const { return mIsOverlayPackage; }
|
|
||||||
void setIsOverlayPackage(bool val) { mIsOverlayPackage = val; }
|
|
||||||
bool getAutoAddOverlay() { return mAutoAddOverlay; }
|
bool getAutoAddOverlay() { return mAutoAddOverlay; }
|
||||||
void setAutoAddOverlay(bool val) { mAutoAddOverlay = val; }
|
void setAutoAddOverlay(bool val) { mAutoAddOverlay = val; }
|
||||||
bool getGenDependencies() { return mGenDependencies; }
|
bool getGenDependencies() { return mGenDependencies; }
|
||||||
@@ -235,7 +232,6 @@ private:
|
|||||||
const char* mOutputAPKFile;
|
const char* mOutputAPKFile;
|
||||||
const char* mManifestPackageNameOverride;
|
const char* mManifestPackageNameOverride;
|
||||||
const char* mInstrumentationPackageNameOverride;
|
const char* mInstrumentationPackageNameOverride;
|
||||||
bool mIsOverlayPackage;
|
|
||||||
bool mAutoAddOverlay;
|
bool mAutoAddOverlay;
|
||||||
bool mGenDependencies;
|
bool mGenDependencies;
|
||||||
const char* mAssetSourceDir;
|
const char* mAssetSourceDir;
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ void usage(void)
|
|||||||
" [-F apk-file] [-J R-file-dir] \\\n"
|
" [-F apk-file] [-J R-file-dir] \\\n"
|
||||||
" [--product product1,product2,...] \\\n"
|
" [--product product1,product2,...] \\\n"
|
||||||
" [-c CONFIGS] [--preferred-configurations CONFIGS] \\\n"
|
" [-c CONFIGS] [--preferred-configurations CONFIGS] \\\n"
|
||||||
" [-o] \\\n"
|
|
||||||
" [raw-files-dir [raw-files-dir] ...]\n"
|
" [raw-files-dir [raw-files-dir] ...]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Package the android resources. It will read assets and resources that are\n"
|
" Package the android resources. It will read assets and resources that are\n"
|
||||||
@@ -110,7 +109,6 @@ void usage(void)
|
|||||||
" -j specify a jar or zip file containing classes to include\n"
|
" -j specify a jar or zip file containing classes to include\n"
|
||||||
" -k junk path of file(s) added\n"
|
" -k junk path of file(s) added\n"
|
||||||
" -m make package directories under location specified by -J\n"
|
" -m make package directories under location specified by -J\n"
|
||||||
" -o create overlay package (ie only resources; expects <overlay-package> in manifest)\n"
|
|
||||||
#if 0
|
#if 0
|
||||||
" -p pseudolocalize the default configuration\n"
|
" -p pseudolocalize the default configuration\n"
|
||||||
#endif
|
#endif
|
||||||
@@ -292,9 +290,6 @@ int main(int argc, char* const argv[])
|
|||||||
case 'm':
|
case 'm':
|
||||||
bundle.setMakePackageDirs(true);
|
bundle.setMakePackageDirs(true);
|
||||||
break;
|
break;
|
||||||
case 'o':
|
|
||||||
bundle.setIsOverlayPackage(true);
|
|
||||||
break;
|
|
||||||
#if 0
|
#if 0
|
||||||
case 'p':
|
case 'p':
|
||||||
bundle.setPseudolocalize(true);
|
bundle.setPseudolocalize(true);
|
||||||
|
|||||||
@@ -3609,9 +3609,7 @@ sp<ResourceTable::Package> ResourceTable::getPackage(const String16& package)
|
|||||||
{
|
{
|
||||||
sp<Package> p = mPackages.valueFor(package);
|
sp<Package> p = mPackages.valueFor(package);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
if (mBundle->getIsOverlayPackage()) {
|
if (mIsAppPackage) {
|
||||||
p = new Package(package, 0x00);
|
|
||||||
} else if (mIsAppPackage) {
|
|
||||||
if (mHaveAppPackage) {
|
if (mHaveAppPackage) {
|
||||||
fprintf(stderr, "Adding multiple application package resources; only one is allowed.\n"
|
fprintf(stderr, "Adding multiple application package resources; only one is allowed.\n"
|
||||||
"Use -x to create extended resources.\n");
|
"Use -x to create extended resources.\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user