diff options
author | Danesh Mondegarian <daneshm90@gmail.com> | 2013-04-12 23:50:27 -0400 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-04-13 06:20:09 -0700 |
commit | ff3f7678f59c93c3d48604697503ea9eef4b5286 (patch) | |
tree | 20ae73cd95ce64bba7735c26a37f778ada5de59a /policy | |
parent | 69f41906baad4e6d5aca996fbf6133a3135f1b1f (diff) | |
download | frameworks_base-ff3f7678f59c93c3d48604697503ea9eef4b5286.zip frameworks_base-ff3f7678f59c93c3d48604697503ea9eef4b5286.tar.gz frameworks_base-ff3f7678f59c93c3d48604697503ea9eef4b5286.tar.bz2 |
PowerMenu : Improve keyguard filtered actions
Replaces the check for visibility of lockscreen with the state
of the keyguard instead. This avoids the situation where actions
returning false from showDuringKeyguard, are still shown if user enters
emergency call screen.
Change-Id: Idb5df14813d9479bd4178dbb9eb3b91cbecda5de
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/GlobalActions.java | 16 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 16 |
2 files changed, 21 insertions, 11 deletions
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index f0af787..5d02220 100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java @@ -115,7 +115,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private MyAdapter mAdapter; - private boolean mKeyguardShowing = false; + private boolean mKeyguardLocked = false; private boolean mDeviceProvisioned = false; private ToggleAction.State mAirplaneState = ToggleAction.State.Off; private boolean mIsWaitingForEcmExit = false; @@ -158,10 +158,10 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac /** * Show the global actions dialog (creating if necessary) - * @param keyguardShowing True if keyguard is showing + * @param keyguardLocked True if keyguard is locked */ - public void showDialog(boolean keyguardShowing, boolean isDeviceProvisioned) { - mKeyguardShowing = keyguardShowing; + public void showDialog(boolean keyguardLocked, boolean isDeviceProvisioned) { + mKeyguardLocked = keyguardLocked; mDeviceProvisioned = isDeviceProvisioned; if (mDialog != null) { if (mUiContext != null) { @@ -678,7 +678,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac /** * The adapter used for the list within the global actions dialog, taking * into account whether the keyguard is showing via - * {@link GlobalActions#mKeyguardShowing} and whether the device is provisioned + * {@link GlobalActions#mKeyguardLocked} and whether the device is provisioned * via {@link GlobalActions#mDeviceProvisioned}. */ private class MyAdapter extends BaseAdapter { @@ -689,7 +689,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac for (int i = 0; i < mItems.size(); i++) { final Action action = mItems.get(i); - if (mKeyguardShowing && !action.showDuringKeyguard()) { + if (mKeyguardLocked && !action.showDuringKeyguard()) { continue; } if (!mDeviceProvisioned && !action.showBeforeProvisioning()) { @@ -715,7 +715,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac int filteredPos = 0; for (int i = 0; i < mItems.size(); i++) { final Action action = mItems.get(i); - if (mKeyguardShowing && !action.showDuringKeyguard()) { + if (mKeyguardLocked && !action.showDuringKeyguard()) { continue; } if (!mDeviceProvisioned && !action.showBeforeProvisioning()) { @@ -730,7 +730,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac throw new IllegalArgumentException("position " + position + " out of range of showable actions" + ", filtered count=" + getCount() - + ", keyguardshowing=" + mKeyguardShowing + + ", keyguardlocked=" + mKeyguardLocked + ", provisioned=" + mDeviceProvisioned); } diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index a40f61f..187c6df 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -22,6 +22,7 @@ import android.app.ActivityManager.RunningAppProcessInfo; import android.app.ActivityManagerNative; import android.app.IActivityManager; import android.app.IUiModeManager; +import android.app.KeyguardManager; import android.app.ProgressDialog; import android.app.SearchManager; import android.app.UiModeManager; @@ -557,6 +558,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mVolumeUpKeyTriggered; private boolean mPowerKeyTriggered; private long mPowerKeyTime; + private KeyguardManager mKeyguardManager; SettingsObserver mSettingsObserver; ShortcutManager mShortcutManager; @@ -921,13 +923,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { } }; + private KeyguardManager getKeyguardManager() { + if (mKeyguardManager == null) { + mKeyguardManager = (KeyguardManager) mContext.getSystemService( + Context.KEYGUARD_SERVICE); + } + return mKeyguardManager; + } + void showGlobalActionsDialog() { if (mGlobalActions == null) { mGlobalActions = new GlobalActions(mContext, mWindowManagerFuncs); } - final boolean keyguardShowing = keyguardIsShowingTq(); - mGlobalActions.showDialog(keyguardShowing, isDeviceProvisioned()); - if (keyguardShowing) { + final boolean keyguardLocked = getKeyguardManager().isKeyguardLocked(); + mGlobalActions.showDialog(keyguardLocked, isDeviceProvisioned()); + if (keyguardLocked) { // since it took two seconds of long press to bring this up, // poke the wake lock so they have some time to see the dialog. mKeyguardMediator.userActivity(); |