From ffddc9b8045235a493ec506965ae4892601eb23d Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 25 Feb 2013 15:56:31 -0800 Subject: Fix SurfaceControl.setDisplaySurface() such that it accepts a null Surface also fix a typo that made us call the wrong Surface ctor Bug: 8225509 Change-Id: I23f92179b6003d4c3e0febb35166c1caeafa27f5 --- core/java/android/view/SurfaceControl.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'core/java/android/view/SurfaceControl.java') diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 7ef7e2bf6f11..ded2f470ac7b 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -509,13 +509,8 @@ public class SurfaceControl { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } - if (surface == null) { - throw new IllegalArgumentException("surface must not be null"); - } - if (surface.mNativeObject == 0) - throw new NullPointerException("Surface native object is null. Are you using a released surface?"); - - nativeSetDisplaySurface(displayToken, surface.mNativeObject); + int nativeSurface = surface != null ? surface.mNativeObject : 0; + nativeSetDisplaySurface(displayToken, nativeSurface); } public static IBinder createDisplay(String name, boolean secure) { -- cgit v1.2.3