diff options
author | Mathias Agopian <mathias@google.com> | 2010-09-24 11:26:58 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-09-24 14:56:39 -0700 |
commit | 1b0b30d04304392748a8a4ab5a69e52a19f51b3a (patch) | |
tree | 24e2ab128b4ce30f158f9113765ac7b6befb1805 /libs/surfaceflinger_client/ISurfaceComposer.cpp | |
parent | 05c53113e0c73c7cab61edf53524c61c20a547c2 (diff) | |
download | frameworks_native-1b0b30d04304392748a8a4ab5a69e52a19f51b3a.zip frameworks_native-1b0b30d04304392748a8a4ab5a69e52a19f51b3a.tar.gz frameworks_native-1b0b30d04304392748a8a4ab5a69e52a19f51b3a.tar.bz2 |
add support for [1974164] Be able to take a screen shot on the device
screenshots are taken using ISurfaceComposer::captureScreen() which returns
the size of the screenshot and an IMemoryHeap containing the data.
screenshots have limitations:
- they will always fail if a secure window is up on screen
- require GL_OES_framebuffer_object extension
- in some situation, video planes won't been captured
Change-Id: I741c68a2d2984fb139039301c3349e6780e2cd58
Diffstat (limited to 'libs/surfaceflinger_client/ISurfaceComposer.cpp')
-rw-r--r-- | libs/surfaceflinger_client/ISurfaceComposer.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/surfaceflinger_client/ISurfaceComposer.cpp b/libs/surfaceflinger_client/ISurfaceComposer.cpp index 5c111f6..040060e 100644 --- a/libs/surfaceflinger_client/ISurfaceComposer.cpp +++ b/libs/surfaceflinger_client/ISurfaceComposer.cpp @@ -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); } |