Merge "Set the secureness when creating displays" into jb-mr1-dev

This commit is contained in:
Jamie Gennis
2012-10-22 13:49:34 -07:00
committed by Android (Google) Code Review
4 changed files with 10 additions and 8 deletions

View File

@@ -258,7 +258,7 @@ public class Surface implements Parcelable {
private native void nativeSetLayerStack(int layerStack);
private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId);
private static native IBinder nativeCreateDisplay(String name);
private static native IBinder nativeCreateDisplay(String name, boolean secure);
private static native void nativeSetDisplaySurface(
IBinder displayToken, Surface surface);
private static native void nativeSetDisplayLayerStack(
@@ -597,11 +597,11 @@ public class Surface implements Parcelable {
}
/** @hide */
public static IBinder createDisplay(String name) {
public static IBinder createDisplay(String name, boolean secure) {
if (name == null) {
throw new IllegalArgumentException("name must not be null");
}
return nativeCreateDisplay(name);
return nativeCreateDisplay(name, secure);
}
/** @hide */

View File

@@ -653,9 +653,11 @@ static jobject nativeGetBuiltInDisplay(JNIEnv* env, jclass clazz, jint id) {
return javaObjectForIBinder(env, token);
}
static jobject nativeCreateDisplay(JNIEnv* env, jclass clazz, jstring nameObj) {
static jobject nativeCreateDisplay(JNIEnv* env, jclass clazz, jstring nameObj,
jboolean secure) {
ScopedUtfChars name(env, nameObj);
sp<IBinder> token(SurfaceComposerClient::createDisplay(String8(name.c_str())));
sp<IBinder> token(SurfaceComposerClient::createDisplay(
String8(name.c_str()), bool(secure)));
return javaObjectForIBinder(env, token);
}
@@ -845,7 +847,7 @@ static JNINativeMethod gSurfaceMethods[] = {
(void*)nativeSetLayerStack },
{"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;",
(void*)nativeGetBuiltInDisplay },
{"nativeCreateDisplay", "(Ljava/lang/String;)Landroid/os/IBinder;",
{"nativeCreateDisplay", "(Ljava/lang/String;Z)Landroid/os/IBinder;",
(void*)nativeCreateDisplay },
{"nativeSetDisplaySurface", "(Landroid/os/IBinder;Landroid/view/Surface;)V",
(void*)nativeSetDisplaySurface },

View File

@@ -282,7 +282,7 @@ final class OverlayDisplayAdapter extends DisplayAdapter {
@Override
public void onWindowCreated(SurfaceTexture surfaceTexture, float refreshRate) {
synchronized (getSyncRoot()) {
IBinder displayToken = Surface.createDisplay(mName);
IBinder displayToken = Surface.createDisplay(mName, false);
mDevice = new OverlayDisplayDevice(displayToken, mName,
mWidth, mHeight, refreshRate, mDensityDpi, surfaceTexture);

View File

@@ -292,7 +292,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
float refreshRate = 60.0f; // TODO: get this for real
String name = display.getFriendlyDisplayName();
IBinder displayToken = Surface.createDisplay(name);
IBinder displayToken = Surface.createDisplay(name, false);
mDisplayDevice = new WifiDisplayDevice(displayToken, name, width, height,
refreshRate, deviceFlags, surface);
sendDisplayDeviceEventLocked(mDisplayDevice, DISPLAY_DEVICE_EVENT_ADDED);