Modifying Layers inside the SurfaceFlinger

829 views
Skip to first unread message

Tez

unread,
Mar 7, 2014, 9:14:21 PM3/7/14
to android-...@googlegroups.com
I am trying to modify the SurfaceFlinger to implement a set of custom transforms on surface data.
As a first step, I am trying to identify to whom a layer belongs (i.e which uid/pid).
As the second step, I am trying to overlay an image onto one of the target layers from within the surface flinger.

How can I get this done? I've been reading the SurfaceFlinger code and the render loop calls the onDraw function
of all the layers being composited. 
For example, one function is LayerBase::drawWithOpenGL. I have seen Jeff Sharkey's early example on alpha channel
hackery to reduce power consumption, but I'm not sure if I'm looking in the right place.

Any guidance is much appreciated.


PS: This is NOT for production or anything. Just personal experiments.

Tez

unread,
Mar 8, 2014, 9:36:49 PM3/8/14
to android-...@googlegroups.com
So I've just discovered that the name of the layer corresponds to the activity.
There seems to be one layer per activity.

Is there always one layer per activity?
Who sets the name? I've noticed transient names. For example, when the app is starting, I see a name
like "Starting packagename..." and later it changes to package name.

-Earlence

Craig Mautner

unread,
Mar 10, 2014, 9:56:59 AM3/10/14
to android-...@googlegroups.com
The surfaces you are looking at correspond to a window in the window manager. They are generally created when its activity is brought to the foreground and destroyed when the activity is hidden. The ones labeled "Starting..." are created by the window manager in order to display something while the activity is starting up. Once the activity has drawn into its window the Starting window fades out and is destroyed.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.



--
Craig Mautner | Android Framework | cmau...@google.com | 858-361-2683

Tez

unread,
Mar 10, 2014, 1:36:04 PM3/10/14
to android-...@googlegroups.com
Hi Craig,

I think I've seen your name while reading the code (cmautner).

Thanks for the info.
Another question:
Is there a way (from within surfaceflinger or Window manager service) to enforce a particular Z order on layers (surfaces)?
What needs to be modified for me to ensure some specific Z order on, say, 2 layers in the layer stack?

-Earlence
Reply all
Reply to author
Forward
0 new messages