diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-11-14 15:14:53 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-14 15:14:53 -0800 |
commit | 178ede8b23633d3144faa429dd098b755f6c7663 (patch) | |
tree | 85c2f1fdb4bedd94c10f11f3d05a258e98a75f34 /InCallUI | |
parent | d522c551102c251c9d6223efa1cff2b92b27c79d (diff) | |
parent | f59d1c53b67789bad0e8f3000e270d3c19406941 (diff) |
am 59517317: Merge "Add logic to dynamic dismiss keyguard." into klp-dev
* commit '59517317d64761707b4d6d437ef49025d478eb17':
Add logic to dynamic dismiss keyguard.
Diffstat (limited to 'InCallUI')
-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 64e856c93..08a8f12d0 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 80c47395f..8bec492d9 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); + } } /** |