diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-08-26 02:47:39 -0700 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2012-08-27 14:34:54 -0700 |
| commit | 64a55af0ac700baecb0877235eb42caac59a3560 (patch) | |
| tree | 0f3c36ce8204e6cf8eedf04ce9ae24373239ddd8 /core/java/android/view/SurfaceSession.java | |
| parent | 0b722fe9ce98d97dbcb6fefd170b85ab7037e528 (diff) | |
Add plumbing for new surface flinger display API.
Cleaned up the implementation of Surface and SurfaceSession
to use more consistent naming and structure.
Added JNI for all of the new surface flinger display API calls.
Enforced the requirement that all Surfaces created by
the window manager be named.
Updated the display manager service to use the new methods.
Change-Id: I2a658f1bfd0437e1c6f9d22df8d4ffcce7284ca2
Diffstat (limited to 'core/java/android/view/SurfaceSession.java')
| -rw-r--r-- | core/java/android/view/SurfaceSession.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/core/java/android/view/SurfaceSession.java b/core/java/android/view/SurfaceSession.java index 2491abef0de6..0dfd94a93219 100644 --- a/core/java/android/view/SurfaceSession.java +++ b/core/java/android/view/SurfaceSession.java @@ -16,30 +16,32 @@ package android.view; - /** * An instance of this class represents a connection to the surface - * flinger, in which you can create one or more Surface instances that will + * flinger, from which you can create one or more Surface instances that will * be composited to the screen. * {@hide} */ -public class SurfaceSession { - private int mClient; +public final class SurfaceSession { + // Note: This field is accessed by native code. + private int mNativeClient; // SurfaceComposerClient* - private native void nativeInit(); - private native void nativeDestroy(); - private native void nativeKill(); + private static native int nativeCreate(); + private static native void nativeDestroy(int ptr); + private static native void nativeKill(int ptr); /** Create a new connection with the surface flinger. */ public SurfaceSession() { - nativeInit(); + mNativeClient = nativeCreate(); } /* no user serviceable parts here ... */ @Override protected void finalize() throws Throwable { try { - nativeDestroy(); + if (mNativeClient != 0) { + nativeDestroy(mNativeClient); + } } finally { super.finalize(); } @@ -48,10 +50,10 @@ public class SurfaceSession { /** * Forcibly detach native resources associated with this object. * Unlike destroy(), after this call any surfaces that were created - * from the session will no longer work. The session itself is destroyed. + * from the session will no longer work. */ public void kill() { - nativeKill(); + nativeKill(mNativeClient); } } |
