summaryrefslogtreecommitdiffstats
path: root/libs/androidfw
diff options
context:
space:
mode:
authorYusuke Sato <yusukes@google.com>2015-06-19 17:18:07 -0700
committerYusuke Sato <yusukes@google.com>2015-06-22 16:11:32 -0700
commit34fe3df8519523dbb4bc27010fa57f259d5e868d (patch)
tree08282d0b6cc64337f57e5d9964bf14d42580fddb /libs/androidfw
parent84a378f256bf7925ceb5d2c039a033d3e59b75df (diff)
downloadframeworks_base-34fe3df8519523dbb4bc27010fa57f259d5e868d.zip
frameworks_base-34fe3df8519523dbb4bc27010fa57f259d5e868d.tar.gz
frameworks_base-34fe3df8519523dbb4bc27010fa57f259d5e868d.tar.bz2
Let findSupportedAbi and hasRenderscriptBitcode scan only relevant files
for better performance. Without the optimization, these two functions may check more than 100k file names in the pre-installed APK files, which can take a few seconds to finish even on a recent device. Bug: 21957428 Change-Id: I315fd3c6d5aa1076b993752525de449a9933de12
Diffstat (limited to 'libs/androidfw')
-rw-r--r--libs/androidfw/ZipFileRO.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index 6f927b4..a6f6d8c 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -126,10 +126,18 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, uint16_t* pMethod,
return true;
}
-bool ZipFileRO::startIteration(void** cookie)
+bool ZipFileRO::startIteration(void** cookie) {
+ return startIteration(cookie, NULL, NULL);
+}
+
+bool ZipFileRO::startIteration(void** cookie, const char* prefix, const char* suffix)
{
_ZipEntryRO* ze = new _ZipEntryRO;
- int32_t error = StartIteration(mHandle, &(ze->cookie), NULL /* prefix */);
+ ZipEntryName pe(prefix ? prefix : "");
+ ZipEntryName se(suffix ? suffix : "");
+ int32_t error = StartIteration(mHandle, &(ze->cookie),
+ prefix ? &pe : NULL,
+ suffix ? &se : NULL);
if (error) {
ALOGW("Could not start iteration over %s: %s", mFileName, ErrorCodeString(error));
delete ze;