Loading src/com/android/server/telecom/CallEndpointController.java +33 −7 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,9 @@ import android.telecom.CallAudioState; import android.telecom.CallEndpoint; import android.telecom.CallEndpoint; import android.telecom.CallEndpointException; import android.telecom.CallEndpointException; import android.telecom.Log; import android.telecom.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import java.util.HashMap; import java.util.HashMap; import java.util.Map; import java.util.Map; import java.util.HashSet; import java.util.HashSet; Loading Loading @@ -96,6 +98,12 @@ public class CallEndpointController extends CallsManagerListenerBase { return; return; } } if (isCurrentEndpointRequestedEndpoint(route, bluetoothAddress)) { Log.d(this, "requestCallEndpointChange: requested endpoint is already active"); callback.send(CallEndpoint.ENDPOINT_OPERATION_SUCCESS, new Bundle()); return; } if (mPendingChangeRequest != null && !mPendingChangeRequest.isDone()) { if (mPendingChangeRequest != null && !mPendingChangeRequest.isDone()) { mPendingChangeRequest.complete(RESULT_ANOTHER_REQUEST); mPendingChangeRequest.complete(RESULT_ANOTHER_REQUEST); mPendingChangeRequest = null; mPendingChangeRequest = null; Loading @@ -116,6 +124,27 @@ public class CallEndpointController extends CallsManagerListenerBase { mCallsManager.getCallAudioManager().setAudioRoute(route, bluetoothAddress); mCallsManager.getCallAudioManager().setAudioRoute(route, bluetoothAddress); } } public boolean isCurrentEndpointRequestedEndpoint(int requestedRoute, String requestedAddress) { if (mCallsManager.getCallAudioManager() == null || mCallsManager.getCallAudioManager().getCallAudioState() == null) { return false; } CallAudioState currentAudioState = mCallsManager.getCallAudioManager().getCallAudioState(); // requested non-bt endpoint is already active if (requestedRoute != CallAudioState.ROUTE_BLUETOOTH && requestedRoute == currentAudioState.getRoute()) { return true; } // requested bt endpoint is already active if (requestedRoute == CallAudioState.ROUTE_BLUETOOTH && currentAudioState.getActiveBluetoothDevice() != null && requestedAddress.equals( currentAudioState.getActiveBluetoothDevice().getAddress())) { return true; } return false; } private Bundle getErrorResult(int result) { private Bundle getErrorResult(int result) { String message; String message; int resultCode; int resultCode; Loading Loading @@ -165,8 +194,7 @@ public class CallEndpointController extends CallsManagerListenerBase { for (Call call : calls) { for (Call call : calls) { if (call != null && call.getConnectionService() != null) { if (call != null && call.getConnectionService() != null) { call.getConnectionService().onCallEndpointChanged(call, mActiveCallEndpoint); call.getConnectionService().onCallEndpointChanged(call, mActiveCallEndpoint); } } else if (call != null && call.getTransactionServiceWrapper() != null) { else if (call != null && call.getTransactionServiceWrapper() != null) { call.getTransactionServiceWrapper() call.getTransactionServiceWrapper() .onCallEndpointChanged(call, mActiveCallEndpoint); .onCallEndpointChanged(call, mActiveCallEndpoint); } } Loading @@ -181,8 +209,7 @@ public class CallEndpointController extends CallsManagerListenerBase { if (call != null && call.getConnectionService() != null) { if (call != null && call.getConnectionService() != null) { call.getConnectionService().onAvailableCallEndpointsChanged(call, call.getConnectionService().onAvailableCallEndpointsChanged(call, mAvailableCallEndpoints); mAvailableCallEndpoints); } } else if (call != null && call.getTransactionServiceWrapper() != null) { else if (call != null && call.getTransactionServiceWrapper() != null) { call.getTransactionServiceWrapper() call.getTransactionServiceWrapper() .onAvailableCallEndpointsChanged(call, mAvailableCallEndpoints); .onAvailableCallEndpointsChanged(call, mAvailableCallEndpoints); } } Loading @@ -196,8 +223,7 @@ public class CallEndpointController extends CallsManagerListenerBase { for (Call call : calls) { for (Call call : calls) { if (call != null && call.getConnectionService() != null) { if (call != null && call.getConnectionService() != null) { call.getConnectionService().onMuteStateChanged(call, isMuted); call.getConnectionService().onMuteStateChanged(call, isMuted); } } else if (call != null && call.getTransactionServiceWrapper() != null) { else if (call != null && call.getTransactionServiceWrapper() != null) { call.getTransactionServiceWrapper().onMuteStateChanged(call, isMuted); call.getTransactionServiceWrapper().onMuteStateChanged(call, isMuted); } } } } Loading testapps/transactionalVoipApp/src/com/android/server/telecom/transactionalVoipApp/InCallActivity.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -254,14 +254,14 @@ public class InCallActivity extends Activity { new OutcomeReceiver<Void, CallException>() { new OutcomeReceiver<Void, CallException>() { @Override @Override public void onResult(Void result) { public void onResult(Void result) { Log.i(TAG, String.format("success w/ %s", tag)); Log.i(TAG, String.format("requestEndpointChange: success w/ %s", tag)); updateCurrentEndpointWithOnResult(endpoint); updateCurrentEndpointWithOnResult(endpoint); } } @Override @Override public void onError(CallException e) { public void onError(CallException e) { Log.i(TAG, String.format("%s :failed to switch to endpoint=[%s]," Log.i(TAG, String.format("requestEndpointChange: %s failed to switch to " + " due to exception=[%s]", tag, endpoint, e.toString())); + "endpoint=[%s] due to exception=[%s]", tag, endpoint, e)); } } }); }); } } Loading Loading
src/com/android/server/telecom/CallEndpointController.java +33 −7 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,9 @@ import android.telecom.CallAudioState; import android.telecom.CallEndpoint; import android.telecom.CallEndpoint; import android.telecom.CallEndpointException; import android.telecom.CallEndpointException; import android.telecom.Log; import android.telecom.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import java.util.HashMap; import java.util.HashMap; import java.util.Map; import java.util.Map; import java.util.HashSet; import java.util.HashSet; Loading Loading @@ -96,6 +98,12 @@ public class CallEndpointController extends CallsManagerListenerBase { return; return; } } if (isCurrentEndpointRequestedEndpoint(route, bluetoothAddress)) { Log.d(this, "requestCallEndpointChange: requested endpoint is already active"); callback.send(CallEndpoint.ENDPOINT_OPERATION_SUCCESS, new Bundle()); return; } if (mPendingChangeRequest != null && !mPendingChangeRequest.isDone()) { if (mPendingChangeRequest != null && !mPendingChangeRequest.isDone()) { mPendingChangeRequest.complete(RESULT_ANOTHER_REQUEST); mPendingChangeRequest.complete(RESULT_ANOTHER_REQUEST); mPendingChangeRequest = null; mPendingChangeRequest = null; Loading @@ -116,6 +124,27 @@ public class CallEndpointController extends CallsManagerListenerBase { mCallsManager.getCallAudioManager().setAudioRoute(route, bluetoothAddress); mCallsManager.getCallAudioManager().setAudioRoute(route, bluetoothAddress); } } public boolean isCurrentEndpointRequestedEndpoint(int requestedRoute, String requestedAddress) { if (mCallsManager.getCallAudioManager() == null || mCallsManager.getCallAudioManager().getCallAudioState() == null) { return false; } CallAudioState currentAudioState = mCallsManager.getCallAudioManager().getCallAudioState(); // requested non-bt endpoint is already active if (requestedRoute != CallAudioState.ROUTE_BLUETOOTH && requestedRoute == currentAudioState.getRoute()) { return true; } // requested bt endpoint is already active if (requestedRoute == CallAudioState.ROUTE_BLUETOOTH && currentAudioState.getActiveBluetoothDevice() != null && requestedAddress.equals( currentAudioState.getActiveBluetoothDevice().getAddress())) { return true; } return false; } private Bundle getErrorResult(int result) { private Bundle getErrorResult(int result) { String message; String message; int resultCode; int resultCode; Loading Loading @@ -165,8 +194,7 @@ public class CallEndpointController extends CallsManagerListenerBase { for (Call call : calls) { for (Call call : calls) { if (call != null && call.getConnectionService() != null) { if (call != null && call.getConnectionService() != null) { call.getConnectionService().onCallEndpointChanged(call, mActiveCallEndpoint); call.getConnectionService().onCallEndpointChanged(call, mActiveCallEndpoint); } } else if (call != null && call.getTransactionServiceWrapper() != null) { else if (call != null && call.getTransactionServiceWrapper() != null) { call.getTransactionServiceWrapper() call.getTransactionServiceWrapper() .onCallEndpointChanged(call, mActiveCallEndpoint); .onCallEndpointChanged(call, mActiveCallEndpoint); } } Loading @@ -181,8 +209,7 @@ public class CallEndpointController extends CallsManagerListenerBase { if (call != null && call.getConnectionService() != null) { if (call != null && call.getConnectionService() != null) { call.getConnectionService().onAvailableCallEndpointsChanged(call, call.getConnectionService().onAvailableCallEndpointsChanged(call, mAvailableCallEndpoints); mAvailableCallEndpoints); } } else if (call != null && call.getTransactionServiceWrapper() != null) { else if (call != null && call.getTransactionServiceWrapper() != null) { call.getTransactionServiceWrapper() call.getTransactionServiceWrapper() .onAvailableCallEndpointsChanged(call, mAvailableCallEndpoints); .onAvailableCallEndpointsChanged(call, mAvailableCallEndpoints); } } Loading @@ -196,8 +223,7 @@ public class CallEndpointController extends CallsManagerListenerBase { for (Call call : calls) { for (Call call : calls) { if (call != null && call.getConnectionService() != null) { if (call != null && call.getConnectionService() != null) { call.getConnectionService().onMuteStateChanged(call, isMuted); call.getConnectionService().onMuteStateChanged(call, isMuted); } } else if (call != null && call.getTransactionServiceWrapper() != null) { else if (call != null && call.getTransactionServiceWrapper() != null) { call.getTransactionServiceWrapper().onMuteStateChanged(call, isMuted); call.getTransactionServiceWrapper().onMuteStateChanged(call, isMuted); } } } } Loading
testapps/transactionalVoipApp/src/com/android/server/telecom/transactionalVoipApp/InCallActivity.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -254,14 +254,14 @@ public class InCallActivity extends Activity { new OutcomeReceiver<Void, CallException>() { new OutcomeReceiver<Void, CallException>() { @Override @Override public void onResult(Void result) { public void onResult(Void result) { Log.i(TAG, String.format("success w/ %s", tag)); Log.i(TAG, String.format("requestEndpointChange: success w/ %s", tag)); updateCurrentEndpointWithOnResult(endpoint); updateCurrentEndpointWithOnResult(endpoint); } } @Override @Override public void onError(CallException e) { public void onError(CallException e) { Log.i(TAG, String.format("%s :failed to switch to endpoint=[%s]," Log.i(TAG, String.format("requestEndpointChange: %s failed to switch to " + " due to exception=[%s]", tag, endpoint, e.toString())); + "endpoint=[%s] due to exception=[%s]", tag, endpoint, e)); } } }); }); } } Loading