Loading src/com/android/server/telecom/Call.java +16 −8 Original line number Diff line number Diff line Loading @@ -3205,9 +3205,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, * @param extras Associated extras. */ public void sendCallEvent(String event, int targetSdkVer, Bundle extras) { if (mTransactionalService != null) { Log.i(this, "sendCallEvent: called on TransactionalService. doing nothing"); } else if (mConnectionService != null) { if (mConnectionService != null || mTransactionalService != null) { if (android.telecom.Call.EVENT_REQUEST_HANDOVER.equals(event)) { if (targetSdkVer > Build.VERSION_CODES.P) { Log.e(this, new Exception(), "sendCallEvent failed. Use public api handoverTo" + Loading @@ -3230,8 +3228,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, if (extras == null) { Log.w(this, "sendCallEvent: %s event received with null extras.", android.telecom.Call.EVENT_REQUEST_HANDOVER); mConnectionService.sendCallEvent(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } Parcelable parcelable = extras.getParcelable( Loading @@ -3239,8 +3237,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, if (!(parcelable instanceof PhoneAccountHandle) || parcelable == null) { Log.w(this, "sendCallEvent: %s event received with invalid handover acct.", android.telecom.Call.EVENT_REQUEST_HANDOVER); mConnectionService.sendCallEvent(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } PhoneAccountHandle phoneAccountHandle = (PhoneAccountHandle) parcelable; Loading @@ -3263,7 +3260,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, )); } Log.addEvent(this, LogUtils.Events.CALL_EVENT, event); mConnectionService.sendCallEvent(this, event, extras); sendEventToService(this, event, extras); } } else { Log.e(this, new NullPointerException(), Loading @@ -3271,6 +3268,17 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } /** * This method should only be called from sendCallEvent(String, int, Bundle). */ private void sendEventToService(Call call, String event, Bundle extras) { if (mConnectionService != null) { mConnectionService.sendCallEvent(call, event, extras); } else if (mTransactionalService != null) { mTransactionalService.onEvent(call, event, extras); } } /** * Notifies listeners when a bluetooth quality report is received. * @param report The bluetooth quality report. Loading src/com/android/server/telecom/TransactionalServiceWrapper.java +31 −0 Original line number Diff line number Diff line Loading @@ -273,6 +273,28 @@ public class TransactionalServiceWrapper implements Log.endSession(); } } /** * Application would like to inform InCallServices of an event */ @Override public void sendEvent(String callId, String event, Bundle extras) { try { Log.startSession("TSW.sE"); Call call = mTrackedCalls.get(callId); if (call != null) { call.onConnectionEvent(event, extras); } else{ Log.i(TAG, "sendEvent: was called but there is no call with id=[%s] cannot be " + "found. Most likely the call has been disconnected"); } } finally { Log.endSession(); } } }; private void addTransactionsToManager(VoipCallTransaction transaction, Loading Loading @@ -508,6 +530,15 @@ public class TransactionalServiceWrapper implements } } public void onEvent(Call call, String event, Bundle extras){ if (call != null) { try { mICallEventCallback.onEvent(call.getId(), event, extras); } catch (RemoteException e) { } } } /*** ********************************************************************************************* ** Helpers ** Loading testapps/transactionalVoipApp/src/com/android/server/telecom/transactionalVoipApp/MyVoipCall.java +8 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,13 @@ package com.android.server.telecom.transactionalVoipApp; import android.os.Bundle; import android.telecom.CallControlCallback; import android.telecom.CallEndpoint; import android.telecom.CallControl; import android.telecom.CallEventCallback; import android.util.Log; import java.util.List; import androidx.annotation.NonNull; Loading Loading @@ -82,6 +84,12 @@ public class MyVoipCall implements CallControlCallback, CallEventCallback { Log.i(TAG, String.format("onCallStreamingFailed: id=[%s], reason=[%d]", mCallId, reason)); } @Override public void onEvent(String event, Bundle extras) { Log.i(TAG, String.format("onEvent: id=[%s], event=[%s], extras=[%s]", mCallId, event, extras)); } @Override public void onCallEndpointChanged(@NonNull CallEndpoint newCallEndpoint) { Log.i(TAG, String.format("onCallEndpointChanged: endpoint=[%s]", newCallEndpoint)); Loading Loading
src/com/android/server/telecom/Call.java +16 −8 Original line number Diff line number Diff line Loading @@ -3205,9 +3205,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, * @param extras Associated extras. */ public void sendCallEvent(String event, int targetSdkVer, Bundle extras) { if (mTransactionalService != null) { Log.i(this, "sendCallEvent: called on TransactionalService. doing nothing"); } else if (mConnectionService != null) { if (mConnectionService != null || mTransactionalService != null) { if (android.telecom.Call.EVENT_REQUEST_HANDOVER.equals(event)) { if (targetSdkVer > Build.VERSION_CODES.P) { Log.e(this, new Exception(), "sendCallEvent failed. Use public api handoverTo" + Loading @@ -3230,8 +3228,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, if (extras == null) { Log.w(this, "sendCallEvent: %s event received with null extras.", android.telecom.Call.EVENT_REQUEST_HANDOVER); mConnectionService.sendCallEvent(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } Parcelable parcelable = extras.getParcelable( Loading @@ -3239,8 +3237,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, if (!(parcelable instanceof PhoneAccountHandle) || parcelable == null) { Log.w(this, "sendCallEvent: %s event received with invalid handover acct.", android.telecom.Call.EVENT_REQUEST_HANDOVER); mConnectionService.sendCallEvent(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); sendEventToService(this, android.telecom.Call.EVENT_HANDOVER_FAILED, null); return; } PhoneAccountHandle phoneAccountHandle = (PhoneAccountHandle) parcelable; Loading @@ -3263,7 +3260,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, )); } Log.addEvent(this, LogUtils.Events.CALL_EVENT, event); mConnectionService.sendCallEvent(this, event, extras); sendEventToService(this, event, extras); } } else { Log.e(this, new NullPointerException(), Loading @@ -3271,6 +3268,17 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } /** * This method should only be called from sendCallEvent(String, int, Bundle). */ private void sendEventToService(Call call, String event, Bundle extras) { if (mConnectionService != null) { mConnectionService.sendCallEvent(call, event, extras); } else if (mTransactionalService != null) { mTransactionalService.onEvent(call, event, extras); } } /** * Notifies listeners when a bluetooth quality report is received. * @param report The bluetooth quality report. Loading
src/com/android/server/telecom/TransactionalServiceWrapper.java +31 −0 Original line number Diff line number Diff line Loading @@ -273,6 +273,28 @@ public class TransactionalServiceWrapper implements Log.endSession(); } } /** * Application would like to inform InCallServices of an event */ @Override public void sendEvent(String callId, String event, Bundle extras) { try { Log.startSession("TSW.sE"); Call call = mTrackedCalls.get(callId); if (call != null) { call.onConnectionEvent(event, extras); } else{ Log.i(TAG, "sendEvent: was called but there is no call with id=[%s] cannot be " + "found. Most likely the call has been disconnected"); } } finally { Log.endSession(); } } }; private void addTransactionsToManager(VoipCallTransaction transaction, Loading Loading @@ -508,6 +530,15 @@ public class TransactionalServiceWrapper implements } } public void onEvent(Call call, String event, Bundle extras){ if (call != null) { try { mICallEventCallback.onEvent(call.getId(), event, extras); } catch (RemoteException e) { } } } /*** ********************************************************************************************* ** Helpers ** Loading
testapps/transactionalVoipApp/src/com/android/server/telecom/transactionalVoipApp/MyVoipCall.java +8 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,13 @@ package com.android.server.telecom.transactionalVoipApp; import android.os.Bundle; import android.telecom.CallControlCallback; import android.telecom.CallEndpoint; import android.telecom.CallControl; import android.telecom.CallEventCallback; import android.util.Log; import java.util.List; import androidx.annotation.NonNull; Loading Loading @@ -82,6 +84,12 @@ public class MyVoipCall implements CallControlCallback, CallEventCallback { Log.i(TAG, String.format("onCallStreamingFailed: id=[%s], reason=[%d]", mCallId, reason)); } @Override public void onEvent(String event, Bundle extras) { Log.i(TAG, String.format("onEvent: id=[%s], event=[%s], extras=[%s]", mCallId, event, extras)); } @Override public void onCallEndpointChanged(@NonNull CallEndpoint newCallEndpoint) { Log.i(TAG, String.format("onCallEndpointChanged: endpoint=[%s]", newCallEndpoint)); Loading