Handle null Surface in createVirtualDisplay
One can pass a null Surface to createVirtualDisplay and then set the Surface after creation. Properly handle the isSingleBuffered check for this case. Bug 31219726 Change-Id: I14ebaca58912fdb4989e0ba0f4c251df31e24617
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user