diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-11-14 15:49:35 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-14 15:49:35 -0800 |
commit | b55b50d78fb272268e14d26b7e8f660e97c16adf (patch) | |
tree | f649c6b0be3de01760ca7fc84da7f3c78332fb72 | |
parent | 9d424fce7ef11fd6b5b390834b466db170df7fec (diff) | |
parent | 3ce49172bf45607990d1e791e99fcd5670c6b217 (diff) |
am cd29be4c: am fa7dd751: am 59517317: Merge "Add logic to dynamic dismiss keyguard." into klp-dev
* commit 'cd29be4cd60d6818b58a5927d452aaf52da43f6b':
Add logic to dynamic dismiss keyguard.
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 15 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 10 |
2 files changed, 22 insertions, 3 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 36fb3897a..9c408a6f8 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/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/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 86568c6b0..69eba98de 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/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); + } } /** |