How to enable Overlay features in Android

by waterblood » Thu, 19 Mar 2009 05:52:45 GMT

Sponsored Links
 Hi All,

   Below is my understanding about how to enable the Overlay in a new
hardware platform. Correct me if I am wrong.

1.  Implement the stub funtions in hardware\libhardware\modules\overlay
\overlay.cpp, this will generate a share library

2. In SurfaceFlinger, it will create a DisplayHardware instance, and
call DisplayHardware::init() which will create an overlay engine from

3. When we want a OverlayRef from ISurface, we call
ISurface::createOverlay() which will take use of the overlay engine
creat in step 2.

4. Create a Overlay from OverlayRef as it in frameworks\base\libs

    sp<OverlayRef> ref = isurface->createOverlay(320, 240,
    sp<Overlay> overlay = new Overlay(ref);

     * here we can use the overlay API

    overlay_buffer_t buffer;
    printf("buffer = %p\n", buffer);

    void* address = overlay->getBufferAddress(buffer);
    printf("address = %p\n", address);


My questions are:
a. In step 4, as we want paint something in the overlay, should we
just put the image data to the buffer return by  overlay->dequeueBuffer
(), and call queueBuffer() to show the buffer?

b. I dont see any update in android_surface_output to take use of
overlay interface, will it be updated to use overlay interface if
overlay is exit in the hardware? I suggest the surface output may try
to create OverlayRef from surface interface, if it fail, surface
output take the display mechanism as before(post buffer), otherwise it
use this overlay to display video frame.

Guoyin Chen

How to enable Overlay features in Android

by AJAY » Tue, 24 Mar 2009 04:33:45 GMT

 You are correct. The current android_surface_output.cpp doesnt have
any Overlay implementation . However you can check the TI
implementation at omap-zoom site

Here is the link : ;a=tree;f=libopencorehw;h=4b843e240897931c150f1a0cb25b1785c9e8dab2;hb=HEAD



Sponsored Links

How to enable Overlay features in Android

by Jill.Zhou » Wed, 29 Apr 2009 02:15:33 GMT

 Hi, Ajay

But how to set position of overlay with current overlay interface.



Other Threads

1. Generate key events on foreground application

I am new android developer. I am writing an application to receive
data from barcode scanner.
I am able to receive data from barcode scanner via bluetooth
If user open notepad or other application, I want to display the data
to the application, so I want to generate key events on foreground

I am trying to find a way but I can't find. Anyone please tell me how
to do?



2. Error in accessing java file genetated from .aidl file

I am trying to launch an existing project which has 2 parts. Services
module and Application module.
The VMService.aidl file is in a package in the service module. When
the service module is compiled, the generated file
appears in the /gen folder.

I have exported this in the source code of the application as
import com.VMService;

But I am still getting run time errors during the launch of the
The LogCat logs show this:
Could not find class com.VMService
06-30 17:33:11.248: ERROR/dalvikvm(460): Could not find class
'com.VVMService', referenced from method

06-30 17:33:11.457: ERROR/AndroidRuntime(460):
java.lang.NoClassDefFoundError: com.VMService

Please let me know where I am going wrong.


3. Custom widget height always 0?

4. Click/press events on multiple resolutions

5. WebView Features

6. hello everyone..

7. Stopping or Killing a Thread