Fix a few bugs introduced by the move to zip_archive.

- mmap failures because the output file was opened with
  O_WRONLY instead of O_RDWR

- In two instances, we were passing the wrong handle
  to CloseArchive(ZipArchiveHandle). The issue is code
  like this:

  ZipArchiveHandle h;
  OpenArchive(&h);
  CloseArchive(&h);

  This compiles, but isn't correct. ZipArchiveHandle is
  a typedef for (void *) and the compiler won't complain
  because void** is also void*. Some of this code was written
  before the API was changed from CloseArchive(ZipArchiveHandle&)
  to CloseArchie(ZipArchiveHandle) but continued to compile
  even after the API change. I'll change the API in the follow up
  to catch errors like this at compile time.

bug: 12173498
bug: 12176258
bug: 12178641

Change-Id: I71ac36654311f582b5ab633e1ed0d13e00053c84
Revert "Revert "Use libziparchive for dalvik zip processing.""

This reverts commit 52dacd58ac8735ffdcd6bbe952586a38ad70e6a5.

Change-Id: Ib782f195373d2b22b5ab1508e5feceea96c75ac9

Change-Id: I0cbe94d2137c273c9b9e3fc458f5f9cb5bd55d19
Changed dvmDexCacheStatus to check for odex file first.

This prevents the generation of a new dexfile when an odex file already
exists when switching between Art and Dalvik.

(cherry picked from commit 36e356c96640775f0a3f167bd2426ea0f0093b8b)

Change-Id: Ieafdca8453f70c96edb787b5a3a3ac7c7aeea021
Fix libutils dependencies for dexdump & dexlist.

We should always use a libutils SHARED_LIBRARY on the target &
a STATIC_LIBRARY on the host.

(cherry picked from commit 2ac78805e1b4d80308c5c4a48a997abc3a2ac37b)

Change-Id: I06c9b8f0cf663e00da0eeba54c893d8eec1d8a9f
Fix libutils dependencies for dexdump & dexlist (again).

We managed to get into a bad state because the change that
fixed dependencies on dalvik-dev was cherry-picked on to
master-aosp and then the change that needed this was
reverted.

Git got confused as a result.

Change-Id: Idef607a676cff85d00e95a94a9be09d791b2fa96