summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/incallui/CallButtonPresenter.java15
-rw-r--r--src/com/android/incallui/CallHandlerService.java9
-rw-r--r--src/com/android/incallui/InCallActivity.java49
-rw-r--r--src/com/android/incallui/InCallPresenter.java15
-rw-r--r--src/com/android/incallui/StatusBarNotifier.java2
5 files changed, 60 insertions, 30 deletions
diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java
index 3171816f..d1625ecf 100644
--- a/src/com/android/incallui/CallButtonPresenter.java
+++ b/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/src/com/android/incallui/CallHandlerService.java b/src/com/android/incallui/CallHandlerService.java
index d50635d9..06b10ab2 100644
--- a/src/com/android/incallui/CallHandlerService.java
+++ b/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/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java
index 7d7ca4ba..feb3ec13 100644
--- a/src/com/android/incallui/InCallActivity.java
+++ b/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/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java
index d49859a3..bfff83fe 100644
--- a/src/com/android/incallui/InCallPresenter.java
+++ b/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/src/com/android/incallui/StatusBarNotifier.java b/src/com/android/incallui/StatusBarNotifier.java
index 2692ab81..b2593f98 100644
--- a/src/com/android/incallui/StatusBarNotifier.java
+++ b/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