summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-08-06 23:36:39 -0700
committerSantos Cordon <santoscordon@google.com>2013-08-07 18:33:28 -0700
commit950e3df8ac744daf2a890d279566bdba424710f9 (patch)
tree2594c86146cb05a8c196303f0eb25b9db8dbc93e
parentee4a3feabd047f27540c5967b88d407855f3de8a (diff)
Supports for outgoing calls starting up the UI.
- Added the OUTGOING InCallState - Added support for OUTGOING into InCallState, InCallPresenter, and StatusBarNotifier. Change-Id: I49d5a56a4394d05e948b16a82f23e3eb925fd0a0
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java9
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java6
-rw-r--r--InCallUI/src/com/android/incallui/CallHandlerService.java7
-rw-r--r--InCallUI/src/com/android/incallui/CallList.java36
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java13
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java13
6 files changed, 48 insertions, 36 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index d4b2cf2de..114685d33 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -56,9 +56,14 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
@Override
public void onStateChange(InCallState state, CallList callList) {
- getUi().setVisible(state == InCallState.INCALL);
+ final boolean isVisible = state.isConnectingOrConnected() &&
+ !state.isIncoming();
- if (state == InCallState.INCALL) {
+ getUi().setVisible(isVisible);
+
+ if (state == InCallState.OUTGOING) {
+ mCall = callList.getOutgoingCall();
+ } else if (state == InCallState.INCALL) {
mCall = callList.getActiveOrBackgroundCall();
} else {
mCall = null;
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 06b115763..5f67a51e2 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -72,6 +72,12 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> i
if (state == InCallState.INCOMING) {
primary = callList.getIncomingCall();
+ } else if (state == InCallState.OUTGOING) {
+ primary = callList.getOutgoingCall();
+
+ // Safe to assume that the primary call is valid since we would not be in the
+ // OUTGOING state without an outgoing call.
+ secondary = callList.getBackgroundCall();
} else if (state == InCallState.INCALL) {
primary = callList.getActiveCall();
if (primary != null) {
diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java
index 8431fc91e..f0d98b2ed 100644
--- a/InCallUI/src/com/android/incallui/CallHandlerService.java
+++ b/InCallUI/src/com/android/incallui/CallHandlerService.java
@@ -94,6 +94,13 @@ public class CallHandlerService extends Service {
@Override
public void onUpdate(List<Call> calls, boolean fullUpdate) {
Logger.d(CallHandlerService.this, "onUpdate ");
+
+ if (Logger.VERBOSE) {
+ for (Call c : calls) {
+ Logger.v(this, "Call: " + c);
+ }
+ }
+
// TODO(klp): Add use of fullUpdate to message
mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_UPDATE_MULTI_CALL, 0, 0, calls));
}
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java
index 3a90a7e52..5ea4fc559 100644
--- a/InCallUI/src/com/android/incallui/CallList.java
+++ b/InCallUI/src/com/android/incallui/CallList.java
@@ -38,15 +38,6 @@ import java.util.Set;
* Primary lister of changes to this class is InCallPresenter.
*/
public class CallList {
- private static final Map<Integer, String> STATE_MAP = ImmutableMap.<Integer, String>builder()
- .put(Call.State.ACTIVE, "ACTIVE")
- .put(Call.State.CALL_WAITING, "CALL_WAITING")
- .put(Call.State.DIALING, "DIALING")
- .put(Call.State.IDLE, "IDLE")
- .put(Call.State.INCOMING, "INCOMING")
- .put(Call.State.ONHOLD, "ONHOLD")
- .put(Call.State.INVALID, "INVALID")
- .build();
private static CallList sInstance;
@@ -75,7 +66,7 @@ public class CallList {
* Called when a single call has changed.
*/
public void onUpdate(Call call) {
- Logger.d(this, "onUpdate - " + safeCallString(call));
+ Logger.d(this, "onUpdate - " + call);
updateCallInMap(call);
@@ -86,7 +77,7 @@ public class CallList {
* Called when a single call has changed.
*/
public void onUpdate(AbstractMap.SimpleEntry<Call, List<String> > incomingCall) {
- Logger.d(this, "onUpdate - " + safeCallString(incomingCall.getKey()));
+ Logger.d(this, "onUpdate - " + incomingCall.getKey());
updateCallInMap(incomingCall.getKey());
updateCallTextMap(incomingCall.getKey(), incomingCall.getValue());
@@ -102,7 +93,7 @@ public class CallList {
Preconditions.checkNotNull(callsToUpdate);
for (Call call : callsToUpdate) {
- Logger.d(this, "\t" + safeCallString(call));
+ Logger.d(this, "\t" + call);
updateCallInMap(call);
updateCallTextMap(call, null);
@@ -126,7 +117,7 @@ public class CallList {
}
/**
- * TODO(klp): Change so that this function is not needed. Instead of assuming there is an active
+ * TODO: Change so that this function is not needed. Instead of assuming there is an active
* call, the code should rely on the status of a specific Call and allow the presenters to
* update the Call object when the active call changes.
*/
@@ -138,6 +129,10 @@ public class CallList {
return retval;
}
+ public Call getOutgoingCall() {
+ return getFirstCallWithState(Call.State.DIALING);
+ }
+
public Call getActiveCall() {
return getFirstCallWithState(Call.State.ACTIVE);
}
@@ -205,8 +200,7 @@ public class CallList {
}
}
- Logger.d(this, "Found " + (retval == null ? "no " : "") + "call with state: " +
- STATE_MAP.get(state));
+ Logger.d(this, "Found call: " + retval);
return retval;
}
@@ -252,18 +246,6 @@ public class CallList {
}
/**
- * Creates a log-safe string for call objects.
- */
- private String safeCallString(Call call) {
- final StringBuffer buffer = new StringBuffer();
- buffer.append("Call (")
- .append(call.getCallId())
- .append("), ")
- .append(STATE_MAP.get(call.getState()));
- return buffer.toString();
- }
-
- /**
* Listener interface for any class that wants to be notified of changes
* to the call list.
*/
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 47d2d69c8..72a880a70 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -102,6 +102,8 @@ public class InCallPresenter implements CallList.Listener {
if (callList.getIncomingCall() != null) {
newState = InCallState.INCOMING;
+ } else if (callList.getOutgoingCall() != null) {
+ newState = InCallState.OUTGOING;
} else if (callList.getActiveCall() != null ||
callList.getBackgroundCall() != null) {
newState = InCallState.INCALL;
@@ -182,7 +184,10 @@ public class InCallPresenter implements CallList.Listener {
INCOMING,
// In-call experience is showing
- INCALL;
+ INCALL,
+
+ // User is dialing out
+ OUTGOING;
public boolean isIncoming() {
return (this == INCOMING);
@@ -191,6 +196,12 @@ public class InCallPresenter implements CallList.Listener {
public boolean isHidden() {
return (this == HIDDEN);
}
+
+ public boolean isConnectingOrConnected() {
+ return (this == INCOMING ||
+ this == OUTGOING ||
+ this == INCALL);
+ }
}
/**
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 617be2fac..2324b57a2 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -141,7 +141,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
Logger.d(this, "updateInCallNotification(allowFullScreenIntent = "
+ allowFullScreenIntent + ")...");
- if (InCallState.INCALL != state && InCallState.INCOMING != state) {
+ if (!state.isConnectingOrConnected()) {
cancelInCall();
return;
}
@@ -153,11 +153,12 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
* Set up the Intents that will get fires when the user interacts with the notificaiton.
*/
builder.setContentIntent(inCallPendingIntent);
- if (InCallState.INCOMING == state) {
- if (allowFullScreenIntent) {
- configureFullScreenIntent(builder, inCallPendingIntent);
- }
- } else if (InCallState.INCALL == state) {
+ if (allowFullScreenIntent) {
+ configureFullScreenIntent(builder, inCallPendingIntent);
+ }
+
+ // TODO(klp): Does this need to include OUTGOING state as well?
+ if (InCallState.INCALL == state) {
addActiveCallIntents(builder);
}