surface flinger framework and issues

by tom » Thu, 09 Apr 2009 16:08:17 GMT

Sponsored Links
 I had read the surface flinger source code in cupcake, and hope to
undertand how the android GUI system work. but now I am mixed-up
and following is my understand and questions:

surfaceflinger work flow:
(1) new surfaceflingerclient(), it will createconnection(), and new a
(2) createsurface, it will new layer or layerblur or layerdim by z-
blend order
(3) createoverlay, if layer support overlay
(4) register buffer
(5) draw something on canvas(line, text, bitmap, rect...) which attach
above buffer
(6) post buffer

my questions now:
(1) surfaceflinger.cpp
SurfaceFlinger::createconnection() will create a client which allocate
8MB heap for manangement surface data handle(color conversion, flip,
how many client have android system? one is BootAnimation, one is test
sample overlays.cpp, one is debug CPUGUAGE, and one is WindowManager?
In fact BootAnimation will destroy when it finish, (but how it destroy
the 8MB heap?). Test sample and debug CPUGUAGE will not start for it
is not enabled.
So android system has only one surface flinger client, isn't it?
OpenGL has another client?

each app with one window has attached one surface? or all app share
one surface?
one surfaceflinger client can create mutiple surfaces?

where is the source code?

(4)surfaceflinger not support YUV format?
and it ony support RGB565?

more question and analysis will be continued,
welcome helps



surface flinger framework and issues

by wu tony » Sat, 11 Apr 2009 14:15:33 GMT

 2009/4/10 tom <>


Sponsored Links

surface flinger framework and issues

by Eric Chen » Sun, 12 Apr 2009 00:38:49 GMT

 faist fooled


Other Threads

1. Facing serious problem with static objects

Hi guys, I am facing a problem in my application.
I have a few static arrays and Hashmaps in my app which i fill in when my
Activity starts.Then this  activity later launches another Activity. Now
user presses Home button of Back button and again restarts the app, even
then the static objects remain in memory. I beleive this is default android
I have an example app.

import java.util.HashMap;

import android.os.Bundle;
import android.util.Log;

public class MyActivity extends Activity {
    public static HashMap<String, String> hMap = new HashMap<String,

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        Log.i("***","Hash map size = "+hMap.size());


        Log.i("***","Activity onCreate() called");
    public void onDestroy()
        Log.i("***","Activity onDestroy() called");


    public void onResume()
        Log.i("***","Activity onResume() called");
    public void onStop()


        Log.i("***","Activity onStop() called");

Output First time is Size = 0. for 1st launch, Next for every launch ,
HashMap size is 2... If i use ArrayList , the size of ArrayList goes on
I dont want this to happen.One thing was that to clear the HashMap in
onDestroy() or in onStop() in case user presses Home button. But my Activity
launches another ListActivity in it. So the alternae option is to clear the
Hashmaps in onDestroy() | onStop() of this activity.
I am not much clear when the Activity exits. From the posts that i have read
i found few things here

2. New Android Project in Eclipse - Build Target Section Not Selectable

Are you working with a 1366x768 screen resolution or below ?

I have the same problem too. In my particular case, It seems to be a bug (?)
in the "New Android Project" dialogbox : Build Target group is resized and
too small.

I join a screen capture to this message ...

Auto Hiding menu bar and using the keyboad (tab and arrow keys) may help to
select Build Target - or maybe using a virtual desktop with a higher screen
resolution ...

- Hope it helps -


(Sorry if my english is pretty poor - My mother tongue is french ;) )

2009/12/26 android12345 <>


3. Query in Google Map

4. Spinner colors wrong

5. Problem with eclipse and ADT

6. Need some advises about what if want to copy messages to sd card

7. What's the difference between these two urls