Merge "Add new @hide API to pass call direction changes through Telecom"
This commit is contained in:
@@ -74,6 +74,7 @@ public abstract class Conference extends Conferenceable {
|
|||||||
public void onConnectionEvent(Conference c, String event, Bundle extras) {}
|
public void onConnectionEvent(Conference c, String event, Bundle extras) {}
|
||||||
public void onCallerDisplayNameChanged(
|
public void onCallerDisplayNameChanged(
|
||||||
Conference c, String callerDisplayName, int presentation) {}
|
Conference c, String callerDisplayName, int presentation) {}
|
||||||
|
public void onCallDirectionChanged(Conference c, int callDirection) {}
|
||||||
public void onRingbackRequested(Conference c, boolean ringback) {}
|
public void onRingbackRequested(Conference c, boolean ringback) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +104,7 @@ public abstract class Conference extends Conferenceable {
|
|||||||
private int mAddressPresentation;
|
private int mAddressPresentation;
|
||||||
private String mCallerDisplayName;
|
private String mCallerDisplayName;
|
||||||
private int mCallerDisplayNamePresentation;
|
private int mCallerDisplayNamePresentation;
|
||||||
|
private int mCallDirection;
|
||||||
private boolean mRingbackRequested = false;
|
private boolean mRingbackRequested = false;
|
||||||
|
|
||||||
private final Connection.Listener mConnectionDeathListener = new Connection.Listener() {
|
private final Connection.Listener mConnectionDeathListener = new Connection.Listener() {
|
||||||
@@ -1023,6 +1025,25 @@ public abstract class Conference extends Conferenceable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the call direction of this {@link Conference}. By default, all {@link Conference}s have
|
||||||
|
* a direction of {@link android.telecom.Call.Details.CallDirection#DIRECTION_UNKNOWN}. The
|
||||||
|
* direction of a {@link Conference} is only applicable to the case where
|
||||||
|
* {@link #setConferenceState(boolean)} has been set to {@code false}, otherwise the direction
|
||||||
|
* will be ignored.
|
||||||
|
* @param callDirection The direction of the conference.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(MODIFY_PHONE_STATE)
|
||||||
|
public final void setCallDirection(@Call.Details.CallDirection int callDirection) {
|
||||||
|
Log.d(this, "setDirection %d", callDirection);
|
||||||
|
mCallDirection = callDirection;
|
||||||
|
for (Listener l : mListeners) {
|
||||||
|
l.onCallDirectionChanged(this, callDirection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the address of this {@link Conference}. Used when {@link #setConferenceState(boolean)}
|
* Sets the address of this {@link Conference}. Used when {@link #setConferenceState(boolean)}
|
||||||
* is called to mark a conference temporarily as NOT a conference.
|
* is called to mark a conference temporarily as NOT a conference.
|
||||||
@@ -1101,6 +1122,15 @@ public abstract class Conference extends Conferenceable {
|
|||||||
return mCallerDisplayNamePresentation;
|
return mCallerDisplayNamePresentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The call direction of this conference. Only applicable when
|
||||||
|
* {@link #setConferenceState(boolean)} is set to false.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final @Call.Details.CallDirection int getCallDirection() {
|
||||||
|
return mCallDirection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the caller display name (CNAP) of this {@link Conference}. Used when
|
* Sets the caller display name (CNAP) of this {@link Conference}. Used when
|
||||||
* {@link #setConferenceState(boolean)} is called to mark a conference temporarily as NOT a
|
* {@link #setConferenceState(boolean)} is called to mark a conference temporarily as NOT a
|
||||||
|
|||||||
@@ -1553,6 +1553,14 @@ public abstract class ConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallDirectionChanged(Conference c, int direction) {
|
||||||
|
String id = mIdByConference.get(c);
|
||||||
|
if (id != null) {
|
||||||
|
mAdapter.setCallDirection(id, direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAddressChanged(Conference c, Uri newAddress, int presentation) {
|
public void onAddressChanged(Conference c, Uri newAddress, int presentation) {
|
||||||
String id = mIdByConference.get(c);
|
String id = mIdByConference.get(c);
|
||||||
|
|||||||
@@ -693,4 +693,20 @@ final class ConnectionServiceAdapter implements DeathRecipient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the direction of a call. Setting a new direction of an existing call is usually only
|
||||||
|
* applicable during single caller emulation during conferencing, see
|
||||||
|
* {@link Conference#setConferenceState(boolean)} for more information.
|
||||||
|
* @param callId The identifier of the call.
|
||||||
|
* @param direction The new direction of the call.
|
||||||
|
*/
|
||||||
|
void setCallDirection(String callId, @Call.Details.CallDirection int direction) {
|
||||||
|
for (IConnectionServiceAdapter a : mAdapters) {
|
||||||
|
try {
|
||||||
|
a.setCallDirection(callId, direction, Log.getExternalSession());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ final class ConnectionServiceAdapterServant {
|
|||||||
private static final int MSG_CONNECTION_SERVICE_FOCUS_RELEASED = 35;
|
private static final int MSG_CONNECTION_SERVICE_FOCUS_RELEASED = 35;
|
||||||
private static final int MSG_SET_CONFERENCE_STATE = 36;
|
private static final int MSG_SET_CONFERENCE_STATE = 36;
|
||||||
private static final int MSG_HANDLE_CREATE_CONFERENCE_COMPLETE = 37;
|
private static final int MSG_HANDLE_CREATE_CONFERENCE_COMPLETE = 37;
|
||||||
|
private static final int MSG_SET_CALL_DIRECTION = 38;
|
||||||
|
|
||||||
private final IConnectionServiceAdapter mDelegate;
|
private final IConnectionServiceAdapter mDelegate;
|
||||||
|
|
||||||
@@ -353,7 +354,7 @@ final class ConnectionServiceAdapterServant {
|
|||||||
case MSG_CONNECTION_SERVICE_FOCUS_RELEASED:
|
case MSG_CONNECTION_SERVICE_FOCUS_RELEASED:
|
||||||
mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/);
|
mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/);
|
||||||
break;
|
break;
|
||||||
case MSG_SET_CONFERENCE_STATE:
|
case MSG_SET_CONFERENCE_STATE: {
|
||||||
SomeArgs args = (SomeArgs) msg.obj;
|
SomeArgs args = (SomeArgs) msg.obj;
|
||||||
try {
|
try {
|
||||||
mDelegate.setConferenceState((String) args.arg1, (Boolean) args.arg2,
|
mDelegate.setConferenceState((String) args.arg1, (Boolean) args.arg2,
|
||||||
@@ -361,6 +362,17 @@ final class ConnectionServiceAdapterServant {
|
|||||||
} finally {
|
} finally {
|
||||||
args.recycle();
|
args.recycle();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MSG_SET_CALL_DIRECTION: {
|
||||||
|
SomeArgs args = (SomeArgs) msg.obj;
|
||||||
|
try {
|
||||||
|
mDelegate.setCallDirection((String) args.arg1, args.argi1,
|
||||||
|
(Session.Info) args.arg2);
|
||||||
|
} finally {
|
||||||
|
args.recycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -670,6 +682,16 @@ final class ConnectionServiceAdapterServant {
|
|||||||
args.arg3 = sessionInfo;
|
args.arg3 = sessionInfo;
|
||||||
mHandler.obtainMessage(MSG_SET_CONFERENCE_STATE, args).sendToTarget();
|
mHandler.obtainMessage(MSG_SET_CONFERENCE_STATE, args).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCallDirection(String callId, int direction,
|
||||||
|
Session.Info sessionInfo) {
|
||||||
|
SomeArgs args = SomeArgs.obtain();
|
||||||
|
args.arg1 = callId;
|
||||||
|
args.argi1 = direction;
|
||||||
|
args.arg2 = sessionInfo;
|
||||||
|
mHandler.obtainMessage(MSG_SET_CALL_DIRECTION, args).sendToTarget();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
|
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
|
||||||
|
|||||||
@@ -485,6 +485,11 @@ final class RemoteConnectionService {
|
|||||||
Session.Info sessionInfo) {
|
Session.Info sessionInfo) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCallDirection(String callId, int direction, Session.Info sessionInfo) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final ConnectionServiceAdapterServant mServant =
|
private final ConnectionServiceAdapterServant mServant =
|
||||||
|
|||||||
@@ -132,4 +132,6 @@ oneway interface IConnectionServiceAdapter {
|
|||||||
void resetConnectionTime(String callIdi, in Session.Info sessionInfo);
|
void resetConnectionTime(String callIdi, in Session.Info sessionInfo);
|
||||||
|
|
||||||
void setConferenceState(String callId, boolean isConference, in Session.Info sessionInfo);
|
void setConferenceState(String callId, boolean isConference, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void setCallDirection(String callId, int direction, in Session.Info sessionInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user