summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorChavi Weingarten <chaviw@google.com>2019-10-03 16:45:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-10-03 16:45:06 +0000
commit6b44087b1a8387eddd53493573709d1d81ac32cb (patch)
tree3f015517c25d1f05a433854801fb6efea0415231 /core/java
parent7f898bedec3db894941fbac5eefc152e149e0c01 (diff)
parenta51724fc71bff2591a072ac19907018ae57e74cb (diff)
Merge "Added API to mirror display and added sample app."
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/IWindowManager.aidl12
-rw-r--r--core/java/android/view/SurfaceControl.java24
2 files changed, 35 insertions, 1 deletions
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 49e8800a36c6..35cfe9e591cf 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -644,4 +644,16 @@ interface IWindowManager
* Enables/disables SurfaceFlinger layer tracing.
*/
void setLayerTracing(boolean enabled);
+
+ /**
+ * Mirrors a specified display. The root of the mirrored hierarchy will be stored in
+ * outSurfaceControl.
+ * Requires the ACCESS_SURFACE_FLINGER permission.
+ *
+ * @param displayId The id of the display to mirror
+ * @param outSurfaceControl The SurfaceControl for the root of the mirrored hierarchy.
+ *
+ * @return true if the display was successfully mirrored.
+ */
+ boolean mirrorDisplay(int displayId, out SurfaceControl outSurfaceControl);
}
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 6639fbf9551e..b685cf098b33 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -91,7 +91,7 @@ public final class SurfaceControl implements Parcelable {
boolean captureSecureLayers);
private static native ScreenshotGraphicBuffer nativeCaptureLayers(IBinder displayToken,
long layerObject, Rect sourceCrop, float frameScale, long[] excludeLayerObjects);
-
+ private static native long nativeMirrorSurface(long mirrorOfObject);
private static native long nativeCreateTransaction();
private static native long nativeGetNativeTransactionFinalizer();
private static native void nativeApplyTransaction(long transactionObj, boolean sync);
@@ -2034,6 +2034,28 @@ public final class SurfaceControl implements Parcelable {
return nativeSetDisplayBrightness(displayToken, brightness);
}
+ /**
+ * Creates a mirrored hierarchy for the mirrorOf {@link SurfaceControl}
+ *
+ * Real Hierarchy Mirror
+ * SC (value that's returned)
+ * |
+ * A A'
+ * | |
+ * B B'
+ *
+ * @param mirrorOf The root of the hierarchy that should be mirrored.
+ * @return A SurfaceControl that's the parent of the root of the mirrored hierarchy.
+ *
+ * @hide
+ */
+ public static SurfaceControl mirrorSurface(SurfaceControl mirrorOf) {
+ long nativeObj = nativeMirrorSurface(mirrorOf.mNativeObject);
+ SurfaceControl sc = new SurfaceControl();
+ sc.assignNativeObject(nativeObj);
+ return sc;
+ }
+
/**
* An atomic set of changes to a set of SurfaceControl.
*/