Merge "Add acloud shortcut in envsetup.sh"
diff --git a/core/definitions.mk b/core/definitions.mk
index 34f6ed7..b578134 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2410,25 +2410,18 @@
# Uncompress dex files embedded in an apk.
#
define uncompress-dexs
-$(hide) if (zipinfo $@ '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
- tmpdir=$@.tmpdir; \
- rm -rf $$tmpdir && mkdir $$tmpdir; \
- unzip -q $@ '*.dex' -d $$tmpdir && \
- zip -qd $@ '*.dex' && \
- ( cd $$tmpdir && find . -type f | sort | zip -qD -X -0 ../$(notdir $@) -@ ) && \
- rm -rf $$tmpdir; \
+ if (zipinfo $@ '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
+ $(ZIP2ZIP) -i $@ -o $@.tmp -0 "classes*.dex" && \
+ mv -f $@.tmp $@ ; \
fi
endef
# Uncompress shared libraries embedded in an apk.
#
define uncompress-shared-libs
-$(hide) if (zipinfo $@ $(PRIVATE_EMBEDDED_JNI_LIBS) 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
- rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
- unzip -q $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
- zip -qd $@ 'lib/*.so' && \
- ( cd $(dir $@)uncompressedlibs && find lib -type f | sort | zip -qD -X -0 ../$(notdir $@) -@ ) && \
- rm -rf $(dir $@)uncompressedlibs; \
+ if (zipinfo $@ $(PRIVATE_EMBEDDED_JNI_LIBS) 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
+ $(ZIP2ZIP) -i $@ -o $@.tmp $(addprefix -0 ,$(patsubst 'lib/*.so','lib/**/*.so',$(PRIVATE_EMBEDDED_JNI_LIBS))) && \
+ mv -f $@.tmp $@ ; \
fi
endef
@@ -2473,7 +2466,7 @@
endef
define copy-and-uncompress-dexs
-$(2): $(1) $(ZIPALIGN)
+$(2): $(1) $(ZIPALIGN) $(ZIP2ZIP)
@echo "Uncompress dexs in: $$@"
$$(copy-file-to-target)
$$(uncompress-dexs)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 9343415..84d1c2c 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -620,6 +620,9 @@
ifdef LOCAL_COMPRESSED_MODULE
$(LOCAL_BUILT_MODULE) : $(MINIGZIP)
endif
+ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
+$(LOCAL_BUILT_MODULE) : $(ZIP2ZIP)
+endif
ifneq ($(BUILD_PLATFORM_ZIP),)
$(LOCAL_BUILT_MODULE) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
endif
@@ -685,6 +688,9 @@
## Rule to build the odex file
ifdef LOCAL_DEX_PREOPT
$(built_odex): PRIVATE_DEX_FILE := $(built_dex)
+ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
+$(built_odex): $(ZIP2ZIP)
+endif
# Use pattern rule - we may have multiple built odex files.
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
$(hide) mkdir -p $(dir $@) && rm -f $@
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 9ea29fa..30a9c37 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -342,6 +342,7 @@
embedded_prebuilt_jni_libs := 'lib/*.so'
endif
$(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs)
+$(built_module): $(ZIP2ZIP)
ifdef LOCAL_COMPRESSED_MODULE
$(built_module) : $(MINIGZIP)
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp
index af04a34..eea1749 100644
--- a/tools/zipalign/ZipAlign.cpp
+++ b/tools/zipalign/ZipAlign.cpp
@@ -111,7 +111,7 @@
status = pZout->add(pZin, pEntry, padding, &pNewEntry);
}
- if (status != NO_ERROR)
+ if (status != OK)
return 1;
bias += padding;
//printf(" added '%s' at %ld (pad=%d)\n",
@@ -146,13 +146,13 @@
return 1;
}
- if (zin.open(inFileName, ZipFile::kOpenReadOnly) != NO_ERROR) {
+ if (zin.open(inFileName, ZipFile::kOpenReadOnly) != OK) {
fprintf(stderr, "Unable to open '%s' as zip archive\n", inFileName);
return 1;
}
if (zout.open(outFileName,
ZipFile::kOpenReadWrite|ZipFile::kOpenCreate|ZipFile::kOpenTruncate)
- != NO_ERROR)
+ != OK)
{
fprintf(stderr, "Unable to open '%s' as zip archive\n", outFileName);
return 1;
@@ -178,7 +178,7 @@
if (verbose)
printf("Verifying alignment of %s (%d)...\n", fileName, alignment);
- if (zipFile.open(fileName, ZipFile::kOpenReadOnly) != NO_ERROR) {
+ if (zipFile.open(fileName, ZipFile::kOpenReadOnly) != OK) {
fprintf(stderr, "Unable to open '%s' for verification\n", fileName);
return 1;
}
diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp
index c3c833e..810d74a 100644
--- a/tools/zipalign/ZipEntry.cpp
+++ b/tools/zipalign/ZipEntry.cpp
@@ -48,7 +48,7 @@
/* read the CDE */
result = mCDE.read(fp);
- if (result != NO_ERROR) {
+ if (result != OK) {
ALOGD("mCDE.read failed\n");
return result;
}
@@ -64,7 +64,7 @@
}
result = mLFH.read(fp);
- if (result != NO_ERROR) {
+ if (result != OK) {
ALOGD("mLFH.read failed\n");
return result;
}
@@ -103,7 +103,7 @@
* can defer worrying about that to when we're extracting data.
*/
- return NO_ERROR;
+ return OK;
}
/*
@@ -189,7 +189,7 @@
mLFH.mExtraFieldLength+1);
}
- return NO_ERROR;
+ return OK;
}
/*
@@ -225,7 +225,7 @@
mLFH.mExtraFieldLength = padding;
}
- return NO_ERROR;
+ return OK;
}
/*
@@ -403,7 +403,7 @@
*/
status_t ZipEntry::LocalFileHeader::read(FILE* fp)
{
- status_t result = NO_ERROR;
+ status_t result = OK;
uint8_t buf[kLFHLen];
assert(mFileName == NULL);
@@ -499,7 +499,7 @@
return UNKNOWN_ERROR;
}
- return NO_ERROR;
+ return OK;
}
@@ -537,7 +537,7 @@
*/
status_t ZipEntry::CentralDirEntry::read(FILE* fp)
{
- status_t result = NO_ERROR;
+ status_t result = OK;
uint8_t buf[kCDELen];
/* no re-use */
@@ -669,7 +669,7 @@
return UNKNOWN_ERROR;
}
- return NO_ERROR;
+ return OK;
}
/*
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 9e44956..63fb962 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -120,7 +120,7 @@
* have a need for empty zip files.)
*/
mNeedCDRewrite = true;
- result = NO_ERROR;
+ result = OK;
}
if (flags & kOpenReadOnly)
@@ -205,7 +205,7 @@
*/
status_t ZipFile::readCentralDir(void)
{
- status_t result = NO_ERROR;
+ status_t result = OK;
uint8_t* buf = NULL;
off_t fileLength, seekStart;
long readAmount;
@@ -267,7 +267,7 @@
/* extract eocd values */
result = mEOCD.readBuf(buf + i, readAmount - i);
- if (result != NO_ERROR) {
+ if (result != OK) {
ALOGD("Failure reading %ld bytes of EOCD values", readAmount - i);
goto bail;
}
@@ -311,7 +311,7 @@
ZipEntry* pEntry = new ZipEntry;
result = pEntry->initFromCDE(mZipFp);
- if (result != NO_ERROR) {
+ if (result != OK) {
ALOGD("initFromCDE failed\n");
delete pEntry;
goto bail;
@@ -361,7 +361,7 @@
const char* storageName, int compressionMethod, ZipEntry** ppEntry)
{
ZipEntry* pEntry = NULL;
- status_t result = NO_ERROR;
+ status_t result = OK;
long lfhPosn, startPosn, endPosn, uncompressedLen;
FILE* inputFp = NULL;
uint32_t crc;
@@ -415,7 +415,7 @@
if (compressionMethod == ZipEntry::kCompressDeflated) {
bool failed = false;
result = compressFpToFp(mZipFp, inputFp, data, size, &crc);
- if (result != NO_ERROR) {
+ if (result != OK) {
ALOGD("compression failed, storing\n");
failed = true;
} else {
@@ -447,7 +447,7 @@
} else {
result = copyDataToFp(mZipFp, data, size, &crc);
}
- if (result != NO_ERROR) {
+ if (result != OK) {
// don't need to truncate; happens in CDE rewrite
ALOGD("failed copying data in\n");
goto bail;
@@ -535,11 +535,11 @@
}
result = pEntry->initFromExternal(pSourceEntry);
- if (result != NO_ERROR)
+ if (result != OK)
goto bail;
if (padding != 0) {
result = pEntry->addPadding(padding);
- if (result != NO_ERROR)
+ if (result != OK)
goto bail;
}
@@ -574,7 +574,7 @@
copyLen += ZipEntry::kDataDescriptorLen;
if (copyPartialFpToFp(mZipFp, pSourceZip->mZipFp, copyLen, NULL)
- != NO_ERROR)
+ != OK)
{
ALOGW("copy of '%s' failed\n", pEntry->mCDE.mFileName);
result = UNKNOWN_ERROR;
@@ -603,7 +603,7 @@
*ppEntry = pEntry;
pEntry = NULL;
- result = NO_ERROR;
+ result = OK;
bail:
delete pEntry;
@@ -642,7 +642,7 @@
}
result = pEntry->initFromExternal(pSourceEntry);
- if (result != NO_ERROR)
+ if (result != OK)
goto bail;
/*
@@ -682,7 +682,7 @@
}
long startPosn = ftell(mZipFp);
uint32_t crc;
- if (compressFpToFp(mZipFp, NULL, buf, uncompressedLen, &crc) != NO_ERROR) {
+ if (compressFpToFp(mZipFp, NULL, buf, uncompressedLen, &crc) != OK) {
ALOGW("recompress of '%s' failed\n", pEntry->mCDE.mFileName);
result = UNKNOWN_ERROR;
free(buf);
@@ -699,7 +699,7 @@
copyLen += ZipEntry::kDataDescriptorLen;
if (copyPartialFpToFp(mZipFp, pSourceZip->mZipFp, copyLen, NULL)
- != NO_ERROR)
+ != OK)
{
ALOGW("copy of '%s' failed\n", pEntry->mCDE.mFileName);
result = UNKNOWN_ERROR;
@@ -738,7 +738,7 @@
*ppEntry = pEntry;
pEntry = NULL;
- result = NO_ERROR;
+ result = OK;
bail:
delete pEntry;
@@ -773,7 +773,7 @@
}
}
- return NO_ERROR;
+ return OK;
}
/*
@@ -793,7 +793,7 @@
}
}
- return NO_ERROR;
+ return OK;
}
/*
@@ -837,7 +837,7 @@
length -= readSize;
}
- return NO_ERROR;
+ return OK;
}
/*
@@ -849,7 +849,7 @@
status_t ZipFile::compressFpToFp(FILE* dstFp, FILE* srcFp,
const void* data, size_t size, uint32_t* pCRC32)
{
- status_t result = NO_ERROR;
+ status_t result = OK;
const size_t kBufSize = 1024 * 1024;
uint8_t* inBuf = NULL;
uint8_t* outBuf = NULL;
@@ -933,7 +933,7 @@
/* mark entry as deleted, and mark archive as dirty */
pEntry->setDeleted();
mNeedCDRewrite = true;
- return NO_ERROR;
+ return OK;
}
/*
@@ -944,19 +944,19 @@
*/
status_t ZipFile::flush(void)
{
- status_t result = NO_ERROR;
+ status_t result = OK;
long eocdPosn;
int i, count;
if (mReadOnly)
return INVALID_OPERATION;
if (!mNeedCDRewrite)
- return NO_ERROR;
+ return OK;
assert(mZipFp != NULL);
result = crunchArchive();
- if (result != NO_ERROR)
+ if (result != OK)
return result;
if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0)
@@ -986,7 +986,7 @@
/* should we clear the "newly added" flag in all entries now? */
mNeedCDRewrite = false;
- return NO_ERROR;
+ return OK;
}
/*
@@ -997,7 +997,7 @@
*/
status_t ZipFile::crunchArchive(void)
{
- status_t result = NO_ERROR;
+ status_t result = OK;
int i, count;
long delCount, adjust;
@@ -1065,7 +1065,7 @@
// pEntry->getFileName(), adjust);
result = filemove(mZipFp, pEntry->getLFHOffset() - adjust,
pEntry->getLFHOffset(), span);
- if (result != NO_ERROR) {
+ if (result != OK) {
/* this is why you use a temp file */
ALOGE("error during crunch - archive is toast\n");
return result;
@@ -1097,7 +1097,7 @@
status_t ZipFile::filemove(FILE* fp, off_t dst, off_t src, size_t n)
{
if (dst == src || n <= 0)
- return NO_ERROR;
+ return OK;
uint8_t readBuf[32768];
@@ -1140,7 +1140,7 @@
return UNKNOWN_ERROR;
}
- return NO_ERROR;
+ return OK;
}
@@ -1355,7 +1355,7 @@
memcpy(mComment, buf + kEOCDLen, mCommentLen);
}
- return NO_ERROR;
+ return OK;
}
/*
@@ -1382,7 +1382,7 @@
return UNKNOWN_ERROR;
}
- return NO_ERROR;
+ return OK;
}
/*