From bd769a15abfcb23b16daaed10c09029bbb978eef Mon Sep 17 00:00:00 2001 From: Jose Lima Date: Wed, 28 Jan 2015 10:43:15 -0800 Subject: Fix crash caused by disabling the Options panel on TVs Address more cases where calls to getPanelState may cause a crash when the options panel is disabled on a platform. Bug: 19178531 Bug: 18780696 Change-Id: Ib72bb8483e636181788ed3919c4cb9e99a94b7b1 --- core/java/android/app/Activity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/java') diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index d33c82b..9568897 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -3230,7 +3230,9 @@ public class Activity extends ContextThemeWrapper * Programmatically closes the most recently opened context menu, if showing. */ public void closeContextMenu() { - mWindow.closePanel(Window.FEATURE_CONTEXT_MENU); + if (mWindow.hasFeature(Window.FEATURE_CONTEXT_MENU)) { + mWindow.closePanel(Window.FEATURE_CONTEXT_MENU); + } } /** -- cgit v1.1