magic communication with surface flinger from java layer.

All your problems with Audio, Video and Images.

magic communication with surface flinger from java layer.

Postby k.rajireddy » Wed Aug 12, 2009 6:48 am

private void updateFlingerOptions() {
// magic communication with surface flinger.
try {
IBinder flinger = ServiceManager.getService
if (flinger != null) {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
flinger.transact(1010, data, reply, 0);
int v;
v = reply.readInt();
mShowCpuCB.setChecked(v != 0);
v = reply.readInt();
mEnableGLCB.setChecked(v != 0);
v = reply.readInt();
mShowUpdatesCB.setChecked(v != 0);
v = reply.readInt();
mShowBackgroundCB.setChecked(v != 0);
} catch (RemoteException ex) {

In the above java method, SurfaceFlinger native service is used from
Java layer.

flinger.transact(1010, data, reply, 0) is taking two java Parcel
objects as parameters but the corresponding Binder.transact of
SurfaceFlinger.cpp is expecting two C++ Parcel objects as parameters.

So, the question is: how is it working like this? we are passing Java
Parcel objects where we are expected to pass C++ Parcel objects.

Is JNI involed in this usecase?

Since it is working fine which means that we can even access a java
remotable object from native layer and call IBinder.transact() without
bothering about its arguments. Is this right?

pls clarify. thanks in advance.
Posts: 3
Joined: Fri Jun 12, 2009 2:58 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 12 guests