Merge changes from topic 'mwd-merge-050415' into mnc-dev
* changes:
Merge commit '336b6a1' into merge_try2
Merge commit '51d0dfa' into merge_try2
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index baa80a8..34a6a3e 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -249,6 +249,9 @@
/**
* Tracks the video states which were applicable over the duration of a call.
* See {@link VideoProfile} for a list of valid video states.
+ * <p>
+ * Video state history is tracked when the call is active, and when a call is rejected or
+ * missed.
*/
private int mVideoStateHistory;
@@ -520,6 +523,12 @@
mConnectTimeMillis = System.currentTimeMillis();
}
+ // Video state changes are normally tracked against history when a call is active.
+ // When the call goes active we need to be sure we track the history in case the
+ // state never changes during the duration of the call -- we want to ensure we
+ // always know the state at the start of the call.
+ mVideoStateHistory = mVideoStateHistory | mVideoState;
+
// We're clearly not disconnected, so reset the disconnected time.
mDisconnectTimeMillis = 0;
} else if (mState == CallState.DISCONNECTED) {
@@ -527,39 +536,10 @@
setLocallyDisconnecting(false);
fixParentAfterDisconnect();
}
-
- // Log the state transition event
- String event = null;
- Object data = null;
- switch (newState) {
- case CallState.ACTIVE:
- event = Log.Events.SET_ACTIVE;
- break;
- case CallState.CONNECTING:
- event = Log.Events.SET_CONNECTING;
- break;
- case CallState.DIALING:
- event = Log.Events.SET_DIALING;
- break;
- case CallState.DISCONNECTED:
- event = Log.Events.SET_DISCONNECTED;
- data = getDisconnectCause();
- break;
- case CallState.DISCONNECTING:
- event = Log.Events.SET_DISCONNECTING;
- break;
- case CallState.ON_HOLD:
- event = Log.Events.SET_HOLD;
- break;
- case CallState.SELECT_PHONE_ACCOUNT:
- event = Log.Events.SET_SELECT_PHONE_ACCOUNT;
- break;
- case CallState.RINGING:
- event = Log.Events.SET_RINGING;
- break;
- }
- if (event != null) {
- Log.event(this, event, data);
+ if (mState == CallState.DISCONNECTED &&
+ mDisconnectCause.getCode() == DisconnectCause.MISSED) {
+ // Ensure when an incoming call is missed that the video state history is updated.
+ mVideoStateHistory |= mVideoState;
}
}
}
@@ -1053,6 +1033,9 @@
// Check to verify that the call is still in the ringing state. A call can change states
// between the time the user hits 'reject' and Telecomm receives the command.
if (isRinging("reject")) {
+ // Ensure video state history tracks video state at time of rejection.
+ mVideoStateHistory |= mVideoState;
+
mConnectionService.reject(this);
Log.event(this, Log.Events.REQUEST_REJECT);
}
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index a2295a7..854a645 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -295,6 +295,38 @@
}
@Override
+ public void setConferenceMergeFailed(String callId) {
+ long token = Binder.clearCallingIdentity();
+ try {
+ synchronized (mLock) {
+ logIncoming("setConferenceMergeFailed %s", callId);
+ if (mCallIdMapper.isValidCallId(callId)) {
+ // TODO: we should move the UI for indication a merge failure here
+ // from CallNotifier.onSuppServiceFailed(). This way the InCallUI can
+ // deliver the message anyway that they want. b/20530631.
+ Call call = mCallIdMapper.getCall(callId);
+ if (call != null) {
+ // Just refresh the connection capabilities so that the UI
+ // is forced to reenable the merge button as the capability
+ // is still on the connection. Note when b/20530631 is fixed, we need
+ // to revisit this fix to remove this hacky way of unhiding the merge
+ // button (side effect of reprocessing the capabilities) and plumb
+ // the failure event all the way to InCallUI instead of stopping
+ // it here. That way we can also handle the UI of notifying that
+ // the merged has failed.
+ call.setConnectionCapabilities(call.getConnectionCapabilities(), true);
+ } else {
+ Log.w(this, "setConferenceMergeFailed, unknown call id: %s", callId);
+ }
+ }
+
+ }
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public void addConferenceCall(String callId, ParcelableConference parcelableConference) {
long token = Binder.clearCallingIdentity();
try {
diff --git a/testapps/AndroidManifest.xml b/testapps/AndroidManifest.xml
index aafcecc..231bff6 100644
--- a/testapps/AndroidManifest.xml
+++ b/testapps/AndroidManifest.xml
@@ -55,10 +55,16 @@
</intent-filter>
</service>
+ <receiver android:name="com.android.server.telecom.testapps.TestInCallServiceBroadcastReceiver"
+ android:process="com.android.server.telecom.testapps.TestInCallService" >
+ <intent-filter>
+ <action android:name="android.server.telecom.testapps.ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE"/>
+ </intent-filter>
+ </receiver>
+
<activity android:name="com.android.server.telecom.testapps.TestCallActivity"
android:theme="@android:style/Theme.NoDisplay"
- android:label="@string/testCallActivityLabel"
- android:process="com.android.server.telecom.testapps.TestInCallService">
+ android:label="@string/testCallActivityLabel">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java b/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
index 8198cd8..4ac151f 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
@@ -51,12 +51,6 @@
public static final String ACTION_SEND_UPGRADE_REQUEST =
"android.telecom.testapps.ACTION_SEND_UPGRADE_REQUEST";
- /**
- * Sends an upgrade to video request for any live calls.
- */
- public static final String ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE =
- "android.server.telecom.testapps.ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE";
-
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -71,8 +65,6 @@
CallNotificationReceiver.hangupCalls(this);
} else if (ACTION_SEND_UPGRADE_REQUEST.equals(action)) {
CallNotificationReceiver.sendUpgradeRequest(this, data);
- } else if (ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE.equals(action)) {
- TestCallList.getInstance().sendUpgradeToVideoRequest();
} else {
CallServiceNotifier.getInstance().updateNotification(this);
}
diff --git a/testapps/src/com/android/server/telecom/testapps/TestInCallServiceBroadcastReceiver.java b/testapps/src/com/android/server/telecom/testapps/TestInCallServiceBroadcastReceiver.java
new file mode 100644
index 0000000..efef45c
--- /dev/null
+++ b/testapps/src/com/android/server/telecom/testapps/TestInCallServiceBroadcastReceiver.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.server.telecom.testapps;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+/**
+ * Test in call service broadcast receiver.
+ */
+public class TestInCallServiceBroadcastReceiver extends BroadcastReceiver {
+ private static final String TAG = "TestInCallServiceBR";
+
+ /**
+ * Sends an upgrade to video request for any live calls.
+ */
+ public static final String ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE =
+ "android.server.telecom.testapps.ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE";
+
+ /**
+ * Handles broadcasts directed at the {@link TestInCallServiceImpl}.
+ *
+ * @param context The Context in which the receiver is running.
+ * @param intent The Intent being received.
+ */
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ Log.v(TAG, "onReceive: " + action);
+
+ if (ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE.equals(action)) {
+ TestCallList.getInstance().sendUpgradeToVideoRequest();
+ }
+ }
+}