Merge "Distinguish between createSurface error codes." into pi-dev
am: d0661a081d
Change-Id: I6681f7749a318ee3ac2f482ac7ff138a211652e9
This commit is contained in:
@@ -566,7 +566,7 @@ public class SurfaceControl implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
private SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags,
|
private SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags,
|
||||||
SurfaceControl parent, int windowType, int ownerUid)
|
SurfaceControl parent, int windowType, int ownerUid)
|
||||||
throws OutOfResourcesException {
|
throws OutOfResourcesException, IllegalArgumentException {
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
throw new IllegalArgumentException("session must not be null");
|
throw new IllegalArgumentException("session must not be null");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,9 +116,13 @@ static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
|
|||||||
ScopedUtfChars name(env, nameStr);
|
ScopedUtfChars name(env, nameStr);
|
||||||
sp<SurfaceComposerClient> client(android_view_SurfaceSession_getClient(env, sessionObj));
|
sp<SurfaceComposerClient> client(android_view_SurfaceSession_getClient(env, sessionObj));
|
||||||
SurfaceControl *parent = reinterpret_cast<SurfaceControl*>(parentObject);
|
SurfaceControl *parent = reinterpret_cast<SurfaceControl*>(parentObject);
|
||||||
sp<SurfaceControl> surface = client->createSurface(
|
sp<SurfaceControl> surface;
|
||||||
String8(name.c_str()), w, h, format, flags, parent, windowType, ownerUid);
|
status_t err = client->createSurfaceChecked(
|
||||||
if (surface == NULL) {
|
String8(name.c_str()), w, h, format, &surface, flags, parent, windowType, ownerUid);
|
||||||
|
if (err == NAME_NOT_FOUND) {
|
||||||
|
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
|
||||||
|
return 0;
|
||||||
|
} else if (err != NO_ERROR) {
|
||||||
jniThrowException(env, OutOfResourcesException, NULL);
|
jniThrowException(env, OutOfResourcesException, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ class WindowStateAnimator {
|
|||||||
mDrawState = NO_SURFACE;
|
mDrawState = NO_SURFACE;
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.e(TAG, "Exception creating surface", e);
|
Slog.e(TAG, "Exception creating surface (parent dead?)", e);
|
||||||
mDrawState = NO_SURFACE;
|
mDrawState = NO_SURFACE;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user