diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-11-14 15:44:44 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-14 15:44:44 -0800 |
commit | cd29be4cd60d6818b58a5927d452aaf52da43f6b (patch) | |
tree | 39dfdf98d640a7674a562c023af847621e1810d8 | |
parent | 1d0e426ed2a22deffca8e24c463be7dc44bfe296 (diff) | |
parent | fa7dd7517d9330abb0750763b6466f2bfa536243 (diff) | |
download | InCallUI-idea133.tar.gz |
am fa7dd751: am 59517317: Merge "Add logic to dynamic dismiss keyguard." into klp-devidea133
* commit 'fa7dd7517d9330abb0750763b6466f2bfa536243':
Add logic to dynamic dismiss keyguard.
-rw-r--r-- | src/com/android/incallui/InCallActivity.java | 15 | ||||
-rw-r--r-- | src/com/android/incallui/InCallPresenter.java | 10 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java index 64e856c9..08a8f12d 100644 --- a/src/com/android/incallui/InCallActivity.java +++ b/src/com/android/incallui/InCallActivity.java @@ -62,10 +62,11 @@ public class InCallActivity extends Activity { // set this flag so this activity will stay in front of the keyguard // Have the WindowManager filter out touch events that are "too fat". - getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON - | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD - | WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES); + | WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES; + + getWindow().addFlags(flags); requestWindowFeature(Window.FEATURE_NO_TITLE); @@ -388,6 +389,14 @@ public class InCallActivity extends Activity { mCallButtonFragment.displayDialpad(false); } + public void dismissKeyguard(boolean dismiss) { + if (dismiss) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); + } else { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); + } + } + public void displayDialpad(boolean showDialpad) { if (showDialpad) { mDialpadFragment.setVisible(true); diff --git a/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java index 80c47395..8bec492d 100644 --- a/src/com/android/incallui/InCallPresenter.java +++ b/src/com/android/incallui/InCallPresenter.java @@ -241,6 +241,12 @@ public class InCallPresenter implements CallList.Listener { Log.d(this, "Notify " + listener + " of state " + mInCallState.toString()); listener.onStateChange(mInCallState, callList); } + + if (isActivityStarted()) { + final boolean hasCall = callList.getActiveOrBackgroundCall() != null || + callList.getOutgoingCall() != null; + mInCallActivity.dismissKeyguard(hasCall); + } } /** @@ -276,6 +282,10 @@ public class InCallPresenter implements CallList.Listener { // We need to do the run the same code as onCallListChange. onCallListChange(CallList.getInstance()); + + if (isActivityStarted()) { + mInCallActivity.dismissKeyguard(false); + } } /** |