Revert "libandroidfw hardening for IncFs"

Revert "Move map_ptr to incfs namspace"

Revert submission 12787270

Reason for revert: b/173250495
Reverted Changes:
I5cd1bc8a2:libandroidfw hardening for IncFs
Ice5dbcfb2:Move map_ptr to incfs namspace
I29ccdc8ed:Do not cache bag parent stack until requested
I1e9e9acaa:Cache resolved theme values

Change-Id: Ib90ef68339710086df41e9abe0833a542d03a74f
diff --git a/libs/androidfw/ZipUtils.cpp b/libs/androidfw/ZipUtils.cpp
index 58fc5bb..568e3b6 100644
--- a/libs/androidfw/ZipUtils.cpp
+++ b/libs/androidfw/ZipUtils.cpp
@@ -40,7 +40,7 @@
     explicit FileReader(FILE* fp) : Reader(), mFp(fp), mCurrentOffset(0) {
     }
 
-    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const override {
+    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
         // Data is usually requested sequentially, so this helps avoid pointless
         // fseeks every time we perform a read. There's an impedence mismatch
         // here because the original API was designed around pread and pwrite.
@@ -71,7 +71,7 @@
     explicit FdReader(int fd) : mFd(fd) {
     }
 
-    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const override {
+    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
       return android::base::ReadFullyAtOffset(mFd, buf, len, offset);
     }
 
@@ -81,27 +81,22 @@
 
 class BufferReader : public zip_archive::Reader {
   public:
-    BufferReader(incfs::map_ptr<void> input, size_t inputSize) : Reader(),
-        mInput(input.convert<uint8_t>()),
+    BufferReader(const void* input, size_t inputSize) : Reader(),
+        mInput(reinterpret_cast<const uint8_t*>(input)),
         mInputSize(inputSize) {
     }
 
-    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const override {
+    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
         if (mInputSize < len || offset > mInputSize - len) {
             return false;
         }
 
-        const incfs::map_ptr<uint8_t> pos = mInput.offset(offset);
-        if (!pos.verify(len)) {
-          return false;
-        }
-
-        memcpy(buf, pos.unsafe_ptr(), len);
+        memcpy(buf, mInput + offset, len);
         return true;
     }
 
   private:
-    const incfs::map_ptr<uint8_t> mInput;
+    const uint8_t* mInput;
     const size_t mInputSize;
 };
 
@@ -143,7 +138,7 @@
     return (zip_archive::Inflate(reader, compressedLen, uncompressedLen, &writer, nullptr) == 0);
 }
 
-/*static*/ bool ZipUtils::inflateToBuffer(incfs::map_ptr<void> in, void* buf,
+/*static*/ bool ZipUtils::inflateToBuffer(const void* in, void* buf,
     long uncompressedLen, long compressedLen)
 {
     BufferReader reader(in, compressedLen);