summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJose Lima <joselima@google.com>2015-01-27 17:57:04 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-01-27 17:57:04 +0000
commitceba619e36e5770603a295e374ea01b9026c4c0f (patch)
treee79842108478f896ccc2794ac6b8396524a5a676 /policy
parent9933b3136e3fa2e04e5ddd363933e237643ea962 (diff)
parent69fbcf1f100905f5a28909d561db4753189bd717 (diff)
downloadframeworks_base-ceba619e36e5770603a295e374ea01b9026c4c0f.zip
frameworks_base-ceba619e36e5770603a295e374ea01b9026c4c0f.tar.gz
frameworks_base-ceba619e36e5770603a295e374ea01b9026c4c0f.tar.bz2
am 445768bd: am 3fd8a433: Merge "Allow disabling the Options Pannel feature for TVs" into lmp-mr1-dev
automerge: 69fbcf1 * commit '69fbcf1f100905f5a28909d561db4753189bd717': Allow disabling the Options Pannel feature for TVs
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java39
1 files changed, 24 insertions, 15 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index ed43d8e..153b67b 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -894,7 +894,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
void doInvalidatePanelMenu(int featureId) {
- PanelFeatureState st = getPanelState(featureId, true);
+ PanelFeatureState st = getPanelState(featureId, false);
+ if (st == null) {
+ return;
+ }
Bundle savedActionViewStates = null;
if (st.menu != null) {
savedActionViewStates = new Bundle();
@@ -933,8 +936,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// The panel key was pushed, so set the chording key
mPanelChordingKey = keyCode;
- PanelFeatureState st = getPanelState(featureId, true);
- if (!st.isOpen) {
+ PanelFeatureState st = getPanelState(featureId, false);
+ if (st != null && !st.isOpen) {
return preparePanel(st, event);
}
}
@@ -952,12 +955,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (mPanelChordingKey != 0) {
mPanelChordingKey = 0;
- if (event.isCanceled() || (mDecor != null && mDecor.mActionMode != null)) {
+ final PanelFeatureState st = getPanelState(featureId, false);
+
+ if (event.isCanceled() || (mDecor != null && mDecor.mActionMode != null) ||
+ (st == null)) {
return;
}
boolean playSoundEffect = false;
- final PanelFeatureState st = getPanelState(featureId, true);
if (featureId == FEATURE_OPTIONS_PANEL && mDecorContentParent != null &&
mDecorContentParent.canShowOverflowMenu() &&
!ViewConfiguration.get(getContext()).hasPermanentMenuKey()) {
@@ -1056,7 +1061,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
@Override
public boolean performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags) {
- return performPanelShortcut(getPanelState(featureId, true), keyCode, event, flags);
+ return performPanelShortcut(getPanelState(featureId, false), keyCode, event, flags);
}
private boolean performPanelShortcut(PanelFeatureState st, int keyCode, KeyEvent event,
@@ -1149,11 +1154,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
mInvalidatePanelMenuRunnable.run();
}
- final PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
+ final PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
// If we don't have a menu or we're waiting for a full content refresh,
// forget it. This is a lingering event that no longer matters.
- if (st.menu != null && !st.refreshMenuContent &&
+ if (st != null && st.menu != null && !st.refreshMenuContent &&
cb.onPreparePanel(FEATURE_OPTIONS_PANEL, st.createdPanelView, st.menu)) {
cb.onMenuOpened(FEATURE_ACTION_BAR, st.menu);
mDecorContentParent.showOverflowMenu();
@@ -1161,15 +1166,19 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
} else {
mDecorContentParent.hideOverflowMenu();
- if (cb != null && !isDestroyed()) {
- final PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
+ final PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
+ if (st != null && cb != null && !isDestroyed()) {
cb.onPanelClosed(FEATURE_ACTION_BAR, st.menu);
}
}
return;
}
- PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
+ PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
+
+ if (st == null) {
+ return;
+ }
// Save the future expanded mode state since closePanel will reset it
boolean newExpandedMode = toggleMenuMode ? !st.isInExpandedMode : st.isInExpandedMode;
@@ -2302,8 +2311,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// combination such as Control+C. Temporarily prepare the panel then mark it
// unprepared again when finished to ensure that the panel will again be prepared
// the next time it is shown for real.
- if (mPreparedPanel == null) {
- PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
+ PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
+ if (st != null && mPreparedPanel == null) {
preparePanel(st, ev);
handled = performPanelShortcut(st, ev.getKeyCode(), ev,
Menu.FLAG_PERFORM_NO_CLOSE);
@@ -3906,8 +3915,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
@Override
public boolean isShortcutKey(int keyCode, KeyEvent event) {
- PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
- return st.menu != null && st.menu.isShortcutKey(keyCode, event);
+ PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
+ return st != null && st.menu != null && st.menu.isShortcutKey(keyCode, event);
}
private void updateDrawable(int featureId, DrawableFeatureState st, boolean fromResume) {