Merge "Switch to using AudioAttributes with sessions" into lmp-dev
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index e41f331..dd126df 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -311,20 +311,30 @@
call.addListener(this);
addCall(call);
- if (TelephonyUtil.shouldProcessAsEmergency(TelecommApp.getInstance(), call.getHandle())) {
+ // This block of code will attempt to pre-determine a phone account
+ final boolean emergencyCall = TelephonyUtil.shouldProcessAsEmergency(
+ TelecommApp.getInstance(), call.getHandle());
+ if (emergencyCall) {
// Emergency -- CreateConnectionProcessor will choose accounts automatically
call.setPhoneAccount(null);
- call.startCreateConnection();
- } else if (accountHandle == null) {
+ } else if (accountHandle != null) {
+ call.setPhoneAccount(accountHandle);
+ } else {
+ // No preset account, check if default exists
PhoneAccountHandle defaultAccountHandle = TelecommApp.getInstance()
.getPhoneAccountRegistrar().getDefaultOutgoingPhoneAccount();
if (defaultAccountHandle != null) {
call.setPhoneAccount(defaultAccountHandle);
- call.startCreateConnection();
- } else {
- call.setState(CallState.PRE_DIAL_WAIT);
}
}
+
+ if (call.getPhoneAccount() != null || emergencyCall) {
+ // If the account is selected, proceed to place the outgoing call
+ call.startCreateConnection();
+ } else {
+ // This is the state where the user is expected to select an account
+ call.setState(CallState.PRE_DIAL_WAIT);
+ }
}
/**
diff --git a/src/com/android/telecomm/ConnectionServiceWrapper.java b/src/com/android/telecomm/ConnectionServiceWrapper.java
index eca7e09..946ecb0 100644
--- a/src/com/android/telecomm/ConnectionServiceWrapper.java
+++ b/src/com/android/telecomm/ConnectionServiceWrapper.java
@@ -311,6 +311,7 @@
if (call != null) {
call.setVideoState(msg.arg1);
}
+ break;
}
case MSG_START_ACTIVITY_FROM_IN_CALL: {
SomeArgs args = (SomeArgs) msg.obj;
diff --git a/src/com/android/telecomm/PhoneAccountPreferencesActivity.java b/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
index ae01497..e4c62e7 100644
--- a/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
+++ b/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
@@ -61,10 +61,10 @@
int selectedIndex = accountHandles.size(); // Points to "ask every time" by default
int i = 0;
for ( ; i < accountHandles.size(); i++) {
- entryValues[i] = Integer.toString(i);
- entries[i] = mRegistrar
- .getPhoneAccount(accountHandles.get(i))
+ CharSequence label = mRegistrar.getPhoneAccount(accountHandles.get(i))
.getLabel();
+ entries[i] = label == null ? null : label.toString();
+ entryValues[i] = Integer.toString(i);
if (Objects.equals(currentDefault, accountHandles.get(i))) {
selectedIndex = i;
}
diff --git a/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java b/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java
index ccceedf..195bf6d 100644
--- a/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java
+++ b/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java
@@ -18,7 +18,6 @@
import android.content.Context;
import android.media.MediaPlayer;
-import android.os.RemoteException;
import android.telecomm.CallCameraCapabilities;
import android.telecomm.CallVideoClient;
import android.telecomm.CallVideoProvider;
@@ -123,10 +122,7 @@
mCapabilities = new CallCameraCapabilities(true /* zoomSupported */, value);
}
- try {
- mCallVideoClient.handleCameraCapabilitiesChange(mCapabilities);
- } catch (RemoteException ignored) {
- }
+ mCallVideoClient.handleCameraCapabilitiesChange(mCapabilities);
}
/**
@@ -139,13 +135,10 @@
VideoCallProfile responseProfile = new VideoCallProfile(
requestProfile.getVideoState(), requestProfile.getQuality());
- try {
- mCallVideoClient.receiveSessionModifyResponse(
- CallVideoClient.SESSION_MODIFY_REQUEST_SUCCESS,
- requestProfile,
- responseProfile);
- } catch (RemoteException ignored) {
- }
+ mCallVideoClient.receiveSessionModifyResponse(
+ CallVideoClient.SESSION_MODIFY_REQUEST_SUCCESS,
+ requestProfile,
+ responseProfile);
}
@Override
@@ -159,10 +152,7 @@
@Override
public void onRequestCameraCapabilities() {
log("Requested camera capabilities");
- try {
- mCallVideoClient.handleCameraCapabilitiesChange(mCapabilities);
- } catch (RemoteException ignored) {
- }
+ mCallVideoClient.handleCameraCapabilitiesChange(mCapabilities);
}
/**
@@ -172,10 +162,7 @@
public void onRequestCallDataUsage() {
log("Requested call data usage");
int dataUsageKb = (10 *1024) + random.nextInt(50 * 1024);
- try {
- mCallVideoClient.updateCallDataUsage(dataUsageKb);
- } catch (RemoteException ignored) {
- }
+ mCallVideoClient.updateCallDataUsage(dataUsageKb);
}
/**