diff options
| author | Jeff Brown <jeffbrown@google.com> | 2013-08-08 23:30:27 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-08 23:30:31 +0000 |
| commit | 09335703572db7d6a9b43f3aba32074e473d6a0f (patch) | |
| tree | 58f1f83c9ba409dab215e82696646183c53f67d7 /core/java | |
| parent | 280f6218a578b07f0dc56e403e4b686b8cbfe950 (diff) | |
| parent | 6a6bc216d15293886ad088bb0ca99aadb7df85dc (diff) | |
| download | frameworks_base-09335703572db7d6a9b43f3aba32074e473d6a0f.zip frameworks_base-09335703572db7d6a9b43f3aba32074e473d6a0f.tar.gz frameworks_base-09335703572db7d6a9b43f3aba32074e473d6a0f.tar.bz2 | |
Merge "Use new ISurfaceComposer::destroyDisplay method" into klp-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 6b530ef..dc31e0b 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -59,13 +59,14 @@ public class SurfaceControl { private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId); private static native IBinder nativeCreateDisplay(String name, boolean secure); + private static native void nativeDestroyDisplay(IBinder displayToken); private static native void nativeSetDisplaySurface( IBinder displayToken, int nativeSurfaceObject); private static native void nativeSetDisplayLayerStack( IBinder displayToken, int layerStack); private static native void nativeSetDisplayProjection( IBinder displayToken, int orientation, - int l, int t, int r, int b, + int l, int t, int r, int b, int L, int T, int R, int B); private static native boolean nativeGetDisplayInfo( IBinder displayToken, SurfaceControl.PhysicalDisplayInfo outInfo); @@ -103,7 +104,7 @@ public class SurfaceControl { * measures will be taken to disallow the surface's content to be copied * from another process. In particular, screenshots and VNC servers will * be disabled, but other measures can take place, for instance the - * surface might not be hardware accelerated. + * surface might not be hardware accelerated. * */ public static final int SECURE = 0x00000080; @@ -247,10 +248,10 @@ public class SurfaceControl { throw new OutOfResourcesException( "Couldn't allocate SurfaceControl native object"); } - + mCloseGuard.open("release"); } - + @Override protected void finalize() throws Throwable { try { @@ -300,7 +301,7 @@ public class SurfaceControl { if (mNativeObject == 0) throw new NullPointerException( "mNativeObject is null. Have you called release() already?"); } - + /* * set surface parameters. * needs to be inside open/closeTransaction block @@ -369,7 +370,7 @@ public class SurfaceControl { public void setWindowCrop(Rect crop) { checkNotReleased(); if (crop != null) { - nativeSetWindowCrop(mNativeObject, + nativeSetWindowCrop(mNativeObject, crop.left, crop.top, crop.right, crop.bottom); } else { nativeSetWindowCrop(mNativeObject, 0, 0, 0, 0); @@ -397,19 +398,19 @@ public class SurfaceControl { public float xDpi; public float yDpi; public boolean secure; - + public PhysicalDisplayInfo() { } - + public PhysicalDisplayInfo(PhysicalDisplayInfo other) { copyFrom(other); } - + @Override public boolean equals(Object o) { return o instanceof PhysicalDisplayInfo && equals((PhysicalDisplayInfo)o); } - + public boolean equals(PhysicalDisplayInfo other) { return other != null && width == other.width @@ -420,12 +421,12 @@ public class SurfaceControl { && yDpi == other.yDpi && secure == other.secure; } - + @Override public int hashCode() { return 0; // don't care } - + public void copyFrom(PhysicalDisplayInfo other) { width = other.width; height = other.height; @@ -435,7 +436,7 @@ public class SurfaceControl { yDpi = other.yDpi; secure = other.secure; } - + // For debugging purposes @Override public String toString() { @@ -481,7 +482,7 @@ public class SurfaceControl { throw new IllegalArgumentException("displayRect must not be null"); } nativeSetDisplayProjection(displayToken, orientation, - layerStackRect.left, layerStackRect.top, layerStackRect.right, layerStackRect.bottom, + layerStackRect.left, layerStackRect.top, layerStackRect.right, layerStackRect.bottom, displayRect.left, displayRect.top, displayRect.right, displayRect.bottom); } @@ -513,6 +514,13 @@ public class SurfaceControl { return nativeCreateDisplay(name, secure); } + public static void destroyDisplay(IBinder displayToken) { + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); + } + nativeDestroyDisplay(displayToken); + } + public static IBinder getBuiltInDisplay(int builtInDisplayId) { return nativeGetBuiltInDisplay(builtInDisplayId); } @@ -608,7 +616,7 @@ public class SurfaceControl { SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); return nativeScreenshot(displayToken, width, height, 0, 0, true); } - + private static void screenshot(IBinder display, Surface consumer, int width, int height, int minLayer, int maxLayer, boolean allLayers) { if (display == null) { |
