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.
(cherry-pick of 34fe3df8519523dbb4bc27010fa57f259d5e868d)
Bug: 21957428
Change-Id: I5ebe0438019958d883a7fda6bd92ea4484211d23
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index bdb659c..37aae52 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -127,9 +127,17 @@
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;
+ ZipString pe(prefix ? prefix : "");
+ ZipString se(suffix ? suffix : "");
int32_t error = StartIteration(mHandle, &(ze->cookie),
- NULL /* prefix */, NULL /* suffix */);
+ prefix ? &pe : NULL,
+ suffix ? &se : NULL);
if (error) {
ALOGW("Could not start iteration over %s: %s", mFileName, ErrorCodeString(error));
delete ze;