From 78866b1e07b1006f6ebf4adbc8e64b558c6040eb Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Fri, 17 Jul 2009 13:09:27 -0400 Subject: [PATCH] Close the global actions menu when the screen goes off. Previously, the global actions menu was closed when the keyguard was shown, but when the menu was shown from within the keyguard, it wasn't closed ever again when the screen goes off. That had the result that if your pocket managed to bring up the dialog, the menu would likely never go away on its own, and eventually do something awful like go into airplane mode. --- policy/com/android/internal/policy/impl/GlobalActions.java | 6 ++++-- .../android/internal/policy/impl/KeyguardViewMediator.java | 1 - .../android/internal/policy/impl/PhoneWindowManager.java | 7 ------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/policy/com/android/internal/policy/impl/GlobalActions.java b/policy/com/android/internal/policy/impl/GlobalActions.java index 10ac01c03b135..377ff7828e75b 100644 --- a/policy/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/com/android/internal/policy/impl/GlobalActions.java @@ -80,6 +80,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac // receive broadcasts IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); + filter.addAction(Intent.ACTION_SCREEN_OFF); context.registerReceiver(mBroadcastReceiver, filter); // get notified of phone state changes @@ -483,9 +484,10 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) { + if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action) + || Intent.ACTION_SCREEN_OFF.equals(action)) { String reason = intent.getStringExtra(PhoneWindowManager.SYSTEM_DIALOG_REASON_KEY); - if (! PhoneWindowManager.SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS.equals(reason)) { + if (!PhoneWindowManager.SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS.equals(reason)) { mHandler.sendEmptyMessage(MESSAGE_DISMISS); } } diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java index 112d7b2149e8a..043f727126900 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -857,7 +857,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback, // manager not to honor request for userActivity. mRealPowerManager.enableUserActivity(false); - mCallback.onKeyguardShow(); mKeyguardViewManager.show(); mShowing = true; } diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index e921a80e854b7..0392c7e4a8be7 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1690,13 +1690,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { return mKeyguardMediator.isInputRestricted(); } - /** - * Callback from {@link KeyguardViewMediator} - */ - public void onKeyguardShow() { - sendCloseSystemWindows(); - } - void sendCloseSystemWindows() { sendCloseSystemWindows(mContext, null); }