+ if ((entry = dexZipFindEntry(&archive, kDexInJarName)) != NULL) {
+ bool newFile = false;
+
+ /*
+ * See if there's an up-to-date copy of the optimized dex
+ * in the cache, but don't create one if there isn't.
+ */
+ ALOGV("dvmDexCacheStatus: Checking cache for %s", fileName);
+ cachedName = dexOptGenerateCacheFileName(fileName, kDexInJarName);
+ if (cachedName == NULL)
+ return DEX_CACHE_BAD_ARCHIVE;
+
+ fd = dvmOpenCachedDexFile(fileName, cachedName,
+ dexGetZipEntryModTime(&archive, entry),
+ dexGetZipEntryCrc32(&archive, entry),
+ /*isBootstrap=*/false, &newFile, /*createIfMissing=*/false);
+ ALOGV("dvmOpenCachedDexFile returned fd %d", fd);
+ if (fd < 0) {
+ result = DEX_CACHE_STALE;
+ goto bail;
+ }
+
+ /* dvmOpenCachedDexFile locks the file as a side-effect.
+ * Unlock and close it.
+ */
+ if (!dvmUnlockCachedDexFile(fd)) {
+ /* uh oh -- this process needs to exit or we'll wedge the system */
+ ALOGE("Unable to unlock DEX file");
+ goto bail;
+ }
+ } else {