diff options
author | Makoto Onuki <omakoto@google.com> | 2013-09-12 17:59:24 -0700 |
---|---|---|
committer | Makoto Onuki <omakoto@google.com> | 2013-09-16 10:15:21 -0700 |
commit | 91eb44029658695e655a20b06441628e6f151c11 (patch) | |
tree | 6d92e453bf020df1c304fa6d8d259dc38fa3382d /InCallUI | |
parent | b1a2b9be59a1a3a2f283380d67ce3b945ae74e8e (diff) |
b/10699042 show dialpad when connects to voice mail.
Also now "Use touch tone keypad" in the dialer works, and
it automatically un-holds if there's only once call and it's
on hold. (which was a regression too.)
Change-Id: Id8eeb2737ffa2223acfbf9a8a30d957599c9db36
Diffstat (limited to 'InCallUI')
5 files changed, 60 insertions, 30 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 3171816ff..d1625ecf2 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -23,6 +23,8 @@ import com.android.services.telephony.common.AudioMode; import com.android.services.telephony.common.Call; import com.android.services.telephony.common.Call.Capabilities; +import android.telephony.PhoneNumberUtils; + /** * Logic for call buttons. */ @@ -34,6 +36,8 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto private boolean mAutomaticallyMuted = false; private boolean mPreviousMuteState = false; + private InCallState mPreviousState = null; + public CallButtonPresenter() { } @@ -64,11 +68,22 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto mCall = callList.getOutgoingCall(); } else if (state == InCallState.INCALL) { mCall = callList.getActiveOrBackgroundCall(); + + // When connected to voice mail, automatically shows the dialpad. + // (On previous releases we showed it when in-call shows up, before waiting for + // OUTGOING. We may want to do that once we start showing "Voice mail" label on + // the dialpad too.) + if (mPreviousState == InCallState.OUTGOING + && PhoneNumberUtils.isVoiceMailNumber(mCall.getNumber())) { + getUi().displayDialpad(true); + } } else { mCall = null; } updateUi(state, mCall); + + mPreviousState = state; } @Override diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java index d50635d99..06b10ab23 100644 --- a/InCallUI/src/com/android/incallui/CallHandlerService.java +++ b/InCallUI/src/com/android/incallui/CallHandlerService.java @@ -174,8 +174,9 @@ public class CallHandlerService extends Service { } @Override - public void bringToForeground() { - mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_BRING_TO_FOREGROUND)); + public void bringToForeground(boolean showDialpad) { + mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_BRING_TO_FOREGROUND, + showDialpad ? 1 : 0, 0)); } @Override @@ -290,9 +291,9 @@ public class CallHandlerService extends Service { mAudioModeProvider.onSupportedAudioModeChange(msg.arg1); break; case ON_BRING_TO_FOREGROUND: - Log.i(TAG, "ON_BRING_TO_FOREGROUND"); + Log.i(TAG, "ON_BRING_TO_FOREGROUND" + msg.arg1); if (mInCallPresenter != null) { - mInCallPresenter.bringToForeground(); + mInCallPresenter.bringToForeground(msg.arg1 != 0); } break; case ON_START: diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 7d7ca4bad..feb3ec137 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -16,6 +16,9 @@ package com.android.incallui; +import com.android.services.telephony.common.Call; +import com.android.services.telephony.common.Call.State; + import android.app.Activity; import android.content.Intent; import android.content.res.Configuration; @@ -30,6 +33,9 @@ import android.widget.Toast; * Phone app "in call" screen. */ public class InCallActivity extends Activity { + + public static final String SHOW_DIALPAD_EXTRA = "InCallActivity.show_dialpad"; + private CallButtonFragment mCallButtonFragment; private CallCardFragment mCallCardFragment; private AnswerFragment mAnswerFragment; @@ -37,6 +43,9 @@ public class InCallActivity extends Activity { private ConferenceManagerFragment mConferenceManagerFragment; private boolean mIsForegroundActivity; + /** Use to pass 'showDialpad' from {@link #onNewIntent} to {@link #onResume} */ + private boolean mShowDialpadRequested; + @Override protected void onCreate(Bundle icicle) { Log.d(this, "onCreate()... this = " + this); @@ -78,6 +87,11 @@ public class InCallActivity extends Activity { mIsForegroundActivity = true; InCallPresenter.getInstance().onUiShowing(true); + + if (mShowDialpadRequested) { + mCallButtonFragment.displayDialpad(true); + mShowDialpadRequested = false; + } } // onPause is guaranteed to be called when the InCallActivity goes @@ -236,37 +250,34 @@ public class InCallActivity extends Activity { // But we do check here for one extra that can come along with the // ACTION_MAIN intent: - // TODO(klp): Enable this for klp - /* if (intent.hasExtra(SHOW_DIALPAD_EXTRA)) { // SHOW_DIALPAD_EXTRA can be used here to specify whether the DTMF // dialpad should be initially visible. If the extra isn't // present at all, we just leave the dialpad in its previous state. - boolean showDialpad = intent.getBooleanExtra(SHOW_DIALPAD_EXTRA, false); - if (VDBG) log("- internalResolveIntent: SHOW_DIALPAD_EXTRA: " + showDialpad); - - // If SHOW_DIALPAD_EXTRA is specified, that overrides whatever - // the previous state of inCallUiState.showDialpad was. - mApp.inCallUiState.showDialpad = showDialpad; + final boolean showDialpad = intent.getBooleanExtra(SHOW_DIALPAD_EXTRA, false); + Log.d(this, "- internalResolveIntent: SHOW_DIALPAD_EXTRA: " + showDialpad); - final boolean hasActiveCall = mCM.hasActiveFgCall(); - final boolean hasHoldingCall = mCM.hasActiveBgCall(); - - // There's only one line in use, AND it's on hold, at which we're sure the user - // wants to use the dialpad toward the exact line, so un-hold the holding line. - if (showDialpad && !hasActiveCall && hasHoldingCall) { - PhoneUtils.switchHoldingAndActive(mCM.getFirstActiveBgCall()); - } + relaunchedFromDialer(showDialpad); } - */ - // ...and in onResume() we'll update the onscreen dialpad state to - // match the InCallUiState. return; } } + private void relaunchedFromDialer(boolean showDialpad) { + mShowDialpadRequested = showDialpad; + + if (mShowDialpadRequested) { + // If there's only one line in use, AND it's on hold, then we're sure the user + // wants to use the dialpad toward the exact line, so un-hold the holding line. + final Call call = CallList.getInstance().getActiveOrBackgroundCall(); + if (call != null && call.getState() == State.ONHOLD) { + CallCommandClient.getInstance().hold(call.getCallId(), false); + } + } + } + private void initializeInCall() { // TODO(klp): Make sure that this doesn't need to move back to onResume() since they are // statically added fragments. diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index d49859a36..bfff83fe5 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -320,7 +320,7 @@ public class InCallPresenter implements CallList.Listener { /** * Brings the app into the foreground if possible. */ - public void bringToForeground() { + public void bringToForeground(boolean showDialpad) { // Before we bring the incall UI to the foreground, we check to see if: // 1. there is an activity // 2. the activity is not already in the foreground @@ -328,7 +328,7 @@ public class InCallPresenter implements CallList.Listener { if (isActivityStarted() && !isShowingInCallUi() && mInCallState != InCallState.NO_CALLS) { - showInCall(); + showInCall(showDialpad); } } @@ -400,7 +400,7 @@ public class InCallPresenter implements CallList.Listener { if (showCallUi) { Log.i(this, "Start in call UI"); - showInCall(); + showInCall(false); } else if (startStartupSequence) { Log.i(this, "Start Full Screen in call UI"); mStatusBarNotifier.updateNotificationAndLaunchIncomingCallUi(newState, mCallList); @@ -460,16 +460,19 @@ public class InCallPresenter implements CallList.Listener { } } - private void showInCall() { - mContext.startActivity(getInCallIntent()); + private void showInCall(boolean showDialpad) { + mContext.startActivity(getInCallIntent(showDialpad)); } - public Intent getInCallIntent() { + public Intent getInCallIntent(boolean showDialpad) { final Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_USER_ACTION); intent.setClass(mContext, InCallActivity.class); + if (showDialpad) { + intent.putExtra(InCallActivity.SHOW_DIALPAD_EXTRA, true); + } return intent; } diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 2692ab813..b2593f989 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -506,7 +506,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { private PendingIntent createLaunchPendingIntent() { - final Intent intent = InCallPresenter.getInstance().getInCallIntent(); + final Intent intent = InCallPresenter.getInstance().getInCallIntent(/*showdialpad=*/false); // PendingIntent that can be used to launch the InCallActivity. The // system fires off this intent if the user pulls down the windowshade |