diff options
| author | Jose Lima <joselima@google.com> | 2015-01-23 17:24:22 -0800 |
|---|---|---|
| committer | Jose Lima <joselima@google.com> | 2015-01-26 17:39:49 -0800 |
| commit | 7a22fc62d364bba4c1604a7e88fbd321eb541f4e (patch) | |
| tree | 5db4b9f149d1ebe5eb24eed75d5d0af6b19c3660 /core/java/android | |
| parent | 09dff843b8ed402564c4c89d7e1cabceb715e458 (diff) | |
| download | frameworks_base-7a22fc62d364bba4c1604a7e88fbd321eb541f4e.zip frameworks_base-7a22fc62d364bba4c1604a7e88fbd321eb541f4e.tar.gz frameworks_base-7a22fc62d364bba4c1604a7e88fbd321eb541f4e.tar.bz2 | |
Allow disabling the Options Pannel feature for TVs
- Added a config entry in velues-television to disable the options panel
feature for TVs.
- Fixed parts of the code in PhoneWindow that assumed this feature is supposed
to always be available, which was causing exceptions when it was turned off.
Bug: 18780696
Change-Id: I923bd4b5019d634e5352a6e893005133edb475f6
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/Activity.java | 16 | ||||
| -rw-r--r-- | core/java/android/app/Dialog.java | 14 |
2 files changed, 21 insertions, 9 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 38cd126..d33c82b 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -2377,8 +2377,10 @@ public class Activity extends ContextThemeWrapper if (mDefaultKeyMode == DEFAULT_KEYS_DISABLE) { return false; } else if (mDefaultKeyMode == DEFAULT_KEYS_SHORTCUT) { - if (getWindow().performPanelShortcut(Window.FEATURE_OPTIONS_PANEL, - keyCode, event, Menu.FLAG_ALWAYS_PERFORM_CLOSE)) { + Window w = getWindow(); + if (w.hasFeature(Window.FEATURE_OPTIONS_PANEL) && + w.performPanelShortcut(Window.FEATURE_OPTIONS_PANEL, keyCode, event, + Menu.FLAG_ALWAYS_PERFORM_CLOSE)) { return true; } return false; @@ -2943,7 +2945,8 @@ public class Activity extends ContextThemeWrapper * time it needs to be displayed. */ public void invalidateOptionsMenu() { - if (mActionBar == null || !mActionBar.invalidateOptionsMenu()) { + if (mWindow.hasFeature(Window.FEATURE_OPTIONS_PANEL) && + (mActionBar == null || !mActionBar.invalidateOptionsMenu())) { mWindow.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL); } } @@ -3155,7 +3158,8 @@ public class Activity extends ContextThemeWrapper * open, this method does nothing. */ public void openOptionsMenu() { - if (mActionBar == null || !mActionBar.openOptionsMenu()) { + if (mWindow.hasFeature(Window.FEATURE_OPTIONS_PANEL) && + (mActionBar == null || !mActionBar.openOptionsMenu())) { mWindow.openPanel(Window.FEATURE_OPTIONS_PANEL, null); } } @@ -3165,7 +3169,9 @@ public class Activity extends ContextThemeWrapper * closed, this method does nothing. */ public void closeOptionsMenu() { - mWindow.closePanel(Window.FEATURE_OPTIONS_PANEL); + if (mWindow.hasFeature(Window.FEATURE_OPTIONS_PANEL)) { + mWindow.closePanel(Window.FEATURE_OPTIONS_PANEL); + } } /** diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index 12d4513..067073a 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -910,21 +910,27 @@ public class Dialog implements DialogInterface, Window.Callback, * @see Activity#openOptionsMenu() */ public void openOptionsMenu() { - mWindow.openPanel(Window.FEATURE_OPTIONS_PANEL, null); + if (mWindow.hasFeature(Window.FEATURE_OPTIONS_PANEL)) { + mWindow.openPanel(Window.FEATURE_OPTIONS_PANEL, null); + } } - + /** * @see Activity#closeOptionsMenu() */ public void closeOptionsMenu() { - mWindow.closePanel(Window.FEATURE_OPTIONS_PANEL); + if (mWindow.hasFeature(Window.FEATURE_OPTIONS_PANEL)) { + mWindow.closePanel(Window.FEATURE_OPTIONS_PANEL); + } } /** * @see Activity#invalidateOptionsMenu() */ public void invalidateOptionsMenu() { - mWindow.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL); + if (mWindow.hasFeature(Window.FEATURE_OPTIONS_PANEL)) { + mWindow.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL); + } } /** |
