diff options
author | Santos Cordon <santoscordon@google.com> | 2013-10-08 17:44:44 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-08 17:44:44 -0700 |
commit | 32834ff30e8045f4343e918644e5cc968d4ac0f1 (patch) | |
tree | a87d64d29f0cc39ed486648153175b364c85060d | |
parent | b2c0205d1dfb49bb8d827714bddbe0a39ca595fc (diff) | |
parent | f68d441c663a249eefa3cb1db51befe0f5a709cb (diff) |
am e9eb31a8: am 0b9ca916: am aa48f9e0: Merge "Turn screen on for call-waiting calls" into klp-dev
* commit 'e9eb31a85dc13b69512d60077d54911478c02132':
Turn screen on for call-waiting calls
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 23 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/ProximitySensor.java | 9 |
2 files changed, 31 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 4b3893994..1b9f60cc2 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -568,7 +568,7 @@ public class InCallPresenter implements CallList.Listener { if (isActivityStarted()) { mInCallActivity.dismissPendingDialogs(); } - mStatusBarNotifier.updateNotificationAndLaunchIncomingCallUi(newState, mCallList); + startUi(newState); } else if (newState == InCallState.NO_CALLS) { // The new state is the no calls state. Tear everything down. attemptFinishActivity(); @@ -577,6 +577,27 @@ public class InCallPresenter implements CallList.Listener { return newState; } + private void startUi(InCallState inCallState) { + final Call incomingCall = mCallList.getIncomingCall(); + final boolean isCallWaiting = (incomingCall != null && + incomingCall.getState() == Call.State.CALL_WAITING); + + // If the screen is off, we need to make sure it gets turned on for incoming calls. + // This normally works just fine thanks to FLAG_TURN_SCREEN_ON but that only works + // when the activity is first created. Therefore, to ensure the screen is turned on + // for the call waiting case, we finish() the current activity and start a new one. + // There should be no jank from this since the screen is already off and will remain so + // until our new activity is up. + if (mProximitySensor.isScreenReallyOff() && isCallWaiting) { + if (isActivityStarted()) { + mInCallActivity.finish(); + } + mInCallActivity = null; + } + + mStatusBarNotifier.updateNotificationAndLaunchIncomingCallUi(inCallState, mCallList); + } + /** * Checks to see if both the UI is gone and the service is disconnected. If so, tear it all * down. diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java index 0da68efb2..5776b5630 100644 --- a/InCallUI/src/com/android/incallui/ProximitySensor.java +++ b/InCallUI/src/com/android/incallui/ProximitySensor.java @@ -154,6 +154,15 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene } /** + * TODO: There is no way to determine if a screen is off due to proximity or if it is + * legitimately off, but if ever we can do that in the future, it would be useful here. + * Until then, this function will simply return true of the screen is off. + */ + public boolean isScreenReallyOff() { + return !mPowerManager.isScreenOn(); + } + + /** * @return true if this device supports the "proximity sensor * auto-lock" feature while in-call (see updateProximitySensorMode()). */ |