Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 329cb07c authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'master' into honeycomb-release

parents 30aa809d f6ebbbab
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -110,6 +110,13 @@ public:
     */
    virtual void bootFinished() = 0;

    /* Capture the specified screen. requires READ_FRAME_BUFFER permission
     * This function will fail if there is a secure window on screen.
     */
    virtual status_t captureScreen(DisplayID dpy,
            sp<IMemoryHeap>* heap,
            uint32_t* width, uint32_t* height, PixelFormat* format) = 0;

    /* Signal surfaceflinger that there might be some work to do
     * This is an ASYNCHRONOUS call.
     */
@@ -133,7 +140,8 @@ public:
        SET_ORIENTATION,
        FREEZE_DISPLAY,
        UNFREEZE_DISPLAY,
        SIGNAL
        SIGNAL,
        CAPTURE_SCREEN
    };

    virtual status_t    onTransact( uint32_t code,
+6 −2
Original line number Diff line number Diff line
@@ -24,8 +24,9 @@
#ifndef __LIBS_ZIPFILERO_H
#define __LIBS_ZIPFILERO_H

#include "Errors.h"
#include "FileMap.h"
#include <utils/Errors.h>
#include <utils/FileMap.h>
#include <utils/threads.h>

#include <stdio.h>
#include <stdlib.h>
@@ -211,6 +212,9 @@ private:
    /* open Zip archive */
    int         mFd;

    /* Lock for handling the file descriptor (seeks, etc) */
    mutable Mutex mFdLock;

    /* zip file name */
    char*       mFileName;

+14 −0
Original line number Diff line number Diff line
@@ -517,12 +517,26 @@ status_t IPCThreadState::transact(int32_t handle,
    }
    
    if ((flags & TF_ONE_WAY) == 0) {
        #if 0
        if (code == 4) { // relayout
            LOGI(">>>>>> CALLING transaction 4");
        } else {
            LOGI(">>>>>> CALLING transaction %d", code);
        }
        #endif
        if (reply) {
            err = waitForResponse(reply);
        } else {
            Parcel fakeReply;
            err = waitForResponse(&fakeReply);
        }
        #if 0
        if (code == 4) { // relayout
            LOGI("<<<<<< RETURNING transaction 4");
        } else {
            LOGI("<<<<<< RETURNING transaction %d", code);
        }
        #endif
        
        IF_LOG_TRANSACTIONS() {
            TextOutput::Bundle _b(alog);
+28 −0
Original line number Diff line number Diff line
@@ -124,6 +124,21 @@ public:
        remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply);
    }

    virtual status_t captureScreen(DisplayID dpy,
            sp<IMemoryHeap>* heap,
            uint32_t* width, uint32_t* height, PixelFormat* format)
    {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        data.writeInt32(dpy);
        remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply);
        *heap = interface_cast<IMemoryHeap>(reply.readStrongBinder());
        *width = reply.readInt32();
        *height = reply.readInt32();
        *format = reply.readInt32();
        return reply.readInt32();
    }

    virtual void signal() const
    {
        Parcel data, reply;
@@ -190,6 +205,19 @@ status_t BnSurfaceComposer::onTransact(
            sp<IBinder> b = getCblk()->asBinder();
            reply->writeStrongBinder(b);
        } break;
        case CAPTURE_SCREEN: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            DisplayID dpy = data.readInt32();
            sp<IMemoryHeap> heap;
            uint32_t w, h;
            PixelFormat f;
            status_t res = captureScreen(dpy, &heap, &w, &h, &f);
            reply->writeStrongBinder(heap->asBinder());
            reply->writeInt32(w);
            reply->writeInt32(h);
            reply->writeInt32(f);
            reply->writeInt32(res);
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
+26 −15
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <utils/ZipFileRO.h>
#include <utils/Log.h>
#include <utils/misc.h>
#include <utils/threads.h>

#include <zlib.h>

@@ -195,7 +196,7 @@ bool ZipFileRO::mapCentralDirectory(void)
            free(scanBuf);
            return false;
        } else if (header != kLFHSignature) {
            LOGV("Not a Zip archive (found 0x%08x)\n", val);
            LOGV("Not a Zip archive (found 0x%08x)\n", header);
            free(scanBuf);
            return false;
        }
@@ -496,16 +497,22 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen,
        }

        unsigned char lfhBuf[kLFHLen];

        {
            AutoMutex _l(mFdLock);

            if (lseek(mFd, localHdrOffset, SEEK_SET) != localHdrOffset) {
                LOGW("failed seeking to lfh at offset %ld\n", localHdrOffset);
                return false;
            }

            ssize_t actual =
                TEMP_FAILURE_RETRY(read(mFd, lfhBuf, sizeof(lfhBuf)));
            if (actual != sizeof(lfhBuf)) {
                LOGW("failed reading lfh from offset %ld\n", localHdrOffset);
                return false;
            }
        }

        if (get4LE(lfhBuf) != kLFHSignature) {
            LOGW("didn't find signature at start of lfh, offset=%ld (got 0x%08lx, expected 0x%08x)\n",
@@ -636,7 +643,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const
        memcpy(buffer, ptr, uncompLen);
    } else {
        if (!inflateBuffer(buffer, ptr, uncompLen, compLen))
            goto bail;
            goto unmap;
    }

    if (compLen > kSequentialMin)
@@ -644,6 +651,8 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const

    result = true;

unmap:
    file->release();
bail:
    return result;
}
@@ -667,7 +676,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const

    getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL);

    const FileMap* file = createEntryFileMap(entry);
    FileMap* file = createEntryFileMap(entry);
    if (file == NULL) {
        goto bail;
    }
@@ -678,21 +687,23 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const
        ssize_t actual = write(fd, ptr, uncompLen);
        if (actual < 0) {
            LOGE("Write failed: %s\n", strerror(errno));
            goto bail;
            goto unmap;
        } else if ((size_t) actual != uncompLen) {
            LOGE("Partial write during uncompress (%zd of %zd)\n",
                (size_t)actual, (size_t)uncompLen);
            goto bail;
            goto unmap;
        } else {
            LOGI("+++ successful write\n");
        }
    } else {
        if (!inflateBuffer(fd, ptr, uncompLen, compLen))
            goto bail;
            goto unmap;
    }

    result = true;

unmap:
    file->release();
bail:
    return result;
}
Loading