SurfaceFlinger: add support for secure displays
This change adds support for displays that are not allowed to display surfaces
with the eSecure flag set. All non-virtual displays are considered secure,
while virtual displays have their secure-ness specified at creation time.
Bug: 7368436
Change-Id: I81ad535d2d1e5a7ff78269017e85b111f0098500
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index aff1b45..85a9488 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -179,11 +179,12 @@
return result;
}
- virtual sp<IBinder> createDisplay(const String8& displayName)
+ virtual sp<IBinder> createDisplay(const String8& displayName, bool secure)
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
data.writeString8(displayName);
+ data.writeInt32(secure ? 1 : 0);
remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply);
return reply.readStrongBinder();
}
@@ -222,14 +223,6 @@
memcpy(info, reply.readInplace(sizeof(DisplayInfo)), sizeof(DisplayInfo));
return reply.readInt32();
}
-
-
- virtual void connectDisplay(const sp<ISurfaceTexture>& display) {
- Parcel data, reply;
- data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- data.writeStrongBinder(display->asBinder());
- remote()->transact(BnSurfaceComposer::CONNECT_DISPLAY, data, &reply);
- }
};
IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer");
@@ -309,7 +302,8 @@
case CREATE_DISPLAY: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
String8 displayName = data.readString8();
- sp<IBinder> display(createDisplay(displayName));
+ bool secure = bool(data.readInt32());
+ sp<IBinder> display(createDisplay(displayName, secure));
reply->writeStrongBinder(display);
return NO_ERROR;
} break;
@@ -338,12 +332,6 @@
memcpy(reply->writeInplace(sizeof(DisplayInfo)), &info, sizeof(DisplayInfo));
reply->writeInt32(result);
} break;
- case CONNECT_DISPLAY: {
- CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<ISurfaceTexture> surfaceTexture =
- interface_cast<ISurfaceTexture>(data.readStrongBinder());
- connectDisplay(surfaceTexture);
- } break;
default:
return BBinder::onTransact(code, data, reply, flags);
}