From 6018aeec27914f138f36b00d8f00136a87562fd3 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Tue, 23 Oct 2012 14:27:49 -0700 Subject: Add throwing InvalidDisplayException from addView. Throw an InvalidDisplayException to addView if the display being added to has been removed. Handle this exception in Dialog.show() by removing the view after it has been added and rethrow the exception from there. Add javadoc to ViewManager.addView and Presentation.show explaining the new exception and how best to handle it. Bug: 7368565 partially fixed. It remains for the Videos app to handle Presentation.show throwing the InvalidDisplayException. Change-Id: Ib4303c9b3f7bf7a0cfa95d19bd60a0c128658c48 --- core/java/android/view/WindowManager.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/java/android/view/WindowManager.java') diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 4c97414..01923e2 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -62,6 +62,19 @@ public interface WindowManager extends ViewManager { } /** + * Exception that is thrown when calling {@link #addView} to a secondary display that cannot + * be found. See {@link android.app.Presentation} for more information on secondary displays. + */ + public static class InvalidDisplayException extends RuntimeException { + public InvalidDisplayException() { + } + + public InvalidDisplayException(String name) { + super(name); + } + } + + /** * Returns the {@link Display} upon which this {@link WindowManager} instance * will create new windows. *

-- cgit v1.1