Loading src/com/android/server/telecom/Call.java +58 −1 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public class Call implements CreateConnectionResponse { void onConferenceableCallsChanged(Call call); boolean onCanceledViaNewOutgoingCallBroadcast(Call call); void onHoldToneRequested(Call call); void onConnectionEvent(Call call, String event, Bundle extras); } public abstract static class ListenerBase implements Listener { Loading Loading @@ -165,6 +166,8 @@ public class Call implements CreateConnectionResponse { @Override public void onHoldToneRequested(Call call) {} @Override public void onConnectionEvent(Call call, String event, Bundle extras) {} } private final OnQueryCompleteListener mCallerInfoQueryListener = Loading Loading @@ -1424,6 +1427,55 @@ public class Call implements CreateConnectionResponse { } } /** * Initiates a request to the connection service to pull this call. * <p> * This method can only be used for calls that have the * {@link android.telecom.Connection#CAPABILITY_CAN_PULL_CALL} and * {@link android.telecom.Connection#CAPABILITY_IS_EXTERNAL_CALL} capabilities set. * <p> * An external call is a representation of a call which is taking place on another device * associated with a PhoneAccount on this device. Issuing a request to pull the external call * tells the {@link android.telecom.ConnectionService} that it should move the call from the * other device to this one. An example of this is the IMS multi-endpoint functionality. A * user may have two phones with the same phone number. If the user is engaged in an active * call on their first device, the network will inform the second device of that ongoing call in * the form of an external call. The user may wish to continue their conversation on the second * device, so will issue a request to pull the call to the second device. * <p> * Requests to pull a call which is not external, or a call which is not pullable are ignored. */ public void pullExternalCall() { if (mConnectionService == null) { Log.w(this, "pulling a call without a connection service."); } if (!can(Connection.CAPABILITY_IS_EXTERNAL_CALL)) { Log.w(this, "pullExternalCall - call %s is not an external call.", mId); return; } if (!can(Connection.CAPABILITY_CAN_PULL_CALL)) { Log.w(this, "pullExternalCall - call %s is external but cannot be pulled.", mId); return; } Log.event(this, Log.Events.PULL); mConnectionService.pullExternalCall(this); } /** * Sends a call event to the {@link ConnectionService} for this call. * * See {@link Call#sendCallEvent(String, Bundle)}. * * @param event The call event. * @param extras Associated extras. */ public void sendCallEvent(String event, Bundle extras) { mConnectionService.sendCallEvent(this, event, extras); } void setParentCall(Call parentCall) { if (parentCall == this) { Log.e(this, new Exception(), "setting the parent to self"); Loading Loading @@ -1948,8 +2000,9 @@ public class Call implements CreateConnectionResponse { * Handles Connection events received from a {@link ConnectionService}. * * @param event The event. * @param extras The extras. */ public void onConnectionEvent(String event) { public void onConnectionEvent(String event, Bundle extras) { if (Connection.EVENT_ON_HOLD_TONE_START.equals(event)) { mIsRemotelyHeld = true; Log.event(this, Log.Events.REMOTELY_HELD); Loading @@ -1964,6 +2017,10 @@ public class Call implements CreateConnectionResponse { for (Listener l : mListeners) { l.onHoldToneRequested(this); } } else { for (Listener l : mListeners) { l.onConnectionEvent(this, event, extras); } } } } src/com/android/server/telecom/ConnectionServiceWrapper.java +24 −2 Original line number Diff line number Diff line Loading @@ -589,14 +589,14 @@ public class ConnectionServiceWrapper extends ServiceBinder { } @Override public void onConnectionEvent(String callId, String event) { public void onConnectionEvent(String callId, String event, Bundle extras) { Log.startSession("CSW.oCE"); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.onConnectionEvent(event); call.onConnectionEvent(event, extras); } } } finally { Loading Loading @@ -938,6 +938,28 @@ public class ConnectionServiceWrapper extends ServiceBinder { } } void pullExternalCall(Call call) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("pullExternalCall")) { try { logOutgoing("pullExternalCall %s", callId); mServiceInterface.pullExternalCall(callId); } catch (RemoteException ignored) { } } } void sendCallEvent(Call call, String event, Bundle extras) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("sendCallEvent")) { try { logOutgoing("sendCallEvent %s %s", callId, event); mServiceInterface.sendCallEvent(callId, event, extras); } catch (RemoteException ignored) { } } } /** {@inheritDoc} */ @Override protected void setServiceInterface(IBinder binder) { Loading src/com/android/server/telecom/InCallAdapter.java +45 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom; import android.os.Binder; import android.os.Bundle; import android.telecom.PhoneAccountHandle; import com.android.internal.telecom.IInCallAdapter; Loading Loading @@ -369,6 +370,50 @@ class InCallAdapter extends IInCallAdapter.Stub { } } @Override public void pullExternalCall(String callId) { try { Log.startSession("ICA.pEC", mOwnerComponentName); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.pullExternalCall(); } else { Log.w(this, "pullExternalCall, unknown call id: %s", callId); } } } finally { Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); } } @Override public void sendCallEvent(String callId, String event, Bundle extras) { try { Log.startSession("ICA.sCE", mOwnerComponentName); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.sendCallEvent(event, extras); } else { Log.w(this, "sendCallEvent, unknown call id: %s", callId); } } } finally { Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); } } @Override public void turnOnProximitySensor() { try { Loading src/com/android/server/telecom/InCallController.java +17 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -132,6 +133,11 @@ public final class InCallController extends CallsManagerListenerBase { public void onConferenceableCallsChanged(Call call) { updateCall(call); } @Override public void onConnectionEvent(Call call, String event, Bundle extras) { notifyConnectionEvent(call, event, extras); } }; private final SystemStateListener mSystemStateListener = new SystemStateListener() { Loading Loading @@ -321,6 +327,17 @@ public final class InCallController extends CallsManagerListenerBase { } } private void notifyConnectionEvent(Call call, String event, Bundle extras) { if (!mInCallServices.isEmpty()) { for (IInCallService inCallService : mInCallServices.values()) { try { inCallService.onConnectionEvent(mCallIdMapper.getCallId(call), event, extras); } catch (RemoteException ignored) { } } } } /** * Unbinds an existing bound connection to the in-call app. */ Loading src/com/android/server/telecom/Log.java +1 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ public class Log { public static final String BLOCK_CHECK_FINISHED = "BLOCK_CHECK_FINISHED"; public static final String REMOTELY_HELD = "REMOTELY_HELD"; public static final String REMOTELY_UNHELD = "REMOTELY_UNHELD"; public static final String PULL = "PULL"; /** * Maps from a request to a response. The same event could be listed as the Loading Loading
src/com/android/server/telecom/Call.java +58 −1 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public class Call implements CreateConnectionResponse { void onConferenceableCallsChanged(Call call); boolean onCanceledViaNewOutgoingCallBroadcast(Call call); void onHoldToneRequested(Call call); void onConnectionEvent(Call call, String event, Bundle extras); } public abstract static class ListenerBase implements Listener { Loading Loading @@ -165,6 +166,8 @@ public class Call implements CreateConnectionResponse { @Override public void onHoldToneRequested(Call call) {} @Override public void onConnectionEvent(Call call, String event, Bundle extras) {} } private final OnQueryCompleteListener mCallerInfoQueryListener = Loading Loading @@ -1424,6 +1427,55 @@ public class Call implements CreateConnectionResponse { } } /** * Initiates a request to the connection service to pull this call. * <p> * This method can only be used for calls that have the * {@link android.telecom.Connection#CAPABILITY_CAN_PULL_CALL} and * {@link android.telecom.Connection#CAPABILITY_IS_EXTERNAL_CALL} capabilities set. * <p> * An external call is a representation of a call which is taking place on another device * associated with a PhoneAccount on this device. Issuing a request to pull the external call * tells the {@link android.telecom.ConnectionService} that it should move the call from the * other device to this one. An example of this is the IMS multi-endpoint functionality. A * user may have two phones with the same phone number. If the user is engaged in an active * call on their first device, the network will inform the second device of that ongoing call in * the form of an external call. The user may wish to continue their conversation on the second * device, so will issue a request to pull the call to the second device. * <p> * Requests to pull a call which is not external, or a call which is not pullable are ignored. */ public void pullExternalCall() { if (mConnectionService == null) { Log.w(this, "pulling a call without a connection service."); } if (!can(Connection.CAPABILITY_IS_EXTERNAL_CALL)) { Log.w(this, "pullExternalCall - call %s is not an external call.", mId); return; } if (!can(Connection.CAPABILITY_CAN_PULL_CALL)) { Log.w(this, "pullExternalCall - call %s is external but cannot be pulled.", mId); return; } Log.event(this, Log.Events.PULL); mConnectionService.pullExternalCall(this); } /** * Sends a call event to the {@link ConnectionService} for this call. * * See {@link Call#sendCallEvent(String, Bundle)}. * * @param event The call event. * @param extras Associated extras. */ public void sendCallEvent(String event, Bundle extras) { mConnectionService.sendCallEvent(this, event, extras); } void setParentCall(Call parentCall) { if (parentCall == this) { Log.e(this, new Exception(), "setting the parent to self"); Loading Loading @@ -1948,8 +2000,9 @@ public class Call implements CreateConnectionResponse { * Handles Connection events received from a {@link ConnectionService}. * * @param event The event. * @param extras The extras. */ public void onConnectionEvent(String event) { public void onConnectionEvent(String event, Bundle extras) { if (Connection.EVENT_ON_HOLD_TONE_START.equals(event)) { mIsRemotelyHeld = true; Log.event(this, Log.Events.REMOTELY_HELD); Loading @@ -1964,6 +2017,10 @@ public class Call implements CreateConnectionResponse { for (Listener l : mListeners) { l.onHoldToneRequested(this); } } else { for (Listener l : mListeners) { l.onConnectionEvent(this, event, extras); } } } }
src/com/android/server/telecom/ConnectionServiceWrapper.java +24 −2 Original line number Diff line number Diff line Loading @@ -589,14 +589,14 @@ public class ConnectionServiceWrapper extends ServiceBinder { } @Override public void onConnectionEvent(String callId, String event) { public void onConnectionEvent(String callId, String event, Bundle extras) { Log.startSession("CSW.oCE"); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.onConnectionEvent(event); call.onConnectionEvent(event, extras); } } } finally { Loading Loading @@ -938,6 +938,28 @@ public class ConnectionServiceWrapper extends ServiceBinder { } } void pullExternalCall(Call call) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("pullExternalCall")) { try { logOutgoing("pullExternalCall %s", callId); mServiceInterface.pullExternalCall(callId); } catch (RemoteException ignored) { } } } void sendCallEvent(Call call, String event, Bundle extras) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("sendCallEvent")) { try { logOutgoing("sendCallEvent %s %s", callId, event); mServiceInterface.sendCallEvent(callId, event, extras); } catch (RemoteException ignored) { } } } /** {@inheritDoc} */ @Override protected void setServiceInterface(IBinder binder) { Loading
src/com/android/server/telecom/InCallAdapter.java +45 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom; import android.os.Binder; import android.os.Bundle; import android.telecom.PhoneAccountHandle; import com.android.internal.telecom.IInCallAdapter; Loading Loading @@ -369,6 +370,50 @@ class InCallAdapter extends IInCallAdapter.Stub { } } @Override public void pullExternalCall(String callId) { try { Log.startSession("ICA.pEC", mOwnerComponentName); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.pullExternalCall(); } else { Log.w(this, "pullExternalCall, unknown call id: %s", callId); } } } finally { Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); } } @Override public void sendCallEvent(String callId, String event, Bundle extras) { try { Log.startSession("ICA.sCE", mOwnerComponentName); long token = Binder.clearCallingIdentity(); try { synchronized (mLock) { Call call = mCallIdMapper.getCall(callId); if (call != null) { call.sendCallEvent(event, extras); } else { Log.w(this, "sendCallEvent, unknown call id: %s", callId); } } } finally { Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); } } @Override public void turnOnProximitySensor() { try { Loading
src/com/android/server/telecom/InCallController.java +17 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -132,6 +133,11 @@ public final class InCallController extends CallsManagerListenerBase { public void onConferenceableCallsChanged(Call call) { updateCall(call); } @Override public void onConnectionEvent(Call call, String event, Bundle extras) { notifyConnectionEvent(call, event, extras); } }; private final SystemStateListener mSystemStateListener = new SystemStateListener() { Loading Loading @@ -321,6 +327,17 @@ public final class InCallController extends CallsManagerListenerBase { } } private void notifyConnectionEvent(Call call, String event, Bundle extras) { if (!mInCallServices.isEmpty()) { for (IInCallService inCallService : mInCallServices.values()) { try { inCallService.onConnectionEvent(mCallIdMapper.getCallId(call), event, extras); } catch (RemoteException ignored) { } } } } /** * Unbinds an existing bound connection to the in-call app. */ Loading
src/com/android/server/telecom/Log.java +1 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ public class Log { public static final String BLOCK_CHECK_FINISHED = "BLOCK_CHECK_FINISHED"; public static final String REMOTELY_HELD = "REMOTELY_HELD"; public static final String REMOTELY_UNHELD = "REMOTELY_UNHELD"; public static final String PULL = "PULL"; /** * Maps from a request to a response. The same event could be listed as the Loading