diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h index bbbda9c16..ea9b66c49 100644 --- a/include/binder/MemoryHeapBase.h +++ b/include/binder/MemoryHeapBase.h @@ -58,10 +58,13 @@ public: /* implement IMemoryHeap interface */ virtual int getHeapID() const; + + /* virtual address of the heap. returns MAP_FAILED in case of error */ virtual void* getBase() const; + virtual size_t getSize() const; virtual uint32_t getFlags() const; - virtual uint32_t getOffset() const; + virtual uint32_t getOffset() const; const char* getDevice() const; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 6ed9843f4..ceae8d789 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2497,7 +2497,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(const sp& display, sp base( new MemoryHeapBase(size, 0, "screen-capture") ); void* const ptr = base->getBase(); - if (ptr) { + if (ptr != MAP_FAILED) { // capture the screen with glReadPixels() ScopedTrace _t(ATRACE_TAG, "glReadPixels"); glReadPixels(0, 0, sw, sh, GL_RGBA, GL_UNSIGNED_BYTE, ptr);