Handle null Surface in createVirtualDisplay

am: eb3370d490

Change-Id: I8af2a4356c2ea857affb047c946a5656f6c144f6
This commit is contained in:
Pablo Ceballos
2016-09-01 00:16:42 +00:00
committed by android-build-merger

View File

@@ -1402,7 +1402,7 @@ public final class DisplayManagerService extends SystemService {
throw new IllegalArgumentException("width, height, and densityDpi must be " throw new IllegalArgumentException("width, height, and densityDpi must be "
+ "greater than 0"); + "greater than 0");
} }
if (surface.isSingleBuffered()) { if (surface != null && surface.isSingleBuffered()) {
throw new IllegalArgumentException("Surface can't be single-buffered"); throw new IllegalArgumentException("Surface can't be single-buffered");
} }
@@ -1463,6 +1463,9 @@ public final class DisplayManagerService extends SystemService {
@Override // Binder call @Override // Binder call
public void setVirtualDisplaySurface(IVirtualDisplayCallback callback, Surface surface) { public void setVirtualDisplaySurface(IVirtualDisplayCallback callback, Surface surface) {
if (surface != null && surface.isSingleBuffered()) {
throw new IllegalArgumentException("Surface can't be single-buffered");
}
final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity();
try { try {
setVirtualDisplaySurfaceInternal(callback.asBinder(), surface); setVirtualDisplaySurfaceInternal(callback.asBinder(), surface);