am 5ba3f456: Merge "Final structural tweaks to Telecomm API (1/8)" into lmp-dev

* commit '5ba3f4563231fd81e3e1c7c56eab66fd9d02d570':
  Final structural tweaks to Telecomm API (1/8)
This commit is contained in:
Ihab Awad
2014-08-13 19:01:31 +00:00
committed by Android Git Automerger
45 changed files with 1229 additions and 1349 deletions

View File

@@ -350,8 +350,8 @@ LOCAL_SRC_FILES += \
media/java/android/media/tv/ITvInputServiceCallback.aidl \
media/java/android/media/tv/ITvInputSession.aidl \
media/java/android/media/tv/ITvInputSessionCallback.aidl \
telecomm/java/com/android/internal/telecomm/IVideoCallCallback.aidl \
telecomm/java/com/android/internal/telecomm/IVideoCallProvider.aidl \
telecomm/java/com/android/internal/telecomm/IVideoCallback.aidl \
telecomm/java/com/android/internal/telecomm/IVideoProvider.aidl \
telecomm/java/com/android/internal/telecomm/IConnectionService.aidl \
telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl \
telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl \

View File

@@ -28815,70 +28815,7 @@ package android.system {
package android.telecomm {
public final class Call {
method public void addListener(android.telecomm.Call.Listener);
method public void answer(int);
method public void conference(android.telecomm.Call);
method public void disconnect();
method public java.util.List<java.lang.String> getCannedTextResponses();
method public java.util.List<android.telecomm.Call> getChildren();
method public java.util.List<android.telecomm.Call> getConferenceableCalls();
method public android.telecomm.Call.Details getDetails();
method public android.telecomm.Call getParent();
method public java.lang.String getRemainingPostDialSequence();
method public int getState();
method public android.telecomm.InCallService.VideoCall getVideoCall();
method public void hold();
method public void phoneAccountClicked();
method public void phoneAccountSelected(android.telecomm.PhoneAccountHandle);
method public void playDtmfTone(char);
method public void postDialContinue(boolean);
method public void reject(boolean, java.lang.String);
method public void removeListener(android.telecomm.Call.Listener);
method public void splitFromConference();
method public void stopDtmfTone();
method public void swapWithBackgroundCall();
method public void unhold();
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CONNECTING = 9; // 0x9
field public static final int STATE_DIALING = 1; // 0x1
field public static final int STATE_DISCONNECTED = 7; // 0x7
field public static final int STATE_HOLDING = 3; // 0x3
field public static final int STATE_NEW = 0; // 0x0
field public static final int STATE_PRE_DIAL_WAIT = 8; // 0x8
field public static final int STATE_RINGING = 2; // 0x2
}
public static class Call.Details {
method public android.telecomm.PhoneAccountHandle getAccountHandle();
method public int getCallCapabilities();
method public java.lang.String getCallerDisplayName();
method public int getCallerDisplayNamePresentation();
method public long getConnectTimeMillis();
method public int getDisconnectCauseCode();
method public java.lang.String getDisconnectCauseMsg();
method public android.telecomm.GatewayInfo getGatewayInfo();
method public android.net.Uri getHandle();
method public int getHandlePresentation();
method public android.telecomm.StatusHints getStatusHints();
method public int getVideoState();
}
public static abstract class Call.Listener {
ctor public Call.Listener();
method public void onCallDestroyed(android.telecomm.Call);
method public void onCannedTextResponsesLoaded(android.telecomm.Call, java.util.List<java.lang.String>);
method public void onChildrenChanged(android.telecomm.Call, java.util.List<android.telecomm.Call>);
method public void onConferenceableCallsChanged(android.telecomm.Call, java.util.List<android.telecomm.Call>);
method public void onDetailsChanged(android.telecomm.Call, android.telecomm.Call.Details);
method public void onParentChanged(android.telecomm.Call, android.telecomm.Call);
method public void onPostDialWait(android.telecomm.Call, java.lang.String);
method public void onStartActivity(android.telecomm.Call, android.app.PendingIntent);
method public void onStateChanged(android.telecomm.Call, int);
method public void onVideoCallChanged(android.telecomm.Call, android.telecomm.InCallService.VideoCall);
}
public final class CallAudioState implements android.os.Parcelable {
public final class AudioState implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
@@ -28893,8 +28830,8 @@ package android.telecomm {
field public final int supportedRouteMask;
}
public final class CallCameraCapabilities implements android.os.Parcelable {
ctor public CallCameraCapabilities(boolean, float, int, int);
public final class CameraCapabilities implements android.os.Parcelable {
ctor public CameraCapabilities(boolean, float, int, int);
method public int describeContents();
method public int getHeight();
method public float getMaxZoom();
@@ -28904,55 +28841,18 @@ package android.telecomm {
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class CallCapabilities {
method public static java.lang.String toString(int);
field public static final int ADD_CALL = 16; // 0x10
field public static final int ALL = 3327; // 0xcff
field public static final int GENERIC_CONFERENCE = 128; // 0x80
field public static final int HOLD = 1; // 0x1
field public static final int MERGE_CALLS = 4; // 0x4
field public static final int MUTE = 64; // 0x40
field public static final int RESPOND_VIA_TEXT = 32; // 0x20
field public static final int SUPPORTS_VT_LOCAL = 256; // 0x100
field public static final int SUPPORTS_VT_REMOTE = 512; // 0x200
field public static final int SUPPORT_HOLD = 2; // 0x2
field public static final int SWAP_CALLS = 8; // 0x8
field public static final int VoLTE = 1024; // 0x400
field public static final int VoWIFI = 2048; // 0x800
}
public class CallPropertyPresentation {
ctor public CallPropertyPresentation();
field public static final int ALLOWED = 1; // 0x1
field public static final int PAYPHONE = 4; // 0x4
field public static final int RESTRICTED = 2; // 0x2
field public static final int UNKNOWN = 3; // 0x3
}
public final class CallState extends java.lang.Enum {
method public static android.telecomm.CallState valueOf(java.lang.String);
method public static final android.telecomm.CallState[] values();
enum_constant public static final android.telecomm.CallState ACTIVE;
enum_constant public static final android.telecomm.CallState CONNECTING;
enum_constant public static final android.telecomm.CallState DIALING;
enum_constant public static final android.telecomm.CallState DISCONNECTED;
enum_constant public static final android.telecomm.CallState NEW;
enum_constant public static final android.telecomm.CallState ON_HOLD;
enum_constant public static final android.telecomm.CallState PRE_DIAL_WAIT;
enum_constant public static final android.telecomm.CallState RINGING;
}
public abstract class Connection {
ctor public Connection();
method public static android.telecomm.Connection createCanceledConnection();
method public static android.telecomm.Connection createFailedConnection(int, java.lang.String);
method public final void destroy();
method public final boolean getAudioModeIsVoip();
method public final android.telecomm.CallAudioState getCallAudioState();
method public final android.telecomm.AudioState getAudioState();
method public final int getCallCapabilities();
method public final java.lang.String getCallerDisplayName();
method public final int getCallerDisplayNamePresentation();
method public static android.telecomm.Connection getCanceledConnection();
method public final java.util.List<android.telecomm.Connection> getChildConnections();
method public static android.telecomm.Connection getFailedConnection(int, java.lang.String);
method public final java.util.List<android.telecomm.Connection> getConferenceableConnections();
method public final int getFailureCode();
method public final java.lang.String getFailureMessage();
method public final android.net.Uri getHandle();
@@ -28960,7 +28860,7 @@ package android.telecomm {
method public final android.telecomm.Connection getParentConnection();
method public final int getState();
method public final android.telecomm.StatusHints getStatusHints();
method public final android.telecomm.ConnectionService.VideoCallProvider getVideoCallProvider();
method public final android.telecomm.Connection.VideoProvider getVideoProvider();
method public final int getVideoState();
method public final boolean isConferenceConnection();
method public final boolean isRequestingRingback();
@@ -28975,10 +28875,9 @@ package android.telecomm {
method public void onPostDialContinue(boolean);
method public void onReject();
method public void onSeparate();
method public void onSetAudioState(android.telecomm.CallAudioState);
method public void onSetAudioState(android.telecomm.AudioState);
method public void onSetState(int);
method public void onStopDtmfTone();
method public void onSwapWithBackgroundCall();
method public void onUnhold();
method public final void setActive();
method public final void setAudioModeIsVoip(boolean);
@@ -28997,31 +28896,55 @@ package android.telecomm {
method public final void setPostDialWait(java.lang.String);
method public final void setRequestingRingback(boolean);
method public final void setRinging();
method public final void setSignal(android.os.Bundle);
method public final void setStatusHints(android.telecomm.StatusHints);
method public final void setVideoCallProvider(android.telecomm.ConnectionService.VideoCallProvider);
method public final void setVideoProvider(android.telecomm.Connection.VideoProvider);
method public final void setVideoState(int);
method public final void startActivityFromInCall(android.app.PendingIntent);
method public static java.lang.String stateToString(int);
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CANCELED = 8; // 0x8
field public static final int STATE_DIALING = 3; // 0x3
field public static final int STATE_DISCONNECTED = 6; // 0x6
field public static final int STATE_FAILED = 7; // 0x7
field public static final int STATE_HOLDING = 5; // 0x5
field public static final int STATE_INITIALIZING = 0; // 0x0
field public static final int STATE_NEW = 1; // 0x1
field public static final int STATE_RINGING = 2; // 0x2
}
public final class Connection.State {
field public static final int ACTIVE = 4; // 0x4
field public static final int CANCELED = 8; // 0x8
field public static final int DIALING = 3; // 0x3
field public static final int DISCONNECTED = 6; // 0x6
field public static final int FAILED = 7; // 0x7
field public static final int HOLDING = 5; // 0x5
field public static final int INITIALIZING = 0; // 0x0
field public static final int NEW = 1; // 0x1
field public static final int RINGING = 2; // 0x2
public static abstract class Connection.VideoProvider {
ctor public Connection.VideoProvider();
method public void changeCallDataUsage(int);
method public void changeCameraCapabilities(android.telecomm.CameraCapabilities);
method public void changePeerDimensions(int, int);
method public void handleCallSessionEvent(int);
method public abstract void onRequestCallDataUsage();
method public abstract void onRequestCameraCapabilities();
method public abstract void onSendSessionModifyRequest(android.telecomm.VideoProfile);
method public abstract void onSendSessionModifyResponse(android.telecomm.VideoProfile);
method public abstract void onSetCamera(java.lang.String);
method public abstract void onSetDeviceOrientation(int);
method public abstract void onSetDisplaySurface(android.view.Surface);
method public abstract void onSetPauseImage(java.lang.String);
method public abstract void onSetPreviewSurface(android.view.Surface);
method public abstract void onSetZoom(float);
method public void receiveSessionModifyRequest(android.telecomm.VideoProfile);
method public void receiveSessionModifyResponse(int, android.telecomm.VideoProfile, android.telecomm.VideoProfile);
field public static final int SESSION_EVENT_CAMERA_FAILURE = 5; // 0x5
field public static final int SESSION_EVENT_CAMERA_READY = 6; // 0x6
field public static final int SESSION_EVENT_RX_PAUSE = 1; // 0x1
field public static final int SESSION_EVENT_RX_RESUME = 2; // 0x2
field public static final int SESSION_EVENT_TX_START = 3; // 0x3
field public static final int SESSION_EVENT_TX_STOP = 4; // 0x4
field public static final int SESSION_MODIFY_REQUEST_FAIL = 2; // 0x2
field public static final int SESSION_MODIFY_REQUEST_INVALID = 3; // 0x3
field public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; // 0x1
}
public final class ConnectionRequest implements android.os.Parcelable {
ctor public ConnectionRequest(android.telecomm.PhoneAccountHandle, java.lang.String, android.net.Uri, int, android.os.Bundle, int);
ctor public ConnectionRequest(android.telecomm.PhoneAccountHandle, android.net.Uri, int, android.os.Bundle, int);
method public int describeContents();
method public android.telecomm.PhoneAccountHandle getAccountHandle();
method public java.lang.String getCallId();
method public android.os.Bundle getExtras();
method public android.net.Uri getHandle();
method public int getHandlePresentation();
@@ -29044,32 +28967,6 @@ package android.telecomm {
field public static final java.lang.String SERVICE_INTERFACE = "android.telecomm.ConnectionService";
}
public static abstract interface ConnectionService.CreateConnectionResponse {
method public abstract void onCancel(android.telecomm.ConnectionRequest);
method public abstract void onFailure(android.telecomm.ConnectionRequest, int, java.lang.String);
method public abstract void onSuccess(android.telecomm.ConnectionRequest, CONNECTION);
}
public static abstract class ConnectionService.VideoCallProvider {
ctor public ConnectionService.VideoCallProvider();
method public void changeCallDataUsage(int);
method public void changeCameraCapabilities(android.telecomm.CallCameraCapabilities);
method public void changePeerDimensions(int, int);
method public void handleCallSessionEvent(int);
method public void onRequestCallDataUsage();
method public void onRequestCameraCapabilities();
method public void onSendSessionModifyRequest(android.telecomm.VideoCallProfile);
method public void onSendSessionModifyResponse(android.telecomm.VideoCallProfile);
method public void onSetCamera(java.lang.String);
method public void onSetDeviceOrientation(int);
method public void onSetDisplaySurface(android.view.Surface);
method public void onSetPauseImage(java.lang.String);
method public void onSetPreviewSurface(android.view.Surface);
method public void onSetZoom(float);
method public void receiveSessionModifyRequest(android.telecomm.VideoCallProfile);
method public void receiveSessionModifyResponse(int, android.telecomm.VideoCallProfile, android.telecomm.VideoCallProfile);
}
public class GatewayInfo implements android.os.Parcelable {
method public int describeContents();
method public android.net.Uri getGatewayHandle();
@@ -29080,87 +28977,8 @@ package android.telecomm {
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class InCallAdapter {
method public void answerCall(java.lang.String, int);
method public void disconnectCall(java.lang.String);
method public void holdCall(java.lang.String);
method public void mute(boolean);
method public void phoneAccountClicked(java.lang.String);
method public void phoneAccountSelected(java.lang.String, android.telecomm.PhoneAccountHandle);
method public void playDtmfTone(java.lang.String, char);
method public void postDialContinue(java.lang.String, boolean);
method public void rejectCall(java.lang.String, boolean, java.lang.String);
method public void setAudioRoute(int);
method public void stopDtmfTone(java.lang.String);
method public void swapWithBackgroundCall(java.lang.String);
method public void turnProximitySensorOff(boolean);
method public void turnProximitySensorOn();
method public void unholdCall(java.lang.String);
}
public abstract class InCallService extends android.app.Service {
ctor public InCallService();
method public android.telecomm.Phone getPhone();
method public android.os.IBinder onBind(android.content.Intent);
method public void onPhoneCreated(android.telecomm.Phone);
method public void onPhoneDestroyed(android.telecomm.Phone);
}
public static abstract class InCallService.VideoCall {
ctor public InCallService.VideoCall();
method public abstract void requestCallDataUsage();
method public abstract void requestCameraCapabilities();
method public abstract void sendSessionModifyRequest(android.telecomm.VideoCallProfile);
method public abstract void sendSessionModifyResponse(android.telecomm.VideoCallProfile);
method public abstract void setCamera(java.lang.String);
method public abstract void setDeviceOrientation(int);
method public abstract void setDisplaySurface(android.view.Surface);
method public abstract void setPauseImage(java.lang.String);
method public abstract void setPreviewSurface(android.view.Surface);
method public abstract void setVideoCallListener(android.telecomm.InCallService.VideoCall.Listener);
method public abstract void setZoom(float);
field public static final int SESSION_EVENT_CAMERA_FAILURE = 5; // 0x5
field public static final int SESSION_EVENT_CAMERA_READY = 6; // 0x6
field public static final int SESSION_EVENT_RX_PAUSE = 1; // 0x1
field public static final int SESSION_EVENT_RX_RESUME = 2; // 0x2
field public static final int SESSION_EVENT_TX_START = 3; // 0x3
field public static final int SESSION_EVENT_TX_STOP = 4; // 0x4
field public static final int SESSION_MODIFY_REQUEST_FAIL = 2; // 0x2
field public static final int SESSION_MODIFY_REQUEST_INVALID = 3; // 0x3
field public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; // 0x1
}
public static abstract class InCallService.VideoCall.Listener {
ctor public InCallService.VideoCall.Listener();
method public abstract void onCallDataUsageChanged(int);
method public abstract void onCallSessionEvent(int);
method public abstract void onCameraCapabilitiesChanged(android.telecomm.CallCameraCapabilities);
method public abstract void onPeerDimensionsChanged(int, int);
method public abstract void onSessionModifyRequestReceived(android.telecomm.VideoCallProfile);
method public abstract void onSessionModifyResponseReceived(int, android.telecomm.VideoCallProfile, android.telecomm.VideoCallProfile);
}
public final class Phone {
method public final void addListener(android.telecomm.Phone.Listener);
method public final android.telecomm.CallAudioState getAudioState();
method public final java.util.List<android.telecomm.Call> getCalls();
method public final void removeListener(android.telecomm.Phone.Listener);
method public final void setAudioRoute(int);
method public final void setMuted(boolean);
method public final void setProximitySensorOff(boolean);
method public final void setProximitySensorOn();
}
public static abstract class Phone.Listener {
ctor public Phone.Listener();
method public void onAudioStateChanged(android.telecomm.Phone, android.telecomm.CallAudioState);
method public void onBringToForeground(android.telecomm.Phone, boolean);
method public void onCallAdded(android.telecomm.Phone, android.telecomm.Call);
method public void onCallRemoved(android.telecomm.Phone, android.telecomm.Call);
}
public class PhoneAccount implements android.os.Parcelable {
ctor public PhoneAccount(android.telecomm.PhoneAccountHandle, android.net.Uri, java.lang.String, int, int, java.lang.CharSequence, java.lang.CharSequence);
method public static android.telecomm.PhoneAccount.Builder builder();
method public int describeContents();
method public android.telecomm.PhoneAccountHandle getAccountHandle();
method public int getCapabilities();
@@ -29177,6 +28995,17 @@ package android.telecomm {
field public static final android.os.Parcelable.Creator CREATOR;
}
public static class PhoneAccount.Builder {
method public android.telecomm.PhoneAccount build();
method public android.telecomm.PhoneAccount.Builder withAccountHandle(android.telecomm.PhoneAccountHandle);
method public android.telecomm.PhoneAccount.Builder withCapabilities(int);
method public android.telecomm.PhoneAccount.Builder withHandle(android.net.Uri);
method public android.telecomm.PhoneAccount.Builder withIconResId(int);
method public android.telecomm.PhoneAccount.Builder withLabel(java.lang.CharSequence);
method public android.telecomm.PhoneAccount.Builder withShortDescription(java.lang.CharSequence);
method public android.telecomm.PhoneAccount.Builder withSubscriptionNumber(java.lang.String);
}
public class PhoneAccountHandle implements android.os.Parcelable {
ctor public PhoneAccountHandle(android.content.ComponentName, java.lang.String);
method public int describeContents();
@@ -29186,6 +29015,31 @@ package android.telecomm {
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class PhoneCapabilities {
method public static java.lang.String toString(int);
field public static final int ADD_CALL = 16; // 0x10
field public static final int ALL = 3327; // 0xcff
field public static final int GENERIC_CONFERENCE = 128; // 0x80
field public static final int HOLD = 1; // 0x1
field public static final int MERGE_CALLS = 4; // 0x4
field public static final int MUTE = 64; // 0x40
field public static final int RESPOND_VIA_TEXT = 32; // 0x20
field public static final int SUPPORTS_VT_LOCAL = 256; // 0x100
field public static final int SUPPORTS_VT_REMOTE = 512; // 0x200
field public static final int SUPPORT_HOLD = 2; // 0x2
field public static final int SWAP_CALLS = 8; // 0x8
field public static final int VoLTE = 1024; // 0x400
field public static final int VoWIFI = 2048; // 0x800
}
public class PropertyPresentation {
ctor public PropertyPresentation();
field public static final int ALLOWED = 1; // 0x1
field public static final int PAYPHONE = 4; // 0x4
field public static final int RESTRICTED = 2; // 0x2
field public static final int UNKNOWN = 3; // 0x3
}
public final class RemoteConnection {
method public void abort();
method public void addListener(android.telecomm.RemoteConnection.Listener);
@@ -29212,9 +29066,8 @@ package android.telecomm {
method public void postDialContinue(boolean);
method public void reject();
method public void removeListener(android.telecomm.RemoteConnection.Listener);
method public void setAudioState(android.telecomm.CallAudioState);
method public void setAudioState(android.telecomm.AudioState);
method public void stopDtmfTone();
method public void swapWithBackgroundCall();
method public void unhold();
}
@@ -29242,18 +29095,13 @@ package android.telecomm {
method public abstract void onResult(IN, OUT...);
}
public abstract interface SimpleResponse {
method public abstract void onError(IN);
method public abstract void onResult(IN, OUT);
}
public final class StatusHints implements android.os.Parcelable {
ctor public StatusHints(android.content.ComponentName, java.lang.CharSequence, int, android.os.Bundle);
method public int describeContents();
method public android.content.ComponentName getComponentName();
method public android.os.Bundle getExtras();
method public android.graphics.drawable.Drawable getIcon(android.content.Context);
method public int getIconId();
method public int getIconResId();
method public java.lang.CharSequence getLabel();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
@@ -29281,23 +29129,9 @@ package android.telecomm {
field public static final java.lang.String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.intent.extra.START_CALL_WITH_VIDEO_STATE";
}
public class VideoCallImpl extends android.telecomm.InCallService.VideoCall {
method public void requestCallDataUsage();
method public void requestCameraCapabilities();
method public void sendSessionModifyRequest(android.telecomm.VideoCallProfile);
method public void sendSessionModifyResponse(android.telecomm.VideoCallProfile);
method public void setCamera(java.lang.String);
method public void setDeviceOrientation(int);
method public void setDisplaySurface(android.view.Surface);
method public void setPauseImage(java.lang.String);
method public void setPreviewSurface(android.view.Surface);
method public void setVideoCallListener(android.telecomm.InCallService.VideoCall.Listener);
method public void setZoom(float);
}
public class VideoCallProfile implements android.os.Parcelable {
ctor public VideoCallProfile(int);
ctor public VideoCallProfile(int, int);
public class VideoProfile implements android.os.Parcelable {
ctor public VideoProfile(int);
ctor public VideoProfile(int, int);
method public int describeContents();
method public int getQuality();
method public int getVideoState();
@@ -29309,8 +29143,8 @@ package android.telecomm {
field public static final int QUALITY_MEDIUM = 2; // 0x2
}
public static class VideoCallProfile.VideoState {
ctor public VideoCallProfile.VideoState();
public static class VideoProfile.VideoState {
ctor public VideoProfile.VideoState();
method public static boolean isAudioOnly(int);
method public static boolean isBidirectional(int);
method public static boolean isPaused(int);

View File

@@ -16,4 +16,7 @@
package android.telecomm;
parcelable CallAudioState;
/**
* {@hide}
*/
parcelable AudioState;

View File

@@ -24,7 +24,7 @@ import java.util.Locale;
/**
* Encapsulates all audio states during a call.
*/
public final class CallAudioState implements Parcelable {
public final class AudioState implements Parcelable {
/** Direct the audio stream through the device's earpiece. */
public static int ROUTE_EARPIECE = 0x00000001;
@@ -57,14 +57,14 @@ public final class CallAudioState implements Parcelable {
public final int supportedRouteMask;
/** @hide */
public CallAudioState(boolean isMuted, int route, int supportedRouteMask) {
public AudioState(boolean isMuted, int route, int supportedRouteMask) {
this.isMuted = isMuted;
this.route = route;
this.supportedRouteMask = supportedRouteMask;
}
/** @hide */
public CallAudioState(CallAudioState state) {
public AudioState(AudioState state) {
isMuted = state.isMuted;
route = state.route;
supportedRouteMask = state.supportedRouteMask;
@@ -75,10 +75,10 @@ public final class CallAudioState implements Parcelable {
if (obj == null) {
return false;
}
if (!(obj instanceof CallAudioState)) {
if (!(obj instanceof AudioState)) {
return false;
}
CallAudioState state = (CallAudioState) obj;
AudioState state = (AudioState) obj;
return isMuted == state.isMuted && route == state.route &&
supportedRouteMask == state.supportedRouteMask;
}
@@ -86,7 +86,7 @@ public final class CallAudioState implements Parcelable {
@Override
public String toString() {
return String.format(Locale.US,
"[CallAudioState isMuted: %b, route; %s, supportedRouteMask: %s]",
"[AudioState isMuted: %b, route; %s, supportedRouteMask: %s]",
isMuted, audioRouteToString(route), audioRouteToString(supportedRouteMask));
}
@@ -121,22 +121,22 @@ public final class CallAudioState implements Parcelable {
}
/**
* Responsible for creating CallAudioState objects for deserialized Parcels.
* Responsible for creating AudioState objects for deserialized Parcels.
*/
public static final Parcelable.Creator<CallAudioState> CREATOR =
new Parcelable.Creator<CallAudioState> () {
public static final Parcelable.Creator<AudioState> CREATOR =
new Parcelable.Creator<AudioState> () {
@Override
public CallAudioState createFromParcel(Parcel source) {
public AudioState createFromParcel(Parcel source) {
boolean isMuted = source.readByte() == 0 ? false : true;
int route = source.readInt();
int supportedRouteMask = source.readInt();
return new CallAudioState(isMuted, route, supportedRouteMask);
return new AudioState(isMuted, route, supportedRouteMask);
}
@Override
public CallAudioState[] newArray(int size) {
return new CallAudioState[size];
public AudioState[] newArray(int size) {
return new AudioState[size];
}
};
@@ -149,7 +149,7 @@ public final class CallAudioState implements Parcelable {
}
/**
* Writes CallAudioState object into a serializeable Parcel.
* Writes AudioState object into a serializeable Parcel.
*/
@Override
public void writeToParcel(Parcel destination, int flags) {

View File

@@ -29,6 +29,8 @@ import java.util.Objects;
/**
* Represents an ongoing phone call that the in-call app should present to the user.
*
* {@hide}
*/
public final class Call {
/**
@@ -84,7 +86,7 @@ public final class Call {
private final PhoneAccountHandle mAccountHandle;
private final int mCallCapabilities;
private final int mDisconnectCauseCode;
private final String mDisconnectCauseMsg;
private final String mDisconnectCauseMessage;
private final long mConnectTimeMillis;
private final GatewayInfo mGatewayInfo;
private final int mVideoState;
@@ -100,7 +102,7 @@ public final class Call {
/**
* @return The presentation requirements for the handle. See
* {@link android.telecomm.CallPropertyPresentation} for valid values.
* {@link PropertyPresentation} for valid values.
*/
public int getHandlePresentation() {
return mHandlePresentation;
@@ -115,7 +117,7 @@ public final class Call {
/**
* @return The presentation requirements for the caller display name. See
* {@link android.telecomm.CallPropertyPresentation} for valid values.
* {@link PropertyPresentation} for valid values.
*/
public int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
@@ -131,7 +133,7 @@ public final class Call {
/**
* @return A bitmask of the capabilities of the {@code Call}, as defined in
* {@link CallCapabilities}.
* {@link PhoneCapabilities}.
*/
public int getCallCapabilities() {
return mCallCapabilities;
@@ -149,8 +151,8 @@ public final class Call {
* @return For a {@link #STATE_DISCONNECTED} {@code Call}, an optional reason for
* disconnection expressed as a free text message.
*/
public String getDisconnectCauseMsg() {
return mDisconnectCauseMsg;
public String getDisconnectCauseMessage() {
return mDisconnectCauseMessage;
}
/**
@@ -197,7 +199,7 @@ public final class Call {
Objects.equals(mAccountHandle, d.mAccountHandle) &&
Objects.equals(mCallCapabilities, d.mCallCapabilities) &&
Objects.equals(mDisconnectCauseCode, d.mDisconnectCauseCode) &&
Objects.equals(mDisconnectCauseMsg, d.mDisconnectCauseMsg) &&
Objects.equals(mDisconnectCauseMessage, d.mDisconnectCauseMessage) &&
Objects.equals(mConnectTimeMillis, d.mConnectTimeMillis) &&
Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
Objects.equals(mVideoState, d.mVideoState) &&
@@ -216,7 +218,7 @@ public final class Call {
Objects.hashCode(mAccountHandle) +
Objects.hashCode(mCallCapabilities) +
Objects.hashCode(mDisconnectCauseCode) +
Objects.hashCode(mDisconnectCauseMsg) +
Objects.hashCode(mDisconnectCauseMessage) +
Objects.hashCode(mConnectTimeMillis) +
Objects.hashCode(mGatewayInfo) +
Objects.hashCode(mVideoState) +
@@ -232,7 +234,7 @@ public final class Call {
PhoneAccountHandle accountHandle,
int capabilities,
int disconnectCauseCode,
String disconnectCauseMsg,
String disconnectCauseMessage,
long connectTimeMillis,
GatewayInfo gatewayInfo,
int videoState,
@@ -244,7 +246,7 @@ public final class Call {
mAccountHandle = accountHandle;
mCallCapabilities = capabilities;
mDisconnectCauseCode = disconnectCauseCode;
mDisconnectCauseMsg = disconnectCauseMsg;
mDisconnectCauseMessage = disconnectCauseMessage;
mConnectTimeMillis = connectTimeMillis;
mGatewayInfo = gatewayInfo;
mVideoState = videoState;
@@ -256,8 +258,6 @@ public final class Call {
/**
* Invoked when the state of this {@code Call} has changed. See {@link #getState()}.
*
* TODO: Provide previous state also?
*
* @param call The {@code Call} invoking this method.
* @param state The new state of the {@code Call}.
*/
@@ -459,8 +459,6 @@ public final class Call {
/**
* Notifies this {@code Call} that the phone account user interface element was touched.
*
* TODO: Figure out if and how we can generalize this
*/
public void phoneAccountClicked() {
mInCallAdapter.phoneAccountClicked(mTelecommCallId);
@@ -494,14 +492,6 @@ public final class Call {
mInCallAdapter.splitFromConference(mTelecommCallId);
}
/**
* Instructs this {@code Call} to swap itself with an existing background call, if one
* such call exists.
*/
public void swapWithBackgroundCall() {
mInCallAdapter.swapWithBackgroundCall(mTelecommCallId);
}
/**
* Obtains the parent of this {@code Call} in a conference, if any.
*
@@ -774,25 +764,25 @@ public final class Call {
}
}
private int stateFromParcelableCallState(CallState parcelableCallState) {
private int stateFromParcelableCallState(int parcelableCallState) {
switch (parcelableCallState) {
case NEW:
case CallState.NEW:
return STATE_NEW;
case CONNECTING:
case CallState.CONNECTING:
return STATE_CONNECTING;
case PRE_DIAL_WAIT:
case CallState.PRE_DIAL_WAIT:
return STATE_PRE_DIAL_WAIT;
case DIALING:
case CallState.DIALING:
return STATE_DIALING;
case RINGING:
case CallState.RINGING:
return STATE_RINGING;
case ACTIVE:
case CallState.ACTIVE:
return STATE_ACTIVE;
case ON_HOLD:
case CallState.ON_HOLD:
return STATE_HOLDING;
case DISCONNECTED:
case CallState.DISCONNECTED:
return STATE_DISCONNECTED;
case ABORTED:
case CallState.ABORTED:
return STATE_DISCONNECTED;
default:
Log.wtf(this, "Unrecognized CallState %s", parcelableCallState);

View File

@@ -21,22 +21,27 @@ package android.telecomm;
* have the notion of normal transitions, due to the volatile nature of telephony systems, code
* that uses these states should be resilient to unexpected state changes outside of what is
* considered traditional.
*
* {@hide}
*/
public enum CallState {
public final class CallState {
private CallState() {}
/**
* Indicates that a call is new and not connected. This is used as the default state internally
* within Telecomm and should not be used between Telecomm and call services. Call services are
* not expected to ever interact with NEW calls, but {@link InCallService}s will see calls in
* this state.
*/
NEW,
public static final int NEW = 0;
/**
* The initial state of an outgoing {@code Call}.
* Common transitions are to {@link #DIALING} state for a successful call or
* {@link #DISCONNECTED} if it failed.
*/
CONNECTING,
public static final int CONNECTING = 1;
/**
* Indicates that the call is about to go into the outgoing and dialing state but is waiting for
@@ -44,7 +49,7 @@ public enum CallState {
* this is the state where the InCallUI is waiting for the user to select a
* {@link PhoneAccount} to call from.
*/
PRE_DIAL_WAIT,
public static final int PRE_DIAL_WAIT = 2;
/**
* Indicates that a call is outgoing and in the dialing state. A call transitions to this state
@@ -52,7 +57,7 @@ public enum CallState {
* state usually transition to {@link #ACTIVE} if the call was answered or {@link #DISCONNECTED}
* if the call was disconnected somehow (e.g., failure or cancellation of the call by the user).
*/
DIALING,
public static final int DIALING = 3;
/**
* Indicates that a call is incoming and the user still has the option of answering, rejecting,
@@ -60,14 +65,14 @@ public enum CallState {
* ringtone. Normal transitions are to {@link #ACTIVE} if answered or {@link #DISCONNECTED}
* otherwise.
*/
RINGING,
public static final int RINGING = 4;
/**
* Indicates that a call is currently connected to another party and a communication channel is
* open between them. The normal transition to this state is by the user answering a
* {@link #DIALING} call or a {@link #RINGING} call being answered by the other party.
*/
ACTIVE,
public static final int ACTIVE = 5;
/**
* Indicates that the call is currently on hold. In this state, the call is not terminated
@@ -75,7 +80,7 @@ public enum CallState {
* to this state is by the user putting an {@link #ACTIVE} call on hold by explicitly performing
* an action, such as clicking the hold button.
*/
ON_HOLD,
public static final int ON_HOLD = 6;
/**
* Indicates that a call is currently disconnected. All states can transition to this state
@@ -84,12 +89,36 @@ public enum CallState {
* the disconnection or communication was lost to the call service currently responsible for
* this call (e.g., call service crashes).
*/
DISCONNECTED,
public static final int DISCONNECTED = 7;
/**
* Indicates that the call was attempted (mostly in the context of outgoing, at least at the
* time of writing) but cancelled before it was successfully connected.
* @hide
*/
ABORTED;
public static final int ABORTED = 8;
public static String toString(int callState) {
switch (callState) {
case NEW:
return "NEW";
case CONNECTING:
return "CONNECTING";
case PRE_DIAL_WAIT:
return "PRE_DIAL_WAIT";
case DIALING:
return "DIALING";
case RINGING:
return "RINGING";
case ACTIVE:
return "ACTIVE";
case ON_HOLD:
return "ON_HOLD";
case DISCONNECTED:
return "DISCONNECTED";
case ABORTED:
return "ABORTED";
default:
return "UNKNOWN";
}
}
}

View File

@@ -14,7 +14,9 @@
* limitations under the License
*/
package android.telecomm;
parcelable CallCameraCapabilities;
/**
* {@hide}
*/
parcelable CameraCapabilities;

View File

@@ -21,9 +21,8 @@ import android.os.Parcelable;
/**
* Represents the camera capabilities important to a Video Telephony provider.
* TODO: Add camera capabilities as required.
*/
public final class CallCameraCapabilities implements Parcelable {
public final class CameraCapabilities implements Parcelable {
/**
* Whether the camera supports zoom.
@@ -53,7 +52,7 @@ public final class CallCameraCapabilities implements Parcelable {
* @param width The width of the camera video (in pixels).
* @param height The height of the camera video (in pixels).
*/
public CallCameraCapabilities(boolean zoomSupported, float maxZoom, int width, int height) {
public CameraCapabilities(boolean zoomSupported, float maxZoom, int width, int height) {
mZoomSupported = zoomSupported;
mMaxZoom = maxZoom;
mWidth = width;
@@ -63,8 +62,8 @@ public final class CallCameraCapabilities implements Parcelable {
/**
* Responsible for creating CallCameraCapabilities objects from deserialized Parcels.
**/
public static final Parcelable.Creator<CallCameraCapabilities> CREATOR =
new Parcelable.Creator<CallCameraCapabilities> () {
public static final Parcelable.Creator<CameraCapabilities> CREATOR =
new Parcelable.Creator<CameraCapabilities> () {
/**
* Creates a CallCameraCapabilities instances from a parcel.
*
@@ -72,18 +71,18 @@ public final class CallCameraCapabilities implements Parcelable {
* @return The CallCameraCapabilities.
*/
@Override
public CallCameraCapabilities createFromParcel(Parcel source) {
public CameraCapabilities createFromParcel(Parcel source) {
boolean supportsZoom = source.readByte() != 0;
float maxZoom = source.readFloat();
int width = source.readInt();
int height = source.readInt();
return new CallCameraCapabilities(supportsZoom, maxZoom, width, height);
return new CameraCapabilities(supportsZoom, maxZoom, width, height);
}
@Override
public CallCameraCapabilities[] newArray(int size) {
return new CallCameraCapabilities[size];
public CameraCapabilities[] newArray(int size) {
return new CameraCapabilities[size];
}
};

View File

@@ -16,11 +16,20 @@
package android.telecomm;
import com.android.internal.telecomm.IVideoCallback;
import com.android.internal.telecomm.IVideoProvider;
import android.app.PendingIntent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.DisconnectCause;
import android.view.Surface;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -30,6 +39,29 @@ import java.util.concurrent.CopyOnWriteArraySet;
*/
public abstract class Connection {
public static final int STATE_INITIALIZING = 0;
public static final int STATE_NEW = 1;
public static final int STATE_RINGING = 2;
public static final int STATE_DIALING = 3;
public static final int STATE_ACTIVE = 4;
public static final int STATE_HOLDING = 5;
public static final int STATE_DISCONNECTED = 6;
public static final int STATE_FAILED = 7;
public static final int STATE_CANCELED = 8;
// Flag controlling whether PII is emitted into the logs
private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);
private static Connection sNullConnection;
/** @hide */
public abstract static class Listener {
public void onStateChanged(Connection c, int state) {}
@@ -37,15 +69,14 @@ public abstract class Connection {
public void onCallerDisplayNameChanged(
Connection c, String callerDisplayName, int presentation) {}
public void onVideoStateChanged(Connection c, int videoState) {}
public void onSignalChanged(Connection c, Bundle details) {}
public void onDisconnected(Connection c, int cause, String message) {}
public void onPostDialWait(Connection c, String remaining) {}
public void onRequestingRingback(Connection c, boolean ringback) {}
public void onDestroyed(Connection c) {}
public void onCallCapabilitiesChanged(Connection c, int callCapabilities) {}
public void onParentConnectionChanged(Connection c, Connection parent) {}
public void onVideoCallProviderChanged(
Connection c, ConnectionService.VideoCallProvider videoCallProvider) {}
public void onVideoProviderChanged(
Connection c, VideoProvider videoProvider) {}
public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {}
public void onStatusHintsChanged(Connection c, StatusHints statusHints) {}
public void onStartActivityFromInCall(Connection c, PendingIntent intent) {}
@@ -53,19 +84,359 @@ public abstract class Connection {
Connection c, List<Connection> conferenceableConnections) {}
}
public final class State {
private State() {}
public static abstract class VideoProvider {
public static final int INITIALIZING = 0;
public static final int NEW = 1;
public static final int RINGING = 2;
public static final int DIALING = 3;
public static final int ACTIVE = 4;
public static final int HOLDING = 5;
public static final int DISCONNECTED = 6;
public static final int FAILED = 7;
public static final int CANCELED = 8;
/**
* Video is not being received (no protocol pause was issued).
*/
public static final int SESSION_EVENT_RX_PAUSE = 1;
/**
* Video reception has resumed after a SESSION_EVENT_RX_PAUSE.
*/
public static final int SESSION_EVENT_RX_RESUME = 2;
/**
* Video transmission has begun. This occurs after a negotiated start of video transmission
* when the underlying protocol has actually begun transmitting video to the remote party.
*/
public static final int SESSION_EVENT_TX_START = 3;
/**
* Video transmission has stopped. This occurs after a negotiated stop of video transmission
* when the underlying protocol has actually stopped transmitting video to the remote party.
*/
public static final int SESSION_EVENT_TX_STOP = 4;
/**
* A camera failure has occurred for the selected camera. The In-Call UI can use this as a
* cue to inform the user the camera is not available.
*/
public static final int SESSION_EVENT_CAMERA_FAILURE = 5;
/**
* Issued after {@code SESSION_EVENT_CAMERA_FAILURE} when the camera is once again ready for
* operation. The In-Call UI can use this as a cue to inform the user that the camera has
* become available again.
*/
public static final int SESSION_EVENT_CAMERA_READY = 6;
/**
* Session modify request was successful.
*/
public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1;
/**
* Session modify request failed.
*/
public static final int SESSION_MODIFY_REQUEST_FAIL = 2;
/**
* Session modify request ignored due to invalid parameters.
*/
public static final int SESSION_MODIFY_REQUEST_INVALID = 3;
private static final int MSG_SET_VIDEO_LISTENER = 1;
private static final int MSG_SET_CAMERA = 2;
private static final int MSG_SET_PREVIEW_SURFACE = 3;
private static final int MSG_SET_DISPLAY_SURFACE = 4;
private static final int MSG_SET_DEVICE_ORIENTATION = 5;
private static final int MSG_SET_ZOOM = 6;
private static final int MSG_SEND_SESSION_MODIFY_REQUEST = 7;
private static final int MSG_SEND_SESSION_MODIFY_RESPONSE = 8;
private static final int MSG_REQUEST_CAMERA_CAPABILITIES = 9;
private static final int MSG_REQUEST_CALL_DATA_USAGE = 10;
private static final int MSG_SET_PAUSE_IMAGE = 11;
private final VideoProvider.VideoProviderHandler
mMessageHandler = new VideoProvider.VideoProviderHandler();
private final VideoProvider.VideoProviderBinder mBinder;
private IVideoCallback mVideoListener;
/**
* Default handler used to consolidate binder method calls onto a single thread.
*/
private final class VideoProviderHandler extends Handler {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_SET_VIDEO_LISTENER:
mVideoListener = IVideoCallback.Stub.asInterface((IBinder) msg.obj);
break;
case MSG_SET_CAMERA:
onSetCamera((String) msg.obj);
break;
case MSG_SET_PREVIEW_SURFACE:
onSetPreviewSurface((Surface) msg.obj);
break;
case MSG_SET_DISPLAY_SURFACE:
onSetDisplaySurface((Surface) msg.obj);
break;
case MSG_SET_DEVICE_ORIENTATION:
onSetDeviceOrientation(msg.arg1);
break;
case MSG_SET_ZOOM:
onSetZoom((Float) msg.obj);
break;
case MSG_SEND_SESSION_MODIFY_REQUEST:
onSendSessionModifyRequest((VideoProfile) msg.obj);
break;
case MSG_SEND_SESSION_MODIFY_RESPONSE:
onSendSessionModifyResponse((VideoProfile) msg.obj);
break;
case MSG_REQUEST_CAMERA_CAPABILITIES:
onRequestCameraCapabilities();
break;
case MSG_REQUEST_CALL_DATA_USAGE:
onRequestCallDataUsage();
break;
case MSG_SET_PAUSE_IMAGE:
onSetPauseImage((String) msg.obj);
break;
default:
break;
}
}
}
/**
* IVideoProvider stub implementation.
*/
private final class VideoProviderBinder extends IVideoProvider.Stub {
public void setVideoListener(IBinder videoListenerBinder) {
mMessageHandler.obtainMessage(
MSG_SET_VIDEO_LISTENER, videoListenerBinder).sendToTarget();
}
public void setCamera(String cameraId) {
mMessageHandler.obtainMessage(MSG_SET_CAMERA, cameraId).sendToTarget();
}
public void setPreviewSurface(Surface surface) {
mMessageHandler.obtainMessage(MSG_SET_PREVIEW_SURFACE, surface).sendToTarget();
}
public void setDisplaySurface(Surface surface) {
mMessageHandler.obtainMessage(MSG_SET_DISPLAY_SURFACE, surface).sendToTarget();
}
public void setDeviceOrientation(int rotation) {
mMessageHandler.obtainMessage(MSG_SET_DEVICE_ORIENTATION, rotation).sendToTarget();
}
public void setZoom(float value) {
mMessageHandler.obtainMessage(MSG_SET_ZOOM, value).sendToTarget();
}
public void sendSessionModifyRequest(VideoProfile requestProfile) {
mMessageHandler.obtainMessage(
MSG_SEND_SESSION_MODIFY_REQUEST, requestProfile).sendToTarget();
}
public void sendSessionModifyResponse(VideoProfile responseProfile) {
mMessageHandler.obtainMessage(
MSG_SEND_SESSION_MODIFY_RESPONSE, responseProfile).sendToTarget();
}
public void requestCameraCapabilities() {
mMessageHandler.obtainMessage(MSG_REQUEST_CAMERA_CAPABILITIES).sendToTarget();
}
public void requestCallDataUsage() {
mMessageHandler.obtainMessage(MSG_REQUEST_CALL_DATA_USAGE).sendToTarget();
}
public void setPauseImage(String uri) {
mMessageHandler.obtainMessage(MSG_SET_PAUSE_IMAGE, uri).sendToTarget();
}
}
public VideoProvider() {
mBinder = new VideoProvider.VideoProviderBinder();
}
/**
* Returns binder object which can be used across IPC methods.
* @hide
*/
public final IVideoProvider getInterface() {
return mBinder;
}
/**
* Sets the camera to be used for video recording in a video call.
*
* @param cameraId The id of the camera.
*/
public abstract void onSetCamera(String cameraId);
/**
* Sets the surface to be used for displaying a preview of what the user's camera is
* currently capturing. When video transmission is enabled, this is the video signal which
* is sent to the remote device.
*
* @param surface The surface.
*/
public abstract void onSetPreviewSurface(Surface surface);
/**
* Sets the surface to be used for displaying the video received from the remote device.
*
* @param surface The surface.
*/
public abstract void onSetDisplaySurface(Surface surface);
/**
* Sets the device orientation, in degrees. Assumes that a standard portrait orientation of
* the device is 0 degrees.
*
* @param rotation The device orientation, in degrees.
*/
public abstract void onSetDeviceOrientation(int rotation);
/**
* Sets camera zoom ratio.
*
* @param value The camera zoom ratio.
*/
public abstract void onSetZoom(float value);
/**
* Issues a request to modify the properties of the current session. The request is
* sent to the remote device where it it handled by the In-Call UI.
* Some examples of session modification requests: upgrade call from audio to video,
* downgrade call from video to audio, pause video.
*
* @param requestProfile The requested call video properties.
*/
public abstract void onSendSessionModifyRequest(VideoProfile requestProfile);
/**te
* Provides a response to a request to change the current call session video
* properties.
* This is in response to a request the InCall UI has received via the InCall UI.
*
* @param responseProfile The response call video properties.
*/
public abstract void onSendSessionModifyResponse(VideoProfile responseProfile);
/**
* Issues a request to the video provider to retrieve the camera capabilities.
* Camera capabilities are reported back to the caller via the In-Call UI.
*/
public abstract void onRequestCameraCapabilities();
/**
* Issues a request to the video telephony framework to retrieve the cumulative data usage
* for the current call. Data usage is reported back to the caller via the
* InCall UI.
*/
public abstract void onRequestCallDataUsage();
/**
* Provides the video telephony framework with the URI of an image to be displayed to remote
* devices when the video signal is paused.
*
* @param uri URI of image to display.
*/
public abstract void onSetPauseImage(String uri);
/**
* Invokes callback method defined in In-Call UI.
*
* @param videoProfile The requested video call profile.
*/
public void receiveSessionModifyRequest(VideoProfile videoProfile) {
if (mVideoListener != null) {
try {
mVideoListener.receiveSessionModifyRequest(videoProfile);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in In-Call UI.
*
* @param status Status of the session modify request. Valid values are
* {@link VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
* {@link VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
* {@link VideoProvider#SESSION_MODIFY_REQUEST_INVALID}
* @param requestedProfile The original request which was sent to the remote device.
* @param responseProfile The actual profile changes made by the remote device.
*/
public void receiveSessionModifyResponse(int status,
VideoProfile requestedProfile, VideoProfile responseProfile) {
if (mVideoListener != null) {
try {
mVideoListener.receiveSessionModifyResponse(
status, requestedProfile, responseProfile);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in In-Call UI.
*
* Valid values are: {@link VideoProvider#SESSION_EVENT_RX_PAUSE},
* {@link VideoProvider#SESSION_EVENT_RX_RESUME},
* {@link VideoProvider#SESSION_EVENT_TX_START},
* {@link VideoProvider#SESSION_EVENT_TX_STOP}
*
* @param event The event.
*/
public void handleCallSessionEvent(int event) {
if (mVideoListener != null) {
try {
mVideoListener.handleCallSessionEvent(event);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in In-Call UI.
*
* @param width The updated peer video width.
* @param height The updated peer video height.
*/
public void changePeerDimensions(int width, int height) {
if (mVideoListener != null) {
try {
mVideoListener.changePeerDimensions(width, height);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in In-Call UI.
*
* @param dataUsage The updated data usage.
*/
public void changeCallDataUsage(int dataUsage) {
if (mVideoListener != null) {
try {
mVideoListener.changeCallDataUsage(dataUsage);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in In-Call UI.
*
* @param cameraCapabilities The changed camera capabilities.
*/
public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) {
if (mVideoListener != null) {
try {
mVideoListener.changeCameraCapabilities(cameraCapabilities);
} catch (RemoteException ignored) {
}
}
}
}
private final Listener mConnectionDeathListener = new Listener() {
@@ -79,10 +450,14 @@ public abstract class Connection {
private final Set<Listener> mListeners = new CopyOnWriteArraySet<>();
private final List<Connection> mChildConnections = new ArrayList<>();
private final List<Connection> mUnmodifiableChildConnections =
Collections.unmodifiableList(mChildConnections);
private final List<Connection> mConferenceableConnections = new ArrayList<>();
private final List<Connection> mUnmodifiableConferenceableConnections =
Collections.unmodifiableList(mConferenceableConnections);
private int mState = State.NEW;
private CallAudioState mCallAudioState;
private int mState = STATE_NEW;
private AudioState mAudioState;
private Uri mHandle;
private int mHandlePresentation;
private String mCallerDisplayName;
@@ -90,7 +465,7 @@ public abstract class Connection {
private boolean mRequestingRingback = false;
private int mCallCapabilities;
private Connection mParentConnection;
private ConnectionService.VideoCallProvider mVideoCallProvider;
private VideoProvider mVideoProvider;
private boolean mAudioModeIsVoip;
private StatusHints mStatusHints;
private int mVideoState;
@@ -111,7 +486,7 @@ public abstract class Connection {
}
/**
* @return The {@link CallPropertyPresentation} which controls how the handle is shown.
* @return The {@link PropertyPresentation} which controls how the handle is shown.
*/
public final int getHandlePresentation() {
return mHandlePresentation;
@@ -125,7 +500,7 @@ public abstract class Connection {
}
/**
* @return The {@link CallPropertyPresentation} which controls how the caller display name is
* @return The {@link PropertyPresentation} which controls how the caller display name is
* shown.
*/
public final int getCallerDisplayNamePresentation() {
@@ -141,10 +516,10 @@ public abstract class Connection {
/**
* Returns the video state of the call.
* Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
* {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
* {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED},
* {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}.
* Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
* {@link VideoProfile.VideoState#BIDIRECTIONAL},
* {@link VideoProfile.VideoState#TX_ENABLED},
* {@link VideoProfile.VideoState#RX_ENABLED}.
*
* @return The video state of the call.
*/
@@ -157,8 +532,8 @@ public abstract class Connection {
* being routed by the system. This is {@code null} if this Connection
* does not directly know about its audio state.
*/
public final CallAudioState getCallAudioState() {
return mCallAudioState;
public final AudioState getAudioState() {
return mAudioState;
}
/**
@@ -236,36 +611,36 @@ public abstract class Connection {
* @param state The new audio state.
* @hide
*/
final void setAudioState(CallAudioState state) {
final void setAudioState(AudioState state) {
Log.d(this, "setAudioState %s", state);
mCallAudioState = state;
mAudioState = state;
onSetAudioState(state);
}
/**
* @param state An integer value from {@link State}.
* @param state An integer value of a {@code STATE_*} constant.
* @return A string representation of the value.
*/
public static String stateToString(int state) {
switch (state) {
case State.INITIALIZING:
return "INITIALIZING";
case State.NEW:
return "NEW";
case State.RINGING:
return "RINGING";
case State.DIALING:
return "DIALING";
case State.ACTIVE:
return "ACTIVE";
case State.HOLDING:
return "HOLDING";
case State.DISCONNECTED:
case STATE_INITIALIZING:
return "STATE_INITIALIZING";
case STATE_NEW:
return "STATE_NEW";
case STATE_RINGING:
return "STATE_RINGING";
case STATE_DIALING:
return "STATE_DIALING";
case STATE_ACTIVE:
return "STATE_ACTIVE";
case STATE_HOLDING:
return "STATE_HOLDING";
case STATE_DISCONNECTED:
return "DISCONNECTED";
case State.FAILED:
return "FAILED";
case State.CANCELED:
return "CANCELED";
case STATE_FAILED:
return "STATE_FAILED";
case STATE_CANCELED:
return "STATE_CANCELED";
default:
Log.wtf(Connection.class, "Unknown state %d", state);
return "UNKNOWN";
@@ -297,11 +672,11 @@ public abstract class Connection {
}
public final List<Connection> getChildConnections() {
return mChildConnections;
return mUnmodifiableChildConnections;
}
/**
* Returns the connection's {@link CallCapabilities}
* Returns the connection's {@link PhoneCapabilities}
*/
public final int getCallCapabilities() {
return mCallCapabilities;
@@ -311,7 +686,7 @@ public abstract class Connection {
* Sets the value of the {@link #getHandle()} property.
*
* @param handle The new handle.
* @param presentation The {@link CallPropertyPresentation} which controls how the handle is
* @param presentation The {@link PropertyPresentation} which controls how the handle is
* shown.
*/
public final void setHandle(Uri handle, int presentation) {
@@ -327,7 +702,7 @@ public abstract class Connection {
* Sets the caller display name (CNAP).
*
* @param callerDisplayName The new display name.
* @param presentation The {@link CallPropertyPresentation} which controls how the name is
* @param presentation The {@link PropertyPresentation} which controls how the name is
* shown.
*/
public final void setCallerDisplayName(String callerDisplayName, int presentation) {
@@ -345,17 +720,17 @@ public abstract class Connection {
*/
public final void setCanceled() {
Log.d(this, "setCanceled");
setState(State.CANCELED);
setState(STATE_CANCELED);
}
/**
* Move the {@link Connection} to the {@link State#FAILED} state, with the given code
* Move the {@link Connection} to the {@link #STATE_FAILED} state, with the given code
* ({@see DisconnectCause}) and message. This message is not shown to the user, but is useful
* for logging and debugging purposes.
* <p>
* After calling this, the {@link Connection} will not be used.
*
* @param code The {@link android.telephony.DisconnectCause} indicating why the connection
* @param code The {@link DisconnectCause} indicating why the connection
* failed.
* @param message A message explaining why the {@link Connection} failed.
*/
@@ -363,15 +738,15 @@ public abstract class Connection {
Log.d(this, "setFailed (%d: %s)", code, message);
mFailureCode = code;
mFailureMessage = message;
setState(State.FAILED);
setState(STATE_FAILED);
}
/**
* Set the video state for the connection.
* Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
* {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
* {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED},
* {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}.
* Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
* {@link VideoProfile.VideoState#BIDIRECTIONAL},
* {@link VideoProfile.VideoState#TX_ENABLED},
* {@link VideoProfile.VideoState#RX_ENABLED}.
*
* @param videoState The new video state.
*/
@@ -389,68 +764,68 @@ public abstract class Connection {
*/
public final void setActive() {
setRequestingRingback(false);
setState(State.ACTIVE);
setState(STATE_ACTIVE);
}
/**
* Sets state to ringing (e.g., an inbound ringing call).
*/
public final void setRinging() {
setState(State.RINGING);
setState(STATE_RINGING);
}
/**
* Sets state to initializing (this Connection is not yet ready to be used).
*/
public final void setInitializing() {
setState(State.INITIALIZING);
setState(STATE_INITIALIZING);
}
/**
* Sets state to initialized (the Connection has been set up and is now ready to be used).
*/
public final void setInitialized() {
setState(State.NEW);
setState(STATE_NEW);
}
/**
* Sets state to dialing (e.g., dialing an outbound call).
*/
public final void setDialing() {
setState(State.DIALING);
setState(STATE_DIALING);
}
/**
* Sets state to be on hold.
*/
public final void setOnHold() {
setState(State.HOLDING);
setState(STATE_HOLDING);
}
/**
* Sets the video call provider.
* @param videoCallProvider The video call provider.
* @param videoProvider The video provider.
*/
public final void setVideoCallProvider(ConnectionService.VideoCallProvider videoCallProvider) {
mVideoCallProvider = videoCallProvider;
public final void setVideoProvider(VideoProvider videoProvider) {
mVideoProvider = videoProvider;
for (Listener l : mListeners) {
l.onVideoCallProviderChanged(this, videoCallProvider);
l.onVideoProviderChanged(this, videoProvider);
}
}
public final ConnectionService.VideoCallProvider getVideoCallProvider() {
return mVideoCallProvider;
public final VideoProvider getVideoProvider() {
return mVideoProvider;
}
/**
* Sets state to disconnected.
*
* @param cause The reason for the disconnection, any of
* {@link android.telephony.DisconnectCause}.
* {@link DisconnectCause}.
* @param message Optional call-service-provided message about the disconnect.
*/
public final void setDisconnected(int cause, String message) {
setState(State.DISCONNECTED);
setState(STATE_DISCONNECTED);
Log.d(this, "Disconnected with cause %d message %s", cause, message);
for (Listener l : mListeners) {
l.onDisconnected(this, cause, message);
@@ -482,7 +857,7 @@ public abstract class Connection {
}
/**
* Sets the connection's {@link CallCapabilities}.
* Sets the connection's {@link PhoneCapabilities}.
*
* @param callCapabilities The new call capabilities.
*/
@@ -509,17 +884,6 @@ public abstract class Connection {
}
}
/**
* Sets the current signal levels for the underlying data transport.
*
* @param details A {@link android.os.Bundle} containing details of the current level.
*/
public final void setSignal(Bundle details) {
for (Listener l : mListeners) {
l.onSignalChanged(this, details);
}
}
/**
* Requests that the framework use VOIP audio mode for this connection.
*
@@ -562,6 +926,13 @@ public abstract class Connection {
fireOnConferenceableConnectionsChanged();
}
/**
* Obtains the connections with which this connection can be conferenced.
*/
public final List<Connection> getConferenceableConnections() {
return mUnmodifiableConferenceableConnections;
}
/**
* Launches an activity for this connection on top of the in-call UI.
*
@@ -577,17 +948,17 @@ public abstract class Connection {
}
/**
* Notifies this Connection that the {@link #getCallAudioState()} property has a new value.
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
*
* @param state The new call audio state.
*/
public void onSetAudioState(CallAudioState state) {}
public void onSetAudioState(AudioState state) {}
/**
* Notifies this Connection of an internal state change. This method is called after the
* state is changed.
*
* @param state The new state, a {@link Connection.State} member.
* @param state The new state, one of the {@code STATE_*} constants.
*/
public void onSetState(int state) {}
@@ -629,7 +1000,7 @@ public abstract class Connection {
public void onUnhold() {}
/**
* Notifies this Connection, which is in {@link State#RINGING}, of
* Notifies this Connection, which is in {@link #STATE_RINGING}, of
* a request to accept.
*
* @param videoState The video state in which to answer the call.
@@ -637,7 +1008,7 @@ public abstract class Connection {
public void onAnswer(int videoState) {}
/**
* Notifies this Connection, which is in {@link State#RINGING}, of
* Notifies this Connection, which is in {@link #STATE_RINGING}, of
* a request to reject.
*/
public void onReject() {}
@@ -647,12 +1018,6 @@ public abstract class Connection {
*/
public void onPostDialContinue(boolean proceed) {}
/**
* Swap this call with a background call. This is used for calls that don't support hold,
* e.g. CDMA.
*/
public void onSwapWithBackgroundCall() {}
/**
* TODO: Needs documentation.
*/
@@ -673,6 +1038,38 @@ public abstract class Connection {
*/
public void onConferenceWith(Connection otherConnection) {}
static String toLogSafePhoneNumber(String number) {
// For unknown number, log empty string.
if (number == null) {
return "";
}
if (PII_DEBUG) {
// When PII_DEBUG is true we emit PII.
return number;
}
// Do exactly same thing as Uri#toSafeString() does, which will enable us to compare
// sanitized phone numbers.
StringBuilder builder = new StringBuilder();
for (int i = 0; i < number.length(); i++) {
char c = number.charAt(i);
if (c == '-' || c == '@' || c == '.') {
builder.append(c);
} else {
builder.append('x');
}
}
return builder.toString();
}
static synchronized Connection getNullConnection() {
if (sNullConnection == null) {
sNullConnection = new Connection() {};
}
return sNullConnection;
}
private void addChild(Connection connection) {
Log.d(this, "adding child %s", connection);
mChildConnections.add(connection);
@@ -686,7 +1083,7 @@ public abstract class Connection {
}
private void setState(int state) {
if (mState == State.FAILED || mState == State.CANCELED) {
if (mState == STATE_FAILED || mState == STATE_CANCELED) {
Log.d(this, "Connection already %s; cannot transition out of this state.",
stateToString(mState));
return;
@@ -711,7 +1108,7 @@ public abstract class Connection {
* @param message A reason for why the connection failed (not intended to be shown to the user).
* @return A {@link Connection} which indicates failure.
*/
public static Connection getFailedConnection(final int code, final String message) {
public static Connection createFailedConnection(final int code, final String message) {
return new Connection() {{
setFailed(code, message);
}};
@@ -723,13 +1120,13 @@ public abstract class Connection {
/**
* Return a {@link Connection} which represents a canceled a connection attempt. The returned
* {@link Connection} will have state {@link State#CANCELED}, and cannot be moved out of that
* {@link Connection} will have state {@link #STATE_CANCELED}, and cannot be moved out of that
* state. This connection should not be used for anything, and no other {@link Connection}s
* should be attempted.
*
* @return A {@link Connection} which indicates that the underlying call should be canceled.
*/
public static Connection getCanceledConnection() {
public static Connection createCanceledConnection() {
return CANCELED_CONNECTION;
}

View File

@@ -16,4 +16,7 @@
package android.telecomm;
/**
* {@hide}
*/
parcelable ConnectionRequest;

View File

@@ -20,8 +20,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.ResultReceiver;
import android.telephony.DisconnectCause;
/**
* Simple data container encapsulating a request to some entity to
@@ -30,10 +28,7 @@ import android.telephony.DisconnectCause;
public final class ConnectionRequest implements Parcelable {
// TODO: Token to limit recursive invocations
// TODO: Consider upgrading "mHandle" to ordered list of handles, indicating a set of phone
// numbers that would satisfy the client's needs, in order of preference
private final PhoneAccountHandle mAccountHandle;
private final String mCallId;
private final Uri mHandle;
private final int mHandlePresentation;
private final Bundle mExtras;
@@ -41,22 +36,19 @@ public final class ConnectionRequest implements Parcelable {
/**
* @param accountHandle The accountHandle which should be used to place the call.
* @param callId An identifier for this call.
* @param handle The handle (e.g., phone number) to which the {@link Connection} is to connect.
* @param handlePresentation The {@link CallPropertyPresentation} which controls how the handle
* @param handlePresentation The {@link PropertyPresentation} which controls how the handle
* is shown.
* @param extras Application-specific extra data.
* @param videoState Determines the video state for the connection.
*/
public ConnectionRequest(
PhoneAccountHandle accountHandle,
String callId,
Uri handle,
int handlePresentation,
Bundle extras,
int videoState) {
mAccountHandle = accountHandle;
mCallId = callId;
mHandle = handle;
mHandlePresentation = handlePresentation;
mExtras = extras;
@@ -65,7 +57,6 @@ public final class ConnectionRequest implements Parcelable {
private ConnectionRequest(Parcel in) {
mAccountHandle = in.readParcelable(getClass().getClassLoader());
mCallId = in.readString();
mHandle = in.readParcelable(getClass().getClassLoader());
mHandlePresentation = in.readInt();
mExtras = in.readParcelable(getClass().getClassLoader());
@@ -77,18 +68,13 @@ public final class ConnectionRequest implements Parcelable {
*/
public PhoneAccountHandle getAccountHandle() { return mAccountHandle; }
/**
* An identifier for this call.
*/
public String getCallId() { return mCallId; }
/**
* The handle (e.g., phone number) to which the {@link Connection} is to connect.
*/
public Uri getHandle() { return mHandle; }
/**
* The {@link CallPropertyPresentation} which controls how the handle is shown.
* The {@link PropertyPresentation} which controls how the handle is shown.
*/
public int getHandlePresentation() { return mHandlePresentation; }
@@ -100,11 +86,11 @@ public final class ConnectionRequest implements Parcelable {
public Bundle getExtras() { return mExtras; }
/**
* Determines the video state for the connection.
* Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY},
* {@link VideoCallProfile.VideoState#BIDIRECTIONAL},
* {@link VideoCallProfile.VideoState#TX_ENABLED},
* {@link VideoCallProfile.VideoState#RX_ENABLED}.
* Describes the video states supported by the client requesting the connection.
* Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
* {@link VideoProfile.VideoState#BIDIRECTIONAL},
* {@link VideoProfile.VideoState#TX_ENABLED},
* {@link VideoProfile.VideoState#RX_ENABLED}.
*
* @return The video state for the connection.
*/
@@ -114,10 +100,10 @@ public final class ConnectionRequest implements Parcelable {
@Override
public String toString() {
return String.format("PhoneConnectionRequest %s %s",
return String.format("ConnectionRequest %s %s",
mHandle == null
? Uri.EMPTY
: ConnectionService.toLogSafePhoneNumber(mHandle.toString()),
: Connection.toLogSafePhoneNumber(mHandle.toString()),
mExtras == null ? "" : mExtras);
}
@@ -144,7 +130,6 @@ public final class ConnectionRequest implements Parcelable {
@Override
public void writeToParcel(Parcel destination, int flags) {
destination.writeParcelable(mAccountHandle, 0);
destination.writeString(mCallId);
destination.writeParcelable(mHandle, 0);
destination.writeInt(mHandlePresentation);
destination.writeParcelable(mExtras, 0);

View File

@@ -17,26 +17,20 @@
package android.telecomm;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.telephony.DisconnectCause;
import android.os.RemoteException;
import android.view.Surface;
import com.android.internal.os.SomeArgs;
import com.android.internal.telecomm.IConnectionService;
import com.android.internal.telecomm.IConnectionServiceAdapter;
import com.android.internal.telecomm.IVideoCallCallback;
import com.android.internal.telecomm.IVideoCallProvider;
import com.android.internal.telecomm.RemoteServiceCallback;
import java.util.ArrayList;
@@ -51,10 +45,11 @@ import java.util.Map;
* Android device.
*/
public abstract class ConnectionService extends Service {
/**
* The {@link Intent} that must be declared as handled by the service.
*/
@SdkConstant(SdkConstantType.SERVICE_ACTION)
@SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
public static final String SERVICE_INTERFACE = "android.telecomm.ConnectionService";
// Flag controlling whether PII is emitted into the logs
@@ -73,12 +68,9 @@ public abstract class ConnectionService extends Service {
private static final int MSG_STOP_DTMF_TONE = 11;
private static final int MSG_CONFERENCE = 12;
private static final int MSG_SPLIT_FROM_CONFERENCE = 13;
private static final int MSG_SWAP_WITH_BACKGROUND_CALL = 14;
private static final int MSG_ON_POST_DIAL_CONTINUE = 15;
private static final int MSG_ON_PHONE_ACCOUNT_CLICKED = 16;
private static final int MSG_REMOVE_CONNECTION_SERVICE_ADAPTER = 17;
private static Connection sNullConnection;
private static final int MSG_ON_POST_DIAL_CONTINUE = 14;
private static final int MSG_ON_PHONE_ACCOUNT_CLICKED = 15;
private static final int MSG_REMOVE_CONNECTION_SERVICE_ADAPTER = 16;
private final Map<String, Connection> mConnectionById = new HashMap<>();
private final Map<Connection, String> mIdByConnection = new HashMap<>();
@@ -88,37 +80,6 @@ public abstract class ConnectionService extends Service {
private final List<Runnable> mPreInitializationConnectionRequests = new ArrayList<>();
private final ConnectionServiceAdapter mAdapter = new ConnectionServiceAdapter();
/**
* A callback for providing the result of creating a connection.
*/
public interface CreateConnectionResponse<CONNECTION> {
/**
* Tells Telecomm that an attempt to create the connection succeeded.
*
* @param request The original request.
* @param connection The connection.
*/
void onSuccess(ConnectionRequest request, CONNECTION connection);
/**
* Tells Telecomm that an attempt to create the connection failed. Telecomm will try a
* different service until a service cancels the process or completes it successfully.
*
* @param request The original request.
* @param code An integer code indicating the reason for failure.
* @param msg A message explaining the reason for failure.
*/
void onFailure(ConnectionRequest request, int code, String msg);
/**
* Tells Telecomm to cancel creating the connection. Telecomm will stop trying to create
* the connection an no more services will be tried.
*
* @param request The original request.
*/
void onCancel(ConnectionRequest request);
}
private final IBinder mBinder = new IConnectionService.Stub() {
@Override
public void addConnectionServiceAdapter(IConnectionServiceAdapter adapter) {
@@ -132,11 +93,13 @@ public abstract class ConnectionService extends Service {
@Override
public void createConnection(
PhoneAccountHandle connectionManagerPhoneAccount,
String id,
ConnectionRequest request,
boolean isIncoming) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = connectionManagerPhoneAccount;
args.arg2 = request;
args.arg2 = id;
args.arg3 = request;
args.argi1 = isIncoming ? 1 : 0;
mHandler.obtainMessage(MSG_CREATE_CONNECTION, args).sendToTarget();
}
@@ -175,7 +138,7 @@ public abstract class ConnectionService extends Service {
}
@Override
public void onAudioStateChanged(String callId, CallAudioState audioState) {
public void onAudioStateChanged(String callId, AudioState audioState) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = audioState;
@@ -205,11 +168,6 @@ public abstract class ConnectionService extends Service {
mHandler.obtainMessage(MSG_SPLIT_FROM_CONFERENCE, callId).sendToTarget();
}
@Override
public void swapWithBackgroundCall(String callId) {
mHandler.obtainMessage(MSG_SWAP_WITH_BACKGROUND_CALL, callId).sendToTarget();
}
@Override
public void onPostDialContinue(String callId, boolean proceed) {
SomeArgs args = SomeArgs.obtain();
@@ -240,22 +198,27 @@ public abstract class ConnectionService extends Service {
try {
final PhoneAccountHandle connectionManagerPhoneAccount =
(PhoneAccountHandle) args.arg1;
final ConnectionRequest request = (ConnectionRequest) args.arg2;
final String id = (String) args.arg2;
final ConnectionRequest request = (ConnectionRequest) args.arg3;
final boolean isIncoming = args.argi1 == 1;
if (!mAreAccountsInitialized) {
Log.d(this, "Enqueueing pre-init request %s", request.getCallId());
Log.d(this, "Enqueueing pre-init request %s", id);
mPreInitializationConnectionRequests.add(new Runnable() {
@Override
public void run() {
createConnection(
connectionManagerPhoneAccount,
id,
request,
isIncoming);
}
});
} else {
Log.d(this, "Immediately processing request %s", request.getCallId());
createConnection(connectionManagerPhoneAccount, request, isIncoming);
createConnection(
connectionManagerPhoneAccount,
id,
request,
isIncoming);
}
} finally {
args.recycle();
@@ -292,7 +255,7 @@ public abstract class ConnectionService extends Service {
SomeArgs args = (SomeArgs) msg.obj;
try {
String callId = (String) args.arg1;
CallAudioState audioState = (CallAudioState) args.arg2;
AudioState audioState = (AudioState) args.arg2;
onAudioStateChanged(callId, audioState);
} finally {
args.recycle();
@@ -319,9 +282,6 @@ public abstract class ConnectionService extends Service {
case MSG_SPLIT_FROM_CONFERENCE:
splitFromConference((String) msg.obj);
break;
case MSG_SWAP_WITH_BACKGROUND_CALL:
swapWithBackgroundCall((String) msg.obj);
break;
case MSG_ON_POST_DIAL_CONTINUE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
@@ -348,22 +308,22 @@ public abstract class ConnectionService extends Service {
String id = mIdByConnection.get(c);
Log.d(this, "Adapter set state %s %s", id, Connection.stateToString(state));
switch (state) {
case Connection.State.ACTIVE:
case Connection.STATE_ACTIVE:
mAdapter.setActive(id);
break;
case Connection.State.DIALING:
case Connection.STATE_DIALING:
mAdapter.setDialing(id);
break;
case Connection.State.DISCONNECTED:
case Connection.STATE_DISCONNECTED:
// Handled in onDisconnected()
break;
case Connection.State.HOLDING:
case Connection.STATE_HOLDING:
mAdapter.setOnHold(id);
break;
case Connection.State.NEW:
case Connection.STATE_NEW:
// Nothing to tell Telecomm
break;
case Connection.State.RINGING:
case Connection.STATE_RINGING:
mAdapter.setRinging(id);
break;
}
@@ -396,11 +356,6 @@ public abstract class ConnectionService extends Service {
mAdapter.setCallerDisplayName(id, callerDisplayName, presentation);
}
@Override
public void onSignalChanged(Connection c, Bundle details) {
// TODO: Unsupported yet
}
@Override
public void onDestroyed(Connection c) {
removeConnection(c);
@@ -421,11 +376,11 @@ public abstract class ConnectionService extends Service {
}
@Override
public void onCallCapabilitiesChanged(Connection c, int callCapabilities) {
public void onCallCapabilitiesChanged(Connection c, int capabilities) {
String id = mIdByConnection.get(c);
Log.d(this, "call capabilities: parcelableconnection: %s",
CallCapabilities.toString(callCapabilities));
mAdapter.setCallCapabilities(id, callCapabilities);
Log.d(this, "capabilities: parcelableconnection: %s",
PhoneCapabilities.toString(capabilities));
mAdapter.setCallCapabilities(id, capabilities);
}
@Override
@@ -436,9 +391,9 @@ public abstract class ConnectionService extends Service {
}
@Override
public void onVideoCallProviderChanged(Connection c, VideoCallProvider videoCallProvider) {
public void onVideoProviderChanged(Connection c, Connection.VideoProvider videoProvider) {
String id = mIdByConnection.get(c);
mAdapter.setVideoCallProvider(id, videoCallProvider);
mAdapter.setVideoProvider(id, videoProvider);
}
@Override
@@ -487,6 +442,7 @@ public abstract class ConnectionService extends Service {
*/
private void createConnection(
final PhoneAccountHandle callManagerAccount,
final String callId,
final ConnectionRequest request,
boolean isIncoming) {
Log.d(this, "call %s", request);
@@ -499,64 +455,79 @@ public abstract class ConnectionService extends Service {
}
if (createdConnection != null) {
if (createdConnection.getState() == Connection.State.INITIALIZING) {
Log.d(this, "adapter handleCreateConnectionSuccessful %s", callId);
if (createdConnection.getState() == Connection.STATE_INITIALIZING) {
// Wait for the connection to become initialized.
createdConnection.addConnectionListener(new Connection.Listener() {
@Override
public void onStateChanged(Connection c, int state) {
switch (state) {
case Connection.State.FAILED:
case Connection.STATE_FAILED:
Log.d(this, "Connection (%s) failed (%d: %s)", request,
c.getFailureCode(), c.getFailureMessage());
Log.d(this, "adapter handleCreateConnectionFailed %s",
request.getCallId());
mAdapter.handleCreateConnectionFailed(request, c.getFailureCode(),
callId);
mAdapter.handleCreateConnectionFailed(
callId,
request,
c.getFailureCode(),
c.getFailureMessage());
break;
case Connection.State.CANCELED:
case Connection.STATE_CANCELED:
Log.d(this, "adapter handleCreateConnectionCanceled %s",
request.getCallId());
mAdapter.handleCreateConnectionCancelled(request);
callId);
mAdapter.handleCreateConnectionCancelled(callId, request);
break;
case Connection.State.INITIALIZING:
Log.d(this, "State changed to INITIALIZING; ignoring");
case Connection.STATE_INITIALIZING:
Log.d(this, "State changed to STATE_INITIALIZING; ignoring");
return; // Don't want to stop listening on this state transition.
default:
Log.d(this, "Connection created in state %s",
Connection.stateToString(state));
connectionCreated(request, createdConnection);
connectionCreated(callId, request, createdConnection);
break;
}
c.removeConnectionListener(this);
}
});
} else if (createdConnection.getState() == Connection.State.CANCELED) {
} else if (createdConnection.getState() == Connection.STATE_CANCELED) {
// Tell telecomm not to attempt any more services.
mAdapter.handleCreateConnectionCancelled(request);
} else if (createdConnection.getState() == Connection.State.FAILED) {
mAdapter.handleCreateConnectionFailed(request, createdConnection.getFailureCode(),
mAdapter.handleCreateConnectionCancelled(callId, request);
} else if (createdConnection.getState() == Connection.STATE_FAILED) {
mAdapter.handleCreateConnectionFailed(
callId,
request,
createdConnection.getFailureCode(),
createdConnection.getFailureMessage());
} else {
connectionCreated(request, createdConnection);
connectionCreated(callId, request, createdConnection);
}
} else {
// Tell telecomm to try a different service.
Log.d(this, "adapter handleCreateConnectionFailed %s", request.getCallId());
mAdapter.handleCreateConnectionFailed(request, DisconnectCause.ERROR_UNSPECIFIED, null);
Log.d(this, "adapter handleCreateConnectionFailed %s", callId);
mAdapter.handleCreateConnectionFailed(
callId,
request,
DisconnectCause.ERROR_UNSPECIFIED,
null);
}
}
private void connectionCreated(ConnectionRequest request, Connection connection) {
addConnection(request.getCallId(), connection);
private void connectionCreated(
String callId,
ConnectionRequest request,
Connection connection) {
addConnection(callId, connection);
Uri handle = connection.getHandle();
String number = handle == null ? "null" : handle.getSchemeSpecificPart();
Log.v(this, "connectionCreated, parcelableconnection: %s, %d, %s",
toLogSafePhoneNumber(number),
Connection.toLogSafePhoneNumber(number),
connection.getState(),
CallCapabilities.toString(connection.getCallCapabilities()));
PhoneCapabilities.toString(connection.getCallCapabilities()));
Log.d(this, "adapter handleCreateConnectionSuccessful %s", request.getCallId());
Log.d(this, "adapter handleCreateConnectionSuccessful %s", callId);
mAdapter.handleCreateConnectionSuccessful(
callId,
request,
new ParcelableConnection(
request.getAccountHandle(),
@@ -566,8 +537,8 @@ public abstract class ConnectionService extends Service {
connection.getHandlePresentation(),
connection.getCallerDisplayName(),
connection.getCallerDisplayNamePresentation(),
connection.getVideoCallProvider() == null ?
null : connection.getVideoCallProvider().getInterface(),
connection.getVideoProvider() == null ?
null : connection.getVideoProvider().getInterface(),
connection.getVideoState()));
}
@@ -601,7 +572,7 @@ public abstract class ConnectionService extends Service {
findConnectionForAction(callId, "unhold").onUnhold();
}
private void onAudioStateChanged(String callId, CallAudioState audioState) {
private void onAudioStateChanged(String callId, AudioState audioState) {
Log.d(this, "onAudioStateChanged %s %s", callId, audioState);
findConnectionForAction(callId, "onAudioStateChanged").setAudioState(audioState);
}
@@ -620,7 +591,7 @@ public abstract class ConnectionService extends Service {
Log.d(this, "conference %s, %s", conferenceCallId, callId);
Connection connection = findConnectionForAction(callId, "conference");
if (connection == getNullConnection()) {
if (connection == Connection.getNullConnection()) {
Log.w(this, "Connection missing in conference request %s.", callId);
return;
}
@@ -653,7 +624,7 @@ public abstract class ConnectionService extends Service {
Log.d(this, "splitFromConference(%s)", callId);
Connection connection = findConnectionForAction(callId, "splitFromConference");
if (connection == getNullConnection()) {
if (connection == Connection.getNullConnection()) {
Log.w(this, "Connection missing in conference request %s.", callId);
return;
}
@@ -661,11 +632,6 @@ public abstract class ConnectionService extends Service {
// TODO: Find existing conference call and invoke split(connection).
}
private void swapWithBackgroundCall(String callId) {
Log.d(this, "swapWithBackgroundCall(%s)", callId);
findConnectionForAction(callId, "swapWithBackgroundCall").onSwapWithBackgroundCall();
}
private void onPostDialContinue(String callId, boolean proceed) {
Log.d(this, "onPostDialContinue(%s)", callId);
findConnectionForAction(callId, "stopDtmfTone").onPostDialContinue(proceed);
@@ -792,7 +758,7 @@ public abstract class ConnectionService extends Service {
* making the connection.
* @param request Details about the outgoing call.
* @return The {@code Connection} object to satisfy this call, or the result of an invocation
* of {@link Connection#getFailedConnection(int, String)} to not handle the call.
* of {@link Connection#createFailedConnection(int, String)} to not handle the call.
*/
public Connection onCreateOutgoingConnection(
PhoneAccountHandle connectionManagerPhoneAccount,
@@ -805,6 +771,9 @@ public abstract class ConnectionService extends Service {
* specified connection into a conference call. The specified connection can be any connection
* which had previously specified itself as conference-capable including both simple connections
* and connections previously returned from this method.
* <p>
* TODO: To be refactored out with conference call re-engineering<br/>
* TODO: Also remove class {@link Response} once this method is removed
*
* @param connection The connection from which the user opted to start a conference call.
* @param token The token to be passed into the response callback.
@@ -829,31 +798,6 @@ public abstract class ConnectionService extends Service {
*/
public void onConnectionRemoved(Connection connection) {}
static String toLogSafePhoneNumber(String number) {
// For unknown number, log empty string.
if (number == null) {
return "";
}
if (PII_DEBUG) {
// When PII_DEBUG is true we emit PII.
return number;
}
// Do exactly same thing as Uri#toSafeString() does, which will enable us to compare
// sanitized phone numbers.
StringBuilder builder = new StringBuilder();
for (int i = 0; i < number.length(); i++) {
char c = number.charAt(i);
if (c == '-' || c == '@' || c == '.') {
builder.append(c);
} else {
builder.append('x');
}
}
return builder.toString();
}
private void onAccountsInitialized() {
mAreAccountsInitialized = true;
for (Runnable r : mPreInitializationConnectionRequests) {
@@ -883,346 +827,7 @@ public abstract class ConnectionService extends Service {
return mConnectionById.get(callId);
}
Log.w(this, "%s - Cannot find Connection %s", action, callId);
return getNullConnection();
return Connection.getNullConnection();
}
private final static synchronized Connection getNullConnection() {
if (sNullConnection == null) {
sNullConnection = new Connection() {};
}
return sNullConnection;
}
/**
* Abstraction for a class which provides video call functionality. This class contains no base
* implementation for its methods. It is expected that subclasses will override these
* functions to provide the desired behavior if it is supported.
*/
public static abstract class VideoCallProvider {
private static final int MSG_SET_VIDEO_CALL_LISTENER = 1;
private static final int MSG_SET_CAMERA = 2;
private static final int MSG_SET_PREVIEW_SURFACE = 3;
private static final int MSG_SET_DISPLAY_SURFACE = 4;
private static final int MSG_SET_DEVICE_ORIENTATION = 5;
private static final int MSG_SET_ZOOM = 6;
private static final int MSG_SEND_SESSION_MODIFY_REQUEST = 7;
private static final int MSG_SEND_SESSION_MODIFY_RESPONSE = 8;
private static final int MSG_REQUEST_CAMERA_CAPABILITIES = 9;
private static final int MSG_REQUEST_CALL_DATA_USAGE = 10;
private static final int MSG_SET_PAUSE_IMAGE = 11;
private final VideoCallProviderHandler mMessageHandler = new VideoCallProviderHandler();
private final VideoCallProviderBinder mBinder;
private IVideoCallCallback mVideoCallListener;
/**
* Default handler used to consolidate binder method calls onto a single thread.
*/
private final class VideoCallProviderHandler extends Handler {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_SET_VIDEO_CALL_LISTENER:
mVideoCallListener = IVideoCallCallback.Stub.asInterface((IBinder) msg.obj);
break;
case MSG_SET_CAMERA:
onSetCamera((String) msg.obj);
break;
case MSG_SET_PREVIEW_SURFACE:
onSetPreviewSurface((Surface) msg.obj);
break;
case MSG_SET_DISPLAY_SURFACE:
onSetDisplaySurface((Surface) msg.obj);
break;
case MSG_SET_DEVICE_ORIENTATION:
onSetDeviceOrientation(msg.arg1);
break;
case MSG_SET_ZOOM:
onSetZoom((Float) msg.obj);
break;
case MSG_SEND_SESSION_MODIFY_REQUEST:
onSendSessionModifyRequest((VideoCallProfile) msg.obj);
break;
case MSG_SEND_SESSION_MODIFY_RESPONSE:
onSendSessionModifyResponse((VideoCallProfile) msg.obj);
break;
case MSG_REQUEST_CAMERA_CAPABILITIES:
onRequestCameraCapabilities();
break;
case MSG_REQUEST_CALL_DATA_USAGE:
onRequestCallDataUsage();
break;
case MSG_SET_PAUSE_IMAGE:
onSetPauseImage((String) msg.obj);
break;
default:
break;
}
}
}
/**
* IVideoCallProvider stub implementation.
*/
private final class VideoCallProviderBinder extends IVideoCallProvider.Stub {
public void setVideoCallListener(IBinder videoCallListenerBinder) {
mMessageHandler.obtainMessage(
MSG_SET_VIDEO_CALL_LISTENER, videoCallListenerBinder).sendToTarget();
}
public void setCamera(String cameraId) {
mMessageHandler.obtainMessage(MSG_SET_CAMERA, cameraId).sendToTarget();
}
public void setPreviewSurface(Surface surface) {
mMessageHandler.obtainMessage(MSG_SET_PREVIEW_SURFACE, surface).sendToTarget();
}
public void setDisplaySurface(Surface surface) {
mMessageHandler.obtainMessage(MSG_SET_DISPLAY_SURFACE, surface).sendToTarget();
}
public void setDeviceOrientation(int rotation) {
mMessageHandler.obtainMessage(MSG_SET_DEVICE_ORIENTATION, rotation).sendToTarget();
}
public void setZoom(float value) {
mMessageHandler.obtainMessage(MSG_SET_ZOOM, value).sendToTarget();
}
public void sendSessionModifyRequest(VideoCallProfile requestProfile) {
mMessageHandler.obtainMessage(
MSG_SEND_SESSION_MODIFY_REQUEST, requestProfile).sendToTarget();
}
public void sendSessionModifyResponse(VideoCallProfile responseProfile) {
mMessageHandler.obtainMessage(
MSG_SEND_SESSION_MODIFY_RESPONSE, responseProfile).sendToTarget();
}
public void requestCameraCapabilities() {
mMessageHandler.obtainMessage(MSG_REQUEST_CAMERA_CAPABILITIES).sendToTarget();
}
public void requestCallDataUsage() {
mMessageHandler.obtainMessage(MSG_REQUEST_CALL_DATA_USAGE).sendToTarget();
}
public void setPauseImage(String uri) {
mMessageHandler.obtainMessage(MSG_SET_PAUSE_IMAGE, uri).sendToTarget();
}
}
public VideoCallProvider() {
mBinder = new VideoCallProviderBinder();
}
/**
* Returns binder object which can be used across IPC methods.
* @hide
*/
public final IVideoCallProvider getInterface() {
return mBinder;
}
/**
* Sets the camera to be used for video recording in a video call.
*
* @param cameraId The id of the camera.
*/
public void onSetCamera(String cameraId) {
// To be implemented by subclass.
}
/**
* Sets the surface to be used for displaying a preview of what the user's camera is
* currently capturing. When video transmission is enabled, this is the video signal which
* is sent to the remote device.
*
* @param surface The surface.
*/
public void onSetPreviewSurface(Surface surface) {
// To be implemented by subclass.
}
/**
* Sets the surface to be used for displaying the video received from the remote device.
*
* @param surface The surface.
*/
public void onSetDisplaySurface(Surface surface) {
// To be implemented by subclass.
}
/**
* Sets the device orientation, in degrees. Assumes that a standard portrait orientation of
* the device is 0 degrees.
*
* @param rotation The device orientation, in degrees.
*/
public void onSetDeviceOrientation(int rotation) {
// To be implemented by subclass.
}
/**
* Sets camera zoom ratio.
*
* @param value The camera zoom ratio.
*/
public void onSetZoom(float value) {
// To be implemented by subclass.
}
/**
* Issues a request to modify the properties of the current session. The request is sent to
* the remote device where it it handled by
* {@link InCallService.VideoCall.Listener#onSessionModifyRequestReceived}.
* Some examples of session modification requests: upgrade call from audio to video, downgrade
* call from video to audio, pause video.
*
* @param requestProfile The requested call video properties.
*/
public void onSendSessionModifyRequest(VideoCallProfile requestProfile) {
// To be implemented by subclass.
}
/**
* Provides a response to a request to change the current call session video
* properties.
* This is in response to a request the InCall UI has received via
* {@link InCallService.VideoCall.Listener#onSessionModifyRequestReceived}.
* The response is handled on the remove device by
* {@link InCallService.VideoCall.Listener#onSessionModifyResponseReceived}.
*
* @param responseProfile The response call video properties.
*/
public void onSendSessionModifyResponse(VideoCallProfile responseProfile) {
// To be implemented by subclass.
}
/**
* Issues a request to the video provider to retrieve the camera capabilities.
* Camera capabilities are reported back to the caller via
* {@link InCallService.VideoCall.Listener#onCameraCapabilitiesChanged(CallCameraCapabilities)}.
*/
public void onRequestCameraCapabilities() {
// To be implemented by subclass.
}
/**
* Issues a request to the video telephony framework to retrieve the cumulative data usage for
* the current call. Data usage is reported back to the caller via
* {@link InCallService.VideoCall.Listener#onCallDataUsageChanged}.
*/
public void onRequestCallDataUsage() {
// To be implemented by subclass.
}
/**
* Provides the video telephony framework with the URI of an image to be displayed to remote
* devices when the video signal is paused.
*
* @param uri URI of image to display.
*/
public void onSetPauseImage(String uri) {
// To be implemented by subclass.
}
/**
* Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
*
* @param videoCallProfile The requested video call profile.
*/
public void receiveSessionModifyRequest(VideoCallProfile videoCallProfile) {
if (mVideoCallListener != null) {
try {
mVideoCallListener.receiveSessionModifyRequest(videoCallProfile);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
*
* @param status Status of the session modify request. Valid values are
* {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_SUCCESS},
* {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_FAIL},
* {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_INVALID}
* @param requestedProfile The original request which was sent to the remote device.
* @param responseProfile The actual profile changes made by the remote device.
*/
public void receiveSessionModifyResponse(
int status, VideoCallProfile requestedProfile, VideoCallProfile responseProfile) {
if (mVideoCallListener != null) {
try {
mVideoCallListener.receiveSessionModifyResponse(
status, requestedProfile, responseProfile);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
*
* Valid values are: {@link InCallService.VideoCall#SESSION_EVENT_RX_PAUSE},
* {@link InCallService.VideoCall#SESSION_EVENT_RX_RESUME},
* {@link InCallService.VideoCall#SESSION_EVENT_TX_START},
* {@link InCallService.VideoCall#SESSION_EVENT_TX_STOP}
*
* @param event The event.
*/
public void handleCallSessionEvent(int event) {
if (mVideoCallListener != null) {
try {
mVideoCallListener.handleCallSessionEvent(event);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
*
* @param width The updated peer video width.
* @param height The updated peer video height.
*/
public void changePeerDimensions(int width, int height) {
if (mVideoCallListener != null) {
try {
mVideoCallListener.changePeerDimensions(width, height);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
*
* @param dataUsage The updated data usage.
*/
public void changeCallDataUsage(int dataUsage) {
if (mVideoCallListener != null) {
try {
mVideoCallListener.changeCallDataUsage(dataUsage);
} catch (RemoteException ignored) {
}
}
}
/**
* Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
*
* @param callCameraCapabilities The changed camera capabilities.
*/
public void changeCameraCapabilities(CallCameraCapabilities callCameraCapabilities) {
if (mVideoCallListener != null) {
try {
mVideoCallListener.changeCameraCapabilities(callCameraCapabilities);
} catch (RemoteException ignored) {
}
}
}
}
}

View File

@@ -17,18 +17,13 @@
package android.telecomm;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.net.Uri;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
import com.android.internal.telecomm.IConnectionService;
import com.android.internal.telecomm.IConnectionServiceAdapter;
import com.android.internal.telecomm.IVideoCallProvider;
import com.android.internal.telecomm.RemoteServiceCallback;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -77,28 +72,36 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
void handleCreateConnectionSuccessful(
ConnectionRequest request, ParcelableConnection connection) {
String id,
ConnectionRequest request,
ParcelableConnection connection) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
adapter.handleCreateConnectionSuccessful(request, connection);
adapter.handleCreateConnectionSuccessful(id, request, connection);
} catch (RemoteException e) {
}
}
}
void handleCreateConnectionFailed(ConnectionRequest request, int errorCode, String errorMsg) {
void handleCreateConnectionFailed(
String id,
ConnectionRequest request,
int errorCode,
String errorMsg) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
adapter.handleCreateConnectionFailed(request, errorCode, errorMsg);
adapter.handleCreateConnectionFailed(id, request, errorCode, errorMsg);
} catch (RemoteException e) {
}
}
}
void handleCreateConnectionCancelled(ConnectionRequest request) {
void handleCreateConnectionCancelled(
String id,
ConnectionRequest request) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
adapter.handleCreateConnectionCancelled(request);
adapter.handleCreateConnectionCancelled(id, request);
} catch (RemoteException e) {
}
}
@@ -275,15 +278,15 @@ final class ConnectionServiceAdapter implements DeathRecipient {
* Sets the call video provider for a call.
*
* @param callId The unique ID of the call to set with the given call video provider.
* @param videoCallProvider The call video provider instance to set on the call.
* @param videoProvider The call video provider instance to set on the call.
*/
void setVideoCallProvider(
String callId, ConnectionService.VideoCallProvider videoCallProvider) {
void setVideoProvider(
String callId, Connection.VideoProvider videoProvider) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
adapter.setVideoCallProvider(
adapter.setVideoProvider(
callId,
videoCallProvider == null ? null : videoCallProvider.getInterface());
videoProvider == null ? null : videoProvider.getInterface());
} catch (RemoteException e) {
}
}
@@ -334,10 +337,10 @@ final class ConnectionServiceAdapter implements DeathRecipient {
/**
* Sets the video state associated with a call.
*
* Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
* {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
* Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
* {@link VideoProfile.VideoState#BIDIRECTIONAL},
* {@link VideoProfile.VideoState#TX_ENABLED},
* {@link VideoProfile.VideoState#RX_ENABLED}.
*
* @param callId The unique ID of the call to set the video state for.
* @param videoState The video state.

View File

@@ -24,7 +24,7 @@ import android.os.RemoteException;
import com.android.internal.os.SomeArgs;
import com.android.internal.telecomm.IConnectionServiceAdapter;
import com.android.internal.telecomm.IVideoCallProvider;
import com.android.internal.telecomm.IVideoProvider;
import com.android.internal.telecomm.RemoteServiceCallback;
import java.util.List;
@@ -80,8 +80,9 @@ final class ConnectionServiceAdapterServant {
SomeArgs args = (SomeArgs) msg.obj;
try {
mDelegate.handleCreateConnectionSuccessful(
(ConnectionRequest) args.arg1,
(ParcelableConnection) args.arg2);
(String) args.arg1,
(ConnectionRequest) args.arg2,
(ParcelableConnection) args.arg3);
} finally {
args.recycle();
}
@@ -91,16 +92,24 @@ final class ConnectionServiceAdapterServant {
SomeArgs args = (SomeArgs) msg.obj;
try {
mDelegate.handleCreateConnectionFailed(
(ConnectionRequest) args.arg1,
(String) args.arg1,
(ConnectionRequest) args.arg2,
args.argi1,
(String) args.arg2);
(String) args.arg3);
} finally {
args.recycle();
}
break;
}
case MSG_HANDLE_CREATE_CONNECTION_CANCELLED: {
mDelegate.handleCreateConnectionCancelled((ConnectionRequest) msg.obj);
SomeArgs args = (SomeArgs) msg.obj;
try {
mDelegate.handleCreateConnectionCancelled(
(String) args.arg1,
(ConnectionRequest) args.arg2);
} finally {
args.recycle();
}
break;
}
case MSG_SET_ACTIVE:
@@ -164,8 +173,8 @@ final class ConnectionServiceAdapterServant {
case MSG_SET_VIDEO_CALL_PROVIDER: {
SomeArgs args = (SomeArgs) msg.obj;
try {
mDelegate.setVideoCallProvider((String) args.arg1,
(IVideoCallProvider) args.arg2);
mDelegate.setVideoProvider((String) args.arg1,
(IVideoProvider) args.arg2);
} finally {
args.recycle();
}
@@ -229,26 +238,38 @@ final class ConnectionServiceAdapterServant {
private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
@Override
public void handleCreateConnectionSuccessful(
ConnectionRequest request, ParcelableConnection connection) {
String id,
ConnectionRequest request,
ParcelableConnection connection) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = request;
args.arg2 = connection;
args.arg1 = id;
args.arg2 = request;
args.arg3 = connection;
mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_SUCCESSFUL, args).sendToTarget();
}
@Override
public void handleCreateConnectionFailed(
ConnectionRequest request, int errorCode, String errorMessage) {
String id,
ConnectionRequest request,
int errorCode,
String errorMessage) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = request;
args.arg1 = id;
args.arg2 = request;
args.argi1 = errorCode;
args.arg2 = errorMessage;
args.arg3 = errorMessage;
mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_FAILED, args).sendToTarget();
}
@Override
public void handleCreateConnectionCancelled(ConnectionRequest request) {
mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_CANCELLED, request).sendToTarget();
public void handleCreateConnectionCancelled(
String id,
ConnectionRequest request) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = id;
args.arg2 = request;
mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_CANCELLED, args).sendToTarget();
}
@Override
@@ -330,11 +351,10 @@ final class ConnectionServiceAdapterServant {
}
@Override
public void setVideoCallProvider(
String connectionId, IVideoCallProvider videoCallProvider) {
public void setVideoProvider(String connectionId, IVideoProvider videoProvider) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = connectionId;
args.arg2 = videoCallProvider;
args.arg2 = videoProvider;
mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
}

View File

@@ -16,4 +16,7 @@
package android.telecomm;
/**
* {@hide}
*/
parcelable GatewayInfo;

View File

@@ -28,6 +28,10 @@ import com.android.internal.telecomm.IInCallAdapter;
* given call IDs to execute commands such as {@link #answerCall} for incoming calls or
* {@link #disconnectCall} for active calls the user would like to end. Some commands are only
* appropriate for calls in certain states; please consult each method for such limitations.
* <p>
* The adapter will stop functioning when there are no more calls.
*
* {@hide}
*/
public final class InCallAdapter {
private final IInCallAdapter mAdapter;
@@ -115,7 +119,7 @@ public final class InCallAdapter {
}
/**
* Sets the audio route (speaker, bluetooth, etc...). See {@link CallAudioState}.
* Sets the audio route (speaker, bluetooth, etc...). See {@link AudioState}.
*
* @param route The audio route to use.
*/
@@ -236,19 +240,6 @@ public final class InCallAdapter {
}
}
/**
* Swap this call with a background call. This is used for calls that don't support hold,
* e.g. CDMA.
*
* @param callId The unique ID of the call.
*/
public void swapWithBackgroundCall(String callId) {
try {
mAdapter.swapWithBackgroundCall(callId);
} catch (RemoteException ignored) {
}
}
/**
* Instructs Telecomm to turn the proximity sensor on.
*/

View File

@@ -35,7 +35,8 @@ import java.lang.String;
* This service is implemented by any app that wishes to provide the user-interface for managing
* phone calls. Telecomm binds to this service while there exists a live (active or incoming) call,
* and uses it to notify the in-call app of any live and and recently disconnected calls.
* TODO: What happens if two or more apps on a given device implement this interface?
*
* {@hide}
*/
public abstract class InCallService extends Service {
private static final int MSG_SET_IN_CALL_ADAPTER = 1;
@@ -73,7 +74,7 @@ public abstract class InCallService extends Service {
break;
}
case MSG_ON_AUDIO_STATE_CHANGED:
mPhone.internalAudioStateChanged((CallAudioState) msg.obj);
mPhone.internalAudioStateChanged((AudioState) msg.obj);
break;
case MSG_BRING_TO_FOREGROUND:
mPhone.internalBringToForeground(msg.arg1 == 1);
@@ -124,7 +125,7 @@ public abstract class InCallService extends Service {
}
@Override
public void onAudioStateChanged(CallAudioState audioState) {
public void onAudioStateChanged(AudioState audioState) {
mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, audioState).sendToTarget();
}
@@ -190,56 +191,6 @@ public abstract class InCallService extends Service {
*/
public static abstract class VideoCall {
/**
* Video is not being received (no protocol pause was issued).
*/
public static final int SESSION_EVENT_RX_PAUSE = 1;
/**
* Video reception has resumed after a SESSION_EVENT_RX_PAUSE.
*/
public static final int SESSION_EVENT_RX_RESUME = 2;
/**
* Video transmission has begun. This occurs after a negotiated start of video transmission
* when the underlying protocol has actually begun transmitting video to the remote party.
*/
public static final int SESSION_EVENT_TX_START = 3;
/**
* Video transmission has stopped. This occurs after a negotiated stop of video transmission
* when the underlying protocol has actually stopped transmitting video to the remote party.
*/
public static final int SESSION_EVENT_TX_STOP = 4;
/**
* A camera failure has occurred for the selected camera. The In-Call UI can use this as a
* cue to inform the user the camera is not available.
*/
public static final int SESSION_EVENT_CAMERA_FAILURE = 5;
/**
* Issued after {@code SESSION_EVENT_CAMERA_FAILURE} when the camera is once again ready for
* operation. The In-Call UI can use this as a cue to inform the user that the camera has
* become available again.
*/
public static final int SESSION_EVENT_CAMERA_READY = 6;
/**
* Session modify request was successful.
*/
public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1;
/**
* Session modify request failed.
*/
public static final int SESSION_MODIFY_REQUEST_FAIL = 2;
/**
* Session modify request ignored due to invalid parameters.
*/
public static final int SESSION_MODIFY_REQUEST_INVALID = 3;
/**
* Sets a listener to invoke callback methods in the InCallUI after performing video
* telephony actions.
@@ -295,7 +246,7 @@ public abstract class InCallService extends Service {
*
* @param requestProfile The requested call video properties.
*/
public abstract void sendSessionModifyRequest(VideoCallProfile requestProfile);
public abstract void sendSessionModifyRequest(VideoProfile requestProfile);
/**
* Provides a response to a request to change the current call session video
@@ -307,12 +258,12 @@ public abstract class InCallService extends Service {
*
* @param responseProfile The response call video properties.
*/
public abstract void sendSessionModifyResponse(VideoCallProfile responseProfile);
public abstract void sendSessionModifyResponse(VideoProfile responseProfile);
/**
* Issues a request to the video provider to retrieve the camera capabilities.
* Camera capabilities are reported back to the caller via
* {@link VideoCall.Listener#onCameraCapabilitiesChanged(CallCameraCapabilities)}.
* {@link VideoCall.Listener#onCameraCapabilitiesChanged(CameraCapabilities)}.
*/
public abstract void requestCameraCapabilities();
@@ -338,43 +289,44 @@ public abstract class InCallService extends Service {
/**
* Called when a session modification request is received from the remote device.
* The remote request is sent via
* {@link ConnectionService.VideoCallProvider#onSendSessionModifyRequest}. The InCall UI
* {@link Connection.VideoProvider#onSendSessionModifyRequest}. The InCall UI
* is responsible for potentially prompting the user whether they wish to accept the new
* call profile (e.g. prompt user if they wish to accept an upgrade from an audio to a
* video call) and should call
* {@link ConnectionService.VideoCallProvider#onSendSessionModifyResponse} to indicate
* {@link Connection.VideoProvider#onSendSessionModifyResponse} to indicate
* the video settings the user has agreed to.
*
* @param videoCallProfile The requested video call profile.
* @param videoProfile The requested video call profile.
*/
public abstract void onSessionModifyRequestReceived(VideoCallProfile videoCallProfile);
public abstract void onSessionModifyRequestReceived(VideoProfile videoProfile);
/**
* Called when a response to a session modification request is received from the remote
* device. The remote InCall UI sends the response using
* {@link ConnectionService.VideoCallProvider#onSendSessionModifyResponse}.
* {@link Connection.VideoProvider#onSendSessionModifyResponse}.
*
* @param status Status of the session modify request. Valid values are
* {@link VideoCall#SESSION_MODIFY_REQUEST_SUCCESS},
* {@link VideoCall#SESSION_MODIFY_REQUEST_FAIL},
* {@link VideoCall#SESSION_MODIFY_REQUEST_INVALID}
* {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
* {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
* {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID}
* @param requestedProfile The original request which was sent to the remote device.
* @param responseProfile The actual profile changes made by the remote device.
*/
public abstract void onSessionModifyResponseReceived(int status,
VideoCallProfile requestedProfile, VideoCallProfile responseProfile);
VideoProfile requestedProfile, VideoProfile responseProfile);
/**
* Handles events related to the current session which the client may wish to handle.
* These are separate from requested changes to the session due to the underlying
* protocol or connection.
*
* Valid values are: {@link VideoCall#SESSION_EVENT_RX_PAUSE},
* {@link VideoCall#SESSION_EVENT_RX_RESUME},
* {@link VideoCall#SESSION_EVENT_TX_START},
* {@link VideoCall#SESSION_EVENT_TX_STOP},
* {@link VideoCall#SESSION_EVENT_CAMERA_FAILURE},
* {@link VideoCall#SESSION_EVENT_CAMERA_READY}
* Valid values are:
* {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE},
* {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME},
* {@link Connection.VideoProvider#SESSION_EVENT_TX_START},
* {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP},
* {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE},
* {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}
*
* @param event The event.
*/
@@ -399,10 +351,10 @@ public abstract class InCallService extends Service {
/**
* Handles a change in camera capabilities.
*
* @param callCameraCapabilities The changed camera capabilities.
* @param cameraCapabilities The changed camera capabilities.
*/
public abstract void onCameraCapabilitiesChanged(
CallCameraCapabilities callCameraCapabilities);
CameraCapabilities cameraCapabilities);
}
}
}

View File

@@ -16,4 +16,7 @@
package android.telecomm;
/**
* {@hide}
*/
parcelable ParcelableCall;

View File

@@ -22,19 +22,19 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.telephony.DisconnectCause;
import com.android.internal.telecomm.IVideoCallProvider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.android.internal.telecomm.IVideoProvider;
/**
* Information about a call that is used between InCallService and Telecomm.
* @hide
*/
public final class ParcelableCall implements Parcelable {
private final String mId;
private final CallState mState;
private final int mState;
private final int mDisconnectCauseCode;
private final String mDisconnectCauseMsg;
private final List<String> mCannedSmsResponses;
@@ -46,7 +46,7 @@ public final class ParcelableCall implements Parcelable {
private final int mCallerDisplayNamePresentation;
private final GatewayInfo mGatewayInfo;
private final PhoneAccountHandle mAccountHandle;
private final IVideoCallProvider mVideoCallProvider;
private final IVideoProvider mVideoCallProvider;
private InCallService.VideoCall mVideoCall;
private final String mParentCallId;
private final List<String> mChildCallIds;
@@ -56,7 +56,7 @@ public final class ParcelableCall implements Parcelable {
public ParcelableCall(
String id,
CallState state,
int state,
int disconnectCauseCode,
String disconnectCauseMsg,
List<String> cannedSmsResponses,
@@ -68,7 +68,7 @@ public final class ParcelableCall implements Parcelable {
int callerDisplayNamePresentation,
GatewayInfo gatewayInfo,
PhoneAccountHandle accountHandle,
IVideoCallProvider videoCallProvider,
IVideoProvider videoCallProvider,
String parentCallId,
List<String> childCallIds,
StatusHints statusHints,
@@ -101,7 +101,7 @@ public final class ParcelableCall implements Parcelable {
}
/** The current state of the call. */
public CallState getState() {
public int getState() {
return mState;
}
@@ -143,7 +143,7 @@ public final class ParcelableCall implements Parcelable {
return mHandle;
}
/** The {@link CallPropertyPresentation} which controls how the handle is shown. */
/** The {@link PropertyPresentation} which controls how the handle is shown. */
public int getHandlePresentation() {
return mHandlePresentation;
}
@@ -153,7 +153,7 @@ public final class ParcelableCall implements Parcelable {
return mCallerDisplayName;
}
/** The {@link CallPropertyPresentation} which controls how the caller display name is shown. */
/** The {@link PropertyPresentation} which controls how the caller display name is shown. */
public int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
}
@@ -227,7 +227,7 @@ public final class ParcelableCall implements Parcelable {
public ParcelableCall createFromParcel(Parcel source) {
ClassLoader classLoader = ParcelableCall.class.getClassLoader();
String id = source.readString();
CallState state = CallState.valueOf(source.readString());
int state = source.readInt();
int disconnectCauseCode = source.readInt();
String disconnectCauseMsg = source.readString();
List<String> cannedSmsResponses = new ArrayList<>();
@@ -240,8 +240,8 @@ public final class ParcelableCall implements Parcelable {
int callerDisplayNamePresentation = source.readInt();
GatewayInfo gatewayInfo = source.readParcelable(classLoader);
PhoneAccountHandle accountHandle = source.readParcelable(classLoader);
IVideoCallProvider videoCallProvider =
IVideoCallProvider.Stub.asInterface(source.readStrongBinder());
IVideoProvider videoCallProvider =
IVideoProvider.Stub.asInterface(source.readStrongBinder());
String parentCallId = source.readString();
List<String> childCallIds = new ArrayList<>();
source.readList(childCallIds, classLoader);
@@ -272,7 +272,7 @@ public final class ParcelableCall implements Parcelable {
@Override
public void writeToParcel(Parcel destination, int flags) {
destination.writeString(mId);
destination.writeString(mState.name());
destination.writeInt(mState);
destination.writeInt(mDisconnectCauseCode);
destination.writeString(mDisconnectCauseMsg);
destination.writeList(mCannedSmsResponses);

View File

@@ -16,4 +16,7 @@
package android.telecomm;
/**
* {@hide}
*/
parcelable ParcelableConnection;

View File

@@ -20,7 +20,7 @@ import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import com.android.internal.telecomm.IVideoCallProvider;
import com.android.internal.telecomm.IVideoProvider;
/**
* Information about a connection that is used between Telecomm and the ConnectionService.
@@ -36,7 +36,7 @@ public final class ParcelableConnection implements Parcelable {
private int mHandlePresentation;
private String mCallerDisplayName;
private int mCallerDisplayNamePresentation;
private IVideoCallProvider mVideoCallProvider;
private IVideoProvider mVideoProvider;
private int mVideoState;
/** @hide */
@@ -48,7 +48,7 @@ public final class ParcelableConnection implements Parcelable {
int handlePresentation,
String callerDisplayName,
int callerDisplayNamePresentation,
IVideoCallProvider videoCallProvider,
IVideoProvider videoProvider,
int videoState) {
mPhoneAccount = phoneAccount;
mState = state;
@@ -57,7 +57,7 @@ public final class ParcelableConnection implements Parcelable {
mHandlePresentation = handlePresentation;
mCallerDisplayName = callerDisplayName;
mCallerDisplayNamePresentation = callerDisplayNamePresentation;
mVideoCallProvider = videoCallProvider;
mVideoProvider = videoProvider;
mVideoState = videoState;
}
@@ -90,8 +90,8 @@ public final class ParcelableConnection implements Parcelable {
return mCallerDisplayNamePresentation;
}
public IVideoCallProvider getVideoCallProvider() {
return mVideoCallProvider;
public IVideoProvider getVideoProvider() {
return mVideoProvider;
}
public int getVideoState() {
@@ -106,7 +106,7 @@ public final class ParcelableConnection implements Parcelable {
.append(", state:")
.append(mState)
.append(", capabilities:")
.append(CallCapabilities.toString(mCapabilities))
.append(PhoneCapabilities.toString(mCapabilities))
.toString();
}
@@ -123,8 +123,8 @@ public final class ParcelableConnection implements Parcelable {
int handlePresentation = source.readInt();
String callerDisplayName = source.readString();
int callerDisplayNamePresentation = source.readInt();
IVideoCallProvider videoCallProvider =
IVideoCallProvider.Stub.asInterface(source.readStrongBinder());
IVideoProvider videoCallProvider =
IVideoProvider.Stub.asInterface(source.readStrongBinder());
int videoState = source.readInt();
return new ParcelableConnection(
@@ -162,7 +162,7 @@ public final class ParcelableConnection implements Parcelable {
destination.writeString(mCallerDisplayName);
destination.writeInt(mCallerDisplayNamePresentation);
destination.writeStrongBinder(
mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null);
mVideoProvider != null ? mVideoProvider.asBinder() : null);
destination.writeInt(mVideoState);
}
}

View File

@@ -27,6 +27,8 @@ import java.util.Objects;
/**
* A unified virtual device providing a means of voice (and other) communication on a device.
*
* {@hide}
*/
public final class Phone {
@@ -35,9 +37,9 @@ public final class Phone {
* Called when the audio state changes.
*
* @param phone The {@code Phone} calling this method.
* @param audioState The new {@link CallAudioState}.
* @param audioState The new {@link AudioState}.
*/
public void onAudioStateChanged(Phone phone, CallAudioState audioState) { }
public void onAudioStateChanged(Phone phone, AudioState audioState) { }
/**
* Called to bring the in-call screen to the foreground. The in-call experience should
@@ -85,7 +87,7 @@ public final class Phone {
private final InCallAdapter mInCallAdapter;
private CallAudioState mAudioState;
private AudioState mAudioState;
private final List<Listener> mListeners = new ArrayList<>();
@@ -129,10 +131,10 @@ public final class Phone {
}
/** {@hide} */
final void internalAudioStateChanged(CallAudioState callAudioState) {
if (!Objects.equals(mAudioState, callAudioState)) {
mAudioState = callAudioState;
fireAudioStateChanged(callAudioState);
final void internalAudioStateChanged(AudioState audioState) {
if (!Objects.equals(mAudioState, audioState)) {
mAudioState = audioState;
fireAudioStateChanged(audioState);
}
}
@@ -229,7 +231,7 @@ public final class Phone {
*
* @return An object encapsulating the audio state.
*/
public final CallAudioState getAudioState() {
public final AudioState getAudioState() {
return mAudioState;
}
@@ -247,7 +249,7 @@ public final class Phone {
}
}
private void fireAudioStateChanged(CallAudioState audioState) {
private void fireAudioStateChanged(AudioState audioState) {
Listener[] listeners = mListeners.toArray(new Listener[mListeners.size()]);
for (int i = 0; i < listeners.length; i++) {
listeners[i].onAudioStateChanged(this, audioState);

View File

@@ -27,7 +27,8 @@ import android.os.Parcelable;
import java.util.MissingResourceException;
/**
* Provides user interface description information for a {@code PhoneAccount}.
* Describes a distinct account, line of service or call placement method that the system
* can use to place phone calls.
*/
public class PhoneAccount implements Parcelable {
@@ -37,9 +38,9 @@ public class PhoneAccount implements Parcelable {
* will be allowed to manage phone calls including using its own proprietary phone-call
* implementation (like VoIP calling) to make calls instead of the telephony stack.
* <p>
* When a user opts to place a call using the SIM-based telephony stack, the connection-service
* associated with this phone-account will be attempted first if the user has explicitly
* selected it to be used as the default connection manager.
* When a user opts to place a call using the SIM-based telephony stack, the
* {@link ConnectionService} associated with this {@code PhoneAccount} will be attempted first
* if the user has explicitly selected it to be used as the default connection manager.
* <p>
* See {@link #getCapabilities}
*/
@@ -53,21 +54,25 @@ public class PhoneAccount implements Parcelable {
* calls from or use the built-in telephony stack to place its calls.
* <p>
* See {@link #getCapabilities}
*
* <p>
* {@hide}
*/
public static final int CAPABILITY_CALL_PROVIDER = 0x2;
/**
* Flag indicating that this {@code PhoneAccount} represents built-in PSTN SIM
* Flag indicating that this {@code PhoneAccount} represents a built-in PSTN SIM
* subscription.
* <p>
* Only the android framework can set this capability on a phone account.
* Only the Android framework can register a {@code PhoneAccount} having this capability.
* <p>
* See {@link #getCapabilities}
*/
public static final int CAPABILITY_SIM_SUBSCRIPTION = 0x4;
/**
* Flag indicating that this {@code PhoneAccount} is capable of video calling.
* Flag indicating that this {@code PhoneAccount} is capable of placing video calls.
* <p>
* See {@link #getCapabilities}
*/
public static final int CAPABILITY_VIDEO_CALLING = 0x8;
@@ -79,7 +84,65 @@ public class PhoneAccount implements Parcelable {
private final CharSequence mLabel;
private final CharSequence mShortDescription;
public PhoneAccount(
public static class Builder {
private PhoneAccountHandle mAccountHandle;
private Uri mHandle;
private String mSubscriptionNumber;
private int mCapabilities;
private int mIconResId;
private CharSequence mLabel;
private CharSequence mShortDescription;
private Builder() {}
public Builder withAccountHandle(PhoneAccountHandle value) {
this.mAccountHandle = value;
return this;
}
public Builder withHandle(Uri value) {
this.mHandle = value;
return this;
}
public Builder withSubscriptionNumber(String value) {
this.mSubscriptionNumber = value;
return this;
}
public Builder withCapabilities(int value) {
this.mCapabilities = value;
return this;
}
public Builder withIconResId(int value) {
this.mIconResId = value;
return this;
}
public Builder withLabel(CharSequence value) {
this.mLabel = value;
return this;
}
public Builder withShortDescription(CharSequence value) {
this.mShortDescription = value;
return this;
}
public PhoneAccount build() {
return new PhoneAccount(
mAccountHandle,
mHandle,
mSubscriptionNumber,
mCapabilities,
mIconResId,
mLabel,
mShortDescription);
}
}
private PhoneAccount(
PhoneAccountHandle account,
Uri handle,
String subscriptionNumber,
@@ -96,8 +159,10 @@ public class PhoneAccount implements Parcelable {
mShortDescription = shortDescription;
}
public static Builder builder() { return new Builder(); }
/**
* The {@code PhoneAccountHandle} to which this metadata pertains.
* The unique identifier of this {@code PhoneAccount}.
*
* @return A {@code PhoneAccountHandle}.
*/
@@ -118,9 +183,15 @@ public class PhoneAccount implements Parcelable {
}
/**
* The subscription number associated with the underlying transport. This may differ from the
* {@link #getHandle()} number; for example, if the number used to talk to the network is not
* the same number that will be on the remote party's caller ID display.
* The raw callback number used for this {@code PhoneAccount}, as distinct from
* {@link #getHandle()}. For the majority of {@code PhoneAccount}s this should be registered
* as {@code null}. It is used by the system for SIM-based {@code PhoneAccount} registration
* where {@link android.telephony.TelephonyManager#setLine1NumberForDisplay(String, String)}
* or {@link android.telephony.TelephonyManager#setLine1NumberForDisplay(long, String, String)}
* has been used to alter the callback number.
* <p>
* TODO: Should this also be a URI, for consistency? Should it be called the
* "subscription handle"?
*
* @return The subscription number, suitable for display to the user.
*/
@@ -147,7 +218,7 @@ public class PhoneAccount implements Parcelable {
}
/**
* A short paragraph describing a {@code PhoneAccount}.
* A short paragraph describing this {@code PhoneAccount}.
*
* @return A description for this {@code PhoneAccount}.
*/

View File

@@ -23,8 +23,7 @@ import android.os.Parcelable;
import java.util.Objects;
/**
* Represents a distinct account, line of service or call placement method that
* the system can use to place phone calls.
* The unique identifier for a {@link PhoneAccount}.
*/
public class PhoneAccountHandle implements Parcelable {
private ComponentName mComponentName;
@@ -48,10 +47,18 @@ public class PhoneAccountHandle implements Parcelable {
}
/**
* A unique identifier for this {@code PhoneAccountHandle}, generated by and meaningful to the
* {@link android.telecomm.ConnectionService} that created it.
* A string that uniquely distinguishes this particular {@code PhoneAccountHandle} from all the
* others supported by the {@link ConnectionService} that created it.
* <p>
* A {@code ConnectionService} must select identifiers that are stable for the lifetime of
* their users' relationship with their service, across many Android devices. For example, a
* good set of identifiers might be the email addresses with which with users registered for
* their accounts with a particular service. Depending on how a service chooses to operate,
* a bad set of identifiers might be an increasing series of integers
* ({@code 0}, {@code 1}, {@code 2}, ...) that are generated locally on each phone and could
* collide with values generated on other phones or after a data wipe of a given phone.
*
* @return A unique identifier for this {@code PhoneAccountHandle}.
* @return A service-specific unique identifier for this {@code PhoneAccountHandle}.
*/
public String getId() {
return mId;

View File

@@ -16,8 +16,12 @@
package android.telecomm;
/** Defines actions a call currently supports. */
public final class CallCapabilities {
/**
* Defines capabilities a phone call can support, such as conference calling and video telephony.
* Also defines properties of a phone call, such as whether it is using VoLTE technology.
*/
public final class PhoneCapabilities {
/** Call can currently be put on hold or unheld. */
public static final int HOLD = 0x00000001;
@@ -98,5 +102,5 @@ public final class CallCapabilities {
return builder.toString();
}
private CallCapabilities() {}
private PhoneCapabilities() {}
}

View File

@@ -16,8 +16,10 @@
package android.telecomm;
/** Defines how numbers and names are displayed in caller id. */
public class CallPropertyPresentation {
/**
* Defines how properties such as phone numbers and names are displayed to the user.
*/
public class PropertyPresentation {
/** Property is displayed normally. */
public static final int ALLOWED = 1;

View File

@@ -16,22 +16,24 @@
package android.telecomm;
import com.android.internal.telecomm.IConnectionService;
import android.app.PendingIntent;
import android.net.Uri;
import android.os.RemoteException;
import android.telephony.DisconnectCause;
import com.android.internal.telecomm.IConnectionService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* RemoteConnection object used by RemoteConnectionService.
* A connection provided to a {@link ConnectionService} by another {@code ConnectionService}
* running in a different process.
*
* @see ConnectionService#createRemoteOutgoingConnection(PhoneAccountHandle, ConnectionRequest)
* @see ConnectionService#createRemoteIncomingConnection(PhoneAccountHandle, ConnectionRequest)
*/
public final class RemoteConnection {
@@ -100,7 +102,7 @@ public final class RemoteConnection {
* Invoked when the post-dial sequence in the outgoing {@code Connection} has reached a
* pause character. This causes the post-dial signals to stop pending user confirmation. An
* implementation should present this choice to the user and invoke
* {@link #postDialContinue(boolean)} when the user makes the choice.
* {@link RemoteConnection#postDialContinue(boolean)} when the user makes the choice.
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param remainingPostDialSequence The post-dial characters that remain to be sent.
@@ -131,7 +133,7 @@ public final class RemoteConnection {
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param handle The new handle of the {@code RemoteConnection}.
* @param presentation The {@link CallPropertyPresentation} which controls how the
* @param presentation The {@link PropertyPresentation} which controls how the
* handle is shown.
*/
public void onHandleChanged(RemoteConnection connection, Uri handle, int presentation) {}
@@ -142,7 +144,7 @@ public final class RemoteConnection {
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param callerDisplayName The new caller display name of the {@code RemoteConnection}.
* @param presentation The {@link CallPropertyPresentation} which controls how the
* @param presentation The {@link PropertyPresentation} which controls how the
* caller display name is shown.
*/
public void onCallerDisplayNameChanged(
@@ -180,11 +182,10 @@ public final class RemoteConnection {
private IConnectionService mConnectionService;
private final String mConnectionId;
private final Set<Listener> mListeners = Collections.newSetFromMap(
new ConcurrentHashMap<Listener, Boolean>(2));
private final Set<Listener> mListeners = new HashSet<>();
private final Set<RemoteConnection> mConferenceableConnections = new HashSet<>();
private int mState = Connection.State.NEW;
private int mState = Connection.STATE_NEW;
private int mDisconnectCauseCode = DisconnectCause.NOT_VALID;
private String mDisconnectCauseMessage;
private boolean mRequestingRingback;
@@ -203,12 +204,14 @@ public final class RemoteConnection {
/**
* @hide
*/
RemoteConnection(IConnectionService connectionService, ConnectionRequest request) {
RemoteConnection(
String id,
IConnectionService connectionService,
ConnectionRequest request) {
mConnectionId = id;
mConnectionService = connectionService;
mConnectionId = request == null ? "NULL" : request.getCallId();
mConnected = true;
mState = Connection.State.INITIALIZING;
mState = Connection.STATE_INITIALIZING;
}
/**
@@ -219,10 +222,10 @@ public final class RemoteConnection {
* @param failureCode
* @param failureMessage
*/
private RemoteConnection(int failureCode, String failureMessage) {
this(null, null);
RemoteConnection(int failureCode, String failureMessage) {
this("NULL", null, null);
mConnected = false;
mState = Connection.State.FAILED;
mState = Connection.STATE_FAILED;
mFailureCode = failureCode;
mFailureMessage = failureMessage;
}
@@ -271,7 +274,7 @@ public final class RemoteConnection {
}
/**
* @return For a {@link Connection.State#DISCONNECTED} {@code RemoteConnection}, the
* @return For a {@link Connection#STATE_DISCONNECTED} {@code RemoteConnection}, the
* disconnect cause expressed as a code chosen from among those declared in
* {@link DisconnectCause}.
*/
@@ -280,7 +283,7 @@ public final class RemoteConnection {
}
/**
* @return For a {@link Connection.State#DISCONNECTED} {@code RemoteConnection}, an optional
* @return For a {@link Connection#STATE_DISCONNECTED} {@code RemoteConnection}, an optional
* reason for disconnection expressed as a free text message.
*/
public String getDisconnectCauseMessage() {
@@ -289,7 +292,7 @@ public final class RemoteConnection {
/**
* @return A bitmask of the capabilities of the {@code RemoteConnection}, as defined in
* {@link CallCapabilities}.
* {@link PhoneCapabilities}.
*/
public int getCallCapabilities() {
return mCallCapabilities;
@@ -303,7 +306,7 @@ public final class RemoteConnection {
}
/**
* @return The current {@link android.telecomm.StatusHints} of this {@code RemoteConnection},
* @return The current {@link StatusHints} of this {@code RemoteConnection},
* or {@code null} if none have been set.
*/
public StatusHints getStatusHints() {
@@ -320,7 +323,7 @@ public final class RemoteConnection {
/**
* @return The presentation requirements for the handle. See
* {@link android.telecomm.CallPropertyPresentation} for valid values.
* {@link PropertyPresentation} for valid values.
*/
public int getHandlePresentation() {
return mHandlePresentation;
@@ -335,7 +338,7 @@ public final class RemoteConnection {
/**
* @return The presentation requirements for the caller display name. See
* {@link android.telecomm.CallPropertyPresentation} for valid values.
* {@link PropertyPresentation} for valid values.
*/
public int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
@@ -343,7 +346,7 @@ public final class RemoteConnection {
/**
* @return The video state of the {@code RemoteConnection}. See
* {@link VideoCallProfile.VideoState}.
* {@link VideoProfile.VideoState}.
*/
public int getVideoState() {
return mVideoState;
@@ -385,7 +388,7 @@ public final class RemoteConnection {
}
/**
* Instructs this {@link Connection.State#RINGING} {@code RemoteConnection} to answer.
* Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to answer.
* @param videoState The video state in which to answer the call.
*/
public void answer(int videoState) {
@@ -398,7 +401,7 @@ public final class RemoteConnection {
}
/**
* Instructs this {@link Connection.State#RINGING} {@code RemoteConnection} to reject.
* Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to reject.
*/
public void reject() {
try {
@@ -422,7 +425,7 @@ public final class RemoteConnection {
}
/**
* Instructs this {@link Connection.State#HOLDING} call to release from hold.
* Instructs this {@link Connection#STATE_HOLDING} call to release from hold.
*/
public void unhold() {
try {
@@ -509,25 +512,12 @@ public final class RemoteConnection {
}
}
/**
* Instructs this {@code RemoteConnection} to swap itself with an existing background call,
* if one such call exists.
*/
public void swapWithBackgroundCall() {
try {
if (mConnected) {
mConnectionService.swapWithBackgroundCall(mConnectionId);
}
} catch (RemoteException ignored) {
}
}
/**
* Set the audio state of this {@code RemoteConnection}.
*
* @param state The audio state of this {@code RemoteConnection}.
*/
public void setAudioState(CallAudioState state) {
public void setAudioState(AudioState state) {
try {
if (mConnected) {
mConnectionService.onAudioStateChanged(mConnectionId, state);
@@ -552,8 +542,8 @@ public final class RemoteConnection {
* @hide
*/
void setDisconnected(int cause, String message) {
if (mState != Connection.State.DISCONNECTED) {
mState = Connection.State.DISCONNECTED;
if (mState != Connection.STATE_DISCONNECTED) {
mState = Connection.STATE_DISCONNECTED;
mDisconnectCauseCode = cause;
mDisconnectCauseMessage = message;
@@ -591,7 +581,7 @@ public final class RemoteConnection {
void setDestroyed() {
if (!mListeners.isEmpty()) {
// Make sure that the listeners are notified that the call is destroyed first.
if (mState != Connection.State.DISCONNECTED) {
if (mState != Connection.STATE_DISCONNECTED) {
setDisconnected(DisconnectCause.ERROR_UNSPECIFIED, "Connection destroyed.");
}
@@ -676,7 +666,7 @@ public final class RemoteConnection {
}
/**
* Create a RemoteConnection which is in the {@link Connection.State#FAILED} state. Attempting
* Create a RemoteConnection which is in the {@link Connection#STATE_FAILED} state. Attempting
* to use it for anything will almost certainly result in bad things happening. Do not do this.
*
* @return a failed {@link RemoteConnection}

View File

@@ -11,7 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
R* limitations under the License.
* limitations under the License.
*/
package android.telecomm;
@@ -25,7 +25,7 @@ import android.telephony.DisconnectCause;
import com.android.internal.telecomm.IConnectionService;
import com.android.internal.telecomm.IConnectionServiceAdapter;
import com.android.internal.telecomm.IVideoCallProvider;
import com.android.internal.telecomm.IVideoProvider;
import com.android.internal.telecomm.RemoteServiceCallback;
import java.util.HashMap;
@@ -43,14 +43,17 @@ import java.util.UUID;
*/
final class RemoteConnectionService {
private static final RemoteConnection NULL_CONNECTION = new RemoteConnection(null, null);
private static final RemoteConnection
NULL_CONNECTION = new RemoteConnection("NULL", null, null);
private final IConnectionServiceAdapter mServantDelegate = new IConnectionServiceAdapter() {
@Override
public void handleCreateConnectionSuccessful(ConnectionRequest request,
public void handleCreateConnectionSuccessful(
String id,
ConnectionRequest request,
ParcelableConnection parcel) {
RemoteConnection connection = findConnectionForAction(
request.getCallId(), "handleCreateConnectionSuccessful");
RemoteConnection connection =
findConnectionForAction(id, "handleCreateConnectionSuccessful");
if (connection != NULL_CONNECTION && mPendingConnections.contains(connection)) {
mPendingConnections.remove(connection);
connection.setState(parcel.getState());
@@ -65,37 +68,40 @@ final class RemoteConnectionService {
}
@Override
public void handleCreateConnectionFailed(ConnectionRequest request, int errorCode,
public void handleCreateConnectionFailed(
String id,
ConnectionRequest request,
int errorCode,
String errorMessage) {
// TODO: How do we propagate the failure codes?
findConnectionForAction(
request.getCallId(), "handleCreateConnectionFailed")
findConnectionForAction(id, "handleCreateConnectionFailed")
.setDestroyed();
}
@Override
public void handleCreateConnectionCancelled(ConnectionRequest request) {
findConnectionForAction(
request.getCallId(), "handleCreateConnectionCancelled")
public void handleCreateConnectionCancelled(
String id,
ConnectionRequest request) {
findConnectionForAction(id, "handleCreateConnectionCancelled")
.setDestroyed();
}
@Override
public void setActive(String callId) {
findConnectionForAction(callId, "setActive")
.setState(Connection.State.ACTIVE);
.setState(Connection.STATE_ACTIVE);
}
@Override
public void setRinging(String callId) {
findConnectionForAction(callId, "setRinging")
.setState(Connection.State.RINGING);
.setState(Connection.STATE_RINGING);
}
@Override
public void setDialing(String callId) {
findConnectionForAction(callId, "setDialing")
.setState(Connection.State.DIALING);
.setState(Connection.STATE_DIALING);
}
@Override
@@ -108,7 +114,7 @@ final class RemoteConnectionService {
@Override
public void setOnHold(String callId) {
findConnectionForAction(callId, "setOnHold")
.setState(Connection.State.HOLDING);
.setState(Connection.STATE_HOLDING);
}
@Override
@@ -151,8 +157,7 @@ final class RemoteConnectionService {
}
@Override
public void setVideoCallProvider(String callId,
IVideoCallProvider videoCallProvider) {
public void setVideoProvider(String callId, IVideoProvider videoProvider) {
// not supported for remote connections.
}
@@ -244,9 +249,9 @@ final class RemoteConnectionService {
PhoneAccountHandle connectionManagerPhoneAccount,
ConnectionRequest request,
boolean isIncoming) {
final String id = UUID.randomUUID().toString();
final ConnectionRequest newRequest = new ConnectionRequest(
request.getAccountHandle(),
UUID.randomUUID().toString(),
request.getHandle(),
request.getHandlePresentation(),
request.getExtras(),
@@ -256,17 +261,18 @@ final class RemoteConnectionService {
mConnectionService.addConnectionServiceAdapter(mServant.getStub());
}
RemoteConnection connection =
new RemoteConnection(mConnectionService, newRequest);
new RemoteConnection(id, mConnectionService, newRequest);
mPendingConnections.add(connection);
mConnectionById.put(newRequest.getCallId(), connection);
mConnectionById.put(id, connection);
mConnectionService.createConnection(
connectionManagerPhoneAccount,
id,
newRequest,
isIncoming);
connection.addListener(new RemoteConnection.Listener() {
@Override
public void onDestroyed(RemoteConnection connection) {
mConnectionById.remove(newRequest.getCallId());
mConnectionById.remove(id);
if (mConnectionById.isEmpty()) {
try {
mConnectionService.removeConnectionServiceAdapter(mServant.getStub());
@@ -277,11 +283,13 @@ final class RemoteConnectionService {
});
return connection;
} catch (RemoteException e) {
return RemoteConnection.failure(DisconnectCause.ERROR_UNSPECIFIED, e.toString());
return RemoteConnection
.failure(DisconnectCause.ERROR_UNSPECIFIED, e.toString());
}
}
private RemoteConnection findConnectionForAction(String callId, String action) {
private RemoteConnection findConnectionForAction(
String callId, String action) {
if (mConnectionById.containsKey(callId)) {
return mConnectionById.get(callId);
}

View File

@@ -17,7 +17,10 @@
package android.telecomm;
/**
* Used to inform a client of asynchronously returned results.
* <strong>OBSOLETE</strong> Used to inform a client of asynchronously returned results.
* <p>
* <strong>TODO:</strong> Remove onCreateConferenceConnection() async method
* then delete this interface.
*/
public interface Response<IN, OUT> {

View File

@@ -1,38 +0,0 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.telecomm;
/**
* Used to inform a client of asynchronously returned results.
*/
public interface SimpleResponse<IN, OUT> {
/**
* Provide a set of results.
*
* @param request The original request.
* @param result The results.
*/
void onResult(IN request, OUT result);
/**
* Indicates the inability to provide results.
*
* @param request The original request.
*/
void onError(IN request);
}

View File

@@ -20,11 +20,9 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.DisplayMetrics;
import java.util.MissingResourceException;
import java.util.Objects;
@@ -36,13 +34,13 @@ public final class StatusHints implements Parcelable {
private final ComponentName mComponentName;
private final CharSequence mLabel;
private final int mIconId;
private final int mIconResId;
private final Bundle mExtras;
public StatusHints(ComponentName componentName, CharSequence label, int iconId, Bundle extras) {
public StatusHints(ComponentName componentName, CharSequence label, int iconResId, Bundle extras) {
mComponentName = componentName;
mLabel = label;
mIconId = iconId;
mIconResId = iconResId;
mExtras = extras;
}
@@ -61,17 +59,19 @@ public final class StatusHints implements Parcelable {
}
/**
* @return The icon resource identifier.
* The icon resource ID for the icon to show.
*
* @return A resource ID.
*/
public int getIconId() {
return mIconId;
public int getIconResId() {
return mIconResId;
}
/**
* @return An icon displayed in the in-call UI.
*/
public Drawable getIcon(Context context) {
return getIcon(context, mIconId);
return getIcon(context, mIconResId);
}
/**
@@ -90,7 +90,7 @@ public final class StatusHints implements Parcelable {
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(mComponentName, flags);
out.writeCharSequence(mLabel);
out.writeInt(mIconId);
out.writeInt(mIconResId);
out.writeParcelable(mExtras, 0);
}
@@ -108,8 +108,8 @@ public final class StatusHints implements Parcelable {
private StatusHints(Parcel in) {
mComponentName = in.readParcelable(getClass().getClassLoader());
mLabel = in.readCharSequence();
mIconId = in.readInt();
mExtras = (Bundle) in.readParcelable(getClass().getClassLoader());
mIconResId = in.readInt();
mExtras = in.readParcelable(getClass().getClassLoader());
}
private Drawable getIcon(Context context, int resId) {
@@ -135,7 +135,7 @@ public final class StatusHints implements Parcelable {
StatusHints otherHints = (StatusHints) other;
return Objects.equals(otherHints.getComponentName(), getComponentName()) &&
Objects.equals(otherHints.getLabel(), getLabel()) &&
otherHints.getIconId() == getIconId() &&
otherHints.getIconResId() == getIconResId() &&
Objects.equals(otherHints.getExtras(), getExtras());
}
return false;
@@ -143,7 +143,7 @@ public final class StatusHints implements Parcelable {
@Override
public int hashCode() {
return Objects.hashCode(mComponentName) + Objects.hashCode(mLabel) + mIconId +
return Objects.hashCode(mComponentName) + Objects.hashCode(mLabel) + mIconResId +
Objects.hashCode(mExtras);
}
}

View File

@@ -72,10 +72,10 @@ public class TelecommManager {
* Optional extra for {@link android.content.Intent#ACTION_CALL} containing an integer that
* determines the desired video state for an outgoing call.
* Valid options:
* {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
* {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
* {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED},
* {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED}.
* {@link VideoProfile.VideoState#AUDIO_ONLY},
* {@link VideoProfile.VideoState#BIDIRECTIONAL},
* {@link VideoProfile.VideoState#RX_ENABLED},
* {@link VideoProfile.VideoState#TX_ENABLED}.
*/
public static final String EXTRA_START_CALL_WITH_VIDEO_STATE =
"android.intent.extra.START_CALL_WITH_VIDEO_STATE";
@@ -282,10 +282,10 @@ public class TelecommManager {
public List<PhoneAccountHandle> getEnabledPhoneAccounts() {
try {
if (isServiceConnected()) {
return getTelecommService().getEnabledPhoneAccounts();
return getTelecommService().getOutgoingPhoneAccounts();
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecommService#getEnabledPhoneAccounts", e);
Log.e(TAG, "Error calling ITelecommService#getOutgoingPhoneAccounts", e);
}
return null;
}

View File

@@ -25,13 +25,15 @@ import android.telecomm.InCallService.VideoCall;
import android.view.Surface;
import com.android.internal.os.SomeArgs;
import com.android.internal.telecomm.IVideoCallCallback;
import com.android.internal.telecomm.IVideoCallProvider;
import com.android.internal.telecomm.IVideoCallback;
import com.android.internal.telecomm.IVideoProvider;
/**
* Implementation of a Video Call, which allows InCallUi to communicate commands to the underlying
* {@link ConnectionService.VideoCallProvider}, and direct callbacks from the
* {@link ConnectionService.VideoCallProvider} to the appropriate {@link VideoCall.Listener}.
* {@link Connection.VideoProvider}, and direct callbacks from the
* {@link Connection.VideoProvider} to the appropriate {@link VideoCall.Listener}.
*
* {@hide}
*/
public class VideoCallImpl extends VideoCall {
private static final int MSG_RECEIVE_SESSION_MODIFY_REQUEST = 1;
@@ -41,30 +43,30 @@ public class VideoCallImpl extends VideoCall {
private static final int MSG_CHANGE_CALL_DATA_USAGE = 5;
private static final int MSG_CHANGE_CAMERA_CAPABILITIES = 6;
private final IVideoCallProvider mVideoCallProvider;
private final IVideoProvider mVideoProvider;
private final VideoCallListenerBinder mBinder;
private VideoCall.Listener mVideoCallListener;
private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() {
@Override
public void binderDied() {
mVideoCallProvider.asBinder().unlinkToDeath(this, 0);
mVideoProvider.asBinder().unlinkToDeath(this, 0);
}
};
/**
* IVideoCallCallback stub implementation.
* IVideoCallback stub implementation.
*/
private final class VideoCallListenerBinder extends IVideoCallCallback.Stub {
private final class VideoCallListenerBinder extends IVideoCallback.Stub {
@Override
public void receiveSessionModifyRequest(VideoCallProfile videoCallProfile) {
public void receiveSessionModifyRequest(VideoProfile videoProfile) {
mHandler.obtainMessage(MSG_RECEIVE_SESSION_MODIFY_REQUEST,
videoCallProfile).sendToTarget();
videoProfile).sendToTarget();
}
@Override
public void receiveSessionModifyResponse(int status, VideoCallProfile requestProfile,
VideoCallProfile responseProfile) {
public void receiveSessionModifyResponse(int status, VideoProfile requestProfile,
VideoProfile responseProfile) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = status;
args.arg2 = requestProfile;
@@ -91,7 +93,7 @@ public class VideoCallImpl extends VideoCall {
}
@Override
public void changeCameraCapabilities(CallCameraCapabilities cameraCapabilities) {
public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) {
mHandler.obtainMessage(MSG_CHANGE_CAMERA_CAPABILITIES,
cameraCapabilities).sendToTarget();
}
@@ -108,14 +110,14 @@ public class VideoCallImpl extends VideoCall {
SomeArgs args;
switch (msg.what) {
case MSG_RECEIVE_SESSION_MODIFY_REQUEST:
mVideoCallListener.onSessionModifyRequestReceived((VideoCallProfile) msg.obj);
mVideoCallListener.onSessionModifyRequestReceived((VideoProfile) msg.obj);
break;
case MSG_RECEIVE_SESSION_MODIFY_RESPONSE:
args = (SomeArgs) msg.obj;
try {
int status = (int) args.arg1;
VideoCallProfile requestProfile = (VideoCallProfile) args.arg2;
VideoCallProfile responseProfile = (VideoCallProfile) args.arg3;
VideoProfile requestProfile = (VideoProfile) args.arg2;
VideoProfile responseProfile = (VideoProfile) args.arg3;
mVideoCallListener.onSessionModifyResponseReceived(
status, requestProfile, responseProfile);
@@ -141,7 +143,7 @@ public class VideoCallImpl extends VideoCall {
break;
case MSG_CHANGE_CAMERA_CAPABILITIES:
mVideoCallListener.onCameraCapabilitiesChanged(
(CallCameraCapabilities) msg.obj);
(CameraCapabilities) msg.obj);
break;
default:
break;
@@ -150,12 +152,12 @@ public class VideoCallImpl extends VideoCall {
};
/** {@hide} */
VideoCallImpl(IVideoCallProvider videoCallProvider) throws RemoteException {
mVideoCallProvider = videoCallProvider;
mVideoCallProvider.asBinder().linkToDeath(mDeathRecipient, 0);
VideoCallImpl(IVideoProvider videoProvider) throws RemoteException {
mVideoProvider = videoProvider;
mVideoProvider.asBinder().linkToDeath(mDeathRecipient, 0);
mBinder = new VideoCallListenerBinder();
mVideoCallProvider.setVideoCallListener(mBinder);
mVideoProvider.setVideoListener(mBinder);
}
/** {@inheritDoc} */
@@ -166,7 +168,7 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void setCamera(String cameraId) {
try {
mVideoCallProvider.setCamera(cameraId);
mVideoProvider.setCamera(cameraId);
} catch (RemoteException e) {
}
}
@@ -174,7 +176,7 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void setPreviewSurface(Surface surface) {
try {
mVideoCallProvider.setPreviewSurface(surface);
mVideoProvider.setPreviewSurface(surface);
} catch (RemoteException e) {
}
}
@@ -182,7 +184,7 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void setDisplaySurface(Surface surface) {
try {
mVideoCallProvider.setDisplaySurface(surface);
mVideoProvider.setDisplaySurface(surface);
} catch (RemoteException e) {
}
}
@@ -190,7 +192,7 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void setDeviceOrientation(int rotation) {
try {
mVideoCallProvider.setDeviceOrientation(rotation);
mVideoProvider.setDeviceOrientation(rotation);
} catch (RemoteException e) {
}
}
@@ -198,23 +200,23 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void setZoom(float value) {
try {
mVideoCallProvider.setZoom(value);
mVideoProvider.setZoom(value);
} catch (RemoteException e) {
}
}
/** {@inheritDoc} */
public void sendSessionModifyRequest(VideoCallProfile requestProfile) {
public void sendSessionModifyRequest(VideoProfile requestProfile) {
try {
mVideoCallProvider.sendSessionModifyRequest(requestProfile);
mVideoProvider.sendSessionModifyRequest(requestProfile);
} catch (RemoteException e) {
}
}
/** {@inheritDoc} */
public void sendSessionModifyResponse(VideoCallProfile responseProfile) {
public void sendSessionModifyResponse(VideoProfile responseProfile) {
try {
mVideoCallProvider.sendSessionModifyResponse(responseProfile);
mVideoProvider.sendSessionModifyResponse(responseProfile);
} catch (RemoteException e) {
}
}
@@ -222,7 +224,7 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void requestCameraCapabilities() {
try {
mVideoCallProvider.requestCameraCapabilities();
mVideoProvider.requestCameraCapabilities();
} catch (RemoteException e) {
}
}
@@ -230,7 +232,7 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void requestCallDataUsage() {
try {
mVideoCallProvider.requestCallDataUsage();
mVideoProvider.requestCallDataUsage();
} catch (RemoteException e) {
}
}
@@ -238,7 +240,7 @@ public class VideoCallImpl extends VideoCall {
/** {@inheritDoc} */
public void setPauseImage(String uri) {
try {
mVideoCallProvider.setPauseImage(uri);
mVideoProvider.setPauseImage(uri);
} catch (RemoteException e) {
}
}

View File

@@ -17,4 +17,7 @@
package android.telecomm;
parcelable VideoCallProfile;
/**
* {@hide}
*/
parcelable VideoProfile;

View File

@@ -22,7 +22,7 @@ import android.os.Parcelable;
/**
* Represents attributes of video calls.
*/
public class VideoCallProfile implements Parcelable {
public class VideoProfile implements Parcelable {
/**
* "High" video quality.
*/
@@ -48,32 +48,32 @@ public class VideoCallProfile implements Parcelable {
private final int mQuality;
/**
* Creates an instance of the VideoCallProfile
* Creates an instance of the VideoProfile
*
* @param videoState The video state.
*/
public VideoCallProfile(int videoState) {
public VideoProfile(int videoState) {
this(videoState, QUALITY_DEFAULT);
}
/**
* Creates an instance of the VideoCallProfile
* Creates an instance of the VideoProfile
*
* @param videoState The video state.
* @param quality The video quality.
*/
public VideoCallProfile(int videoState, int quality) {
public VideoProfile(int videoState, int quality) {
mVideoState = videoState;
mQuality = quality;
}
/**
* The video state of the call.
* Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY},
* {@link VideoCallProfile.VideoState#BIDIRECTIONAL},
* {@link VideoCallProfile.VideoState#TX_ENABLED},
* {@link VideoCallProfile.VideoState#RX_ENABLED},
* {@link VideoCallProfile.VideoState#PAUSED}.
* Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
* {@link VideoProfile.VideoState#BIDIRECTIONAL},
* {@link VideoProfile.VideoState#TX_ENABLED},
* {@link VideoProfile.VideoState#RX_ENABLED},
* {@link VideoProfile.VideoState#PAUSED}.
*/
public int getVideoState() {
return mVideoState;
@@ -81,18 +81,18 @@ public class VideoCallProfile implements Parcelable {
/**
* The desired video quality for the call.
* Valid values: {@link VideoCallProfile#QUALITY_HIGH}, {@link VideoCallProfile#QUALITY_MEDIUM},
* {@link VideoCallProfile#QUALITY_LOW}, {@link VideoCallProfile#QUALITY_DEFAULT}.
* Valid values: {@link VideoProfile#QUALITY_HIGH}, {@link VideoProfile#QUALITY_MEDIUM},
* {@link VideoProfile#QUALITY_LOW}, {@link VideoProfile#QUALITY_DEFAULT}.
*/
public int getQuality() {
return mQuality;
}
/**
* Responsible for creating VideoCallProfile objects from deserialized Parcels.
* Responsible for creating VideoProfile objects from deserialized Parcels.
**/
public static final Parcelable.Creator<VideoCallProfile> CREATOR =
new Parcelable.Creator<VideoCallProfile> () {
public static final Parcelable.Creator<VideoProfile> CREATOR =
new Parcelable.Creator<VideoProfile> () {
/**
* Creates a MediaProfile instances from a parcel.
*
@@ -100,17 +100,17 @@ public class VideoCallProfile implements Parcelable {
* @return The MediaProfile.
*/
@Override
public VideoCallProfile createFromParcel(Parcel source) {
public VideoProfile createFromParcel(Parcel source) {
int state = source.readInt();
int quality = source.readInt();
ClassLoader classLoader = VideoCallProfile.class.getClassLoader();
return new VideoCallProfile(state, quality);
ClassLoader classLoader = VideoProfile.class.getClassLoader();
return new VideoProfile(state, quality);
}
@Override
public VideoCallProfile[] newArray(int size) {
return new VideoCallProfile[size];
public VideoProfile[] newArray(int size) {
return new VideoProfile[size];
}
};

View File

@@ -17,7 +17,7 @@
package com.android.internal.telecomm;
import android.os.Bundle;
import android.telecomm.CallAudioState;
import android.telecomm.AudioState;
import android.telecomm.ConnectionRequest;
import android.telecomm.PhoneAccountHandle;
@@ -37,6 +37,7 @@ oneway interface IConnectionService {
void createConnection(
in PhoneAccountHandle connectionManagerPhoneAccount,
String callId,
in ConnectionRequest request,
boolean isIncoming);
@@ -52,7 +53,7 @@ oneway interface IConnectionService {
void unhold(String callId);
void onAudioStateChanged(String activeCallId, in CallAudioState audioState);
void onAudioStateChanged(String activeCallId, in AudioState audioState);
void playDtmfTone(String callId, char digit);
@@ -62,8 +63,6 @@ oneway interface IConnectionService {
void splitFromConference(String callId);
void swapWithBackgroundCall(String callId);
void onPostDialContinue(String callId, boolean proceed);
void onPhoneAccountClicked(String callId);

View File

@@ -22,7 +22,7 @@ import android.telecomm.ConnectionRequest;
import android.telecomm.ParcelableConnection;
import android.telecomm.StatusHints;
import com.android.internal.telecomm.IVideoCallProvider;
import com.android.internal.telecomm.IVideoProvider;
import com.android.internal.telecomm.RemoteServiceCallback;
/**
@@ -34,12 +34,18 @@ import com.android.internal.telecomm.RemoteServiceCallback;
*/
oneway interface IConnectionServiceAdapter {
void handleCreateConnectionSuccessful(
in ConnectionRequest request, in ParcelableConnection connection);
String callId,
in ConnectionRequest request,
in ParcelableConnection connection);
void handleCreateConnectionFailed(
in ConnectionRequest request, int errorCode, String errorMessage);
String callId,
in ConnectionRequest request,
int errorCode, String errorMessage);
void handleCreateConnectionCancelled(in ConnectionRequest request);
void handleCreateConnectionCancelled(
String callId,
in ConnectionRequest request);
void setActive(String callId);
@@ -65,7 +71,7 @@ oneway interface IConnectionServiceAdapter {
void queryRemoteConnectionServices(RemoteServiceCallback callback);
void setVideoCallProvider(String callId, IVideoCallProvider videoCallProvider);
void setVideoProvider(String callId, IVideoProvider videoProvider);
void setVideoState(String callId, int videoState);

View File

@@ -16,7 +16,6 @@
package com.android.internal.telecomm;
import android.telecomm.CallAudioState;
import android.telecomm.PhoneAccountHandle;
/**
@@ -55,8 +54,6 @@ oneway interface IInCallAdapter {
void splitFromConference(String callId);
void swapWithBackgroundCall(String callId);
void turnOnProximitySensor();
void turnOffProximitySensor(boolean screenOnImmediately);

View File

@@ -17,7 +17,7 @@
package com.android.internal.telecomm;
import android.app.PendingIntent;
import android.telecomm.CallAudioState;
import android.telecomm.AudioState;
import android.telecomm.ParcelableCall;
import com.android.internal.telecomm.IInCallAdapter;
@@ -40,7 +40,7 @@ oneway interface IInCallService {
void setPostDialWait(String callId, String remaining);
void onAudioStateChanged(in CallAudioState audioState);
void onAudioStateChanged(in AudioState audioState);
void bringToForeground(boolean showDialpad);

View File

@@ -40,9 +40,9 @@ interface ITelecommService {
PhoneAccountHandle getDefaultOutgoingPhoneAccount();
/**
* @see TelecommManager#getEnabledPhoneAccounts
* @see TelecommManager#getOutgoingPhoneAccounts
*/
List<PhoneAccountHandle> getEnabledPhoneAccounts();
List<PhoneAccountHandle> getOutgoingPhoneAccounts();
/**
* @see TelecommManager#getPhoneAccount

View File

@@ -16,22 +16,24 @@
package com.android.internal.telecomm;
import android.telecomm.CallCameraCapabilities;
import android.telecomm.VideoCallProfile;
import android.telecomm.CameraCapabilities;
import android.telecomm.VideoProfile;
/**
* Internal definition of a callback interface, used for an InCallUi to respond to video telephony
* changes.
*
* @see android.telecomm.InCallService.VideoCall.Listener
*
* {@hide}
*/
oneway interface IVideoCallCallback {
void receiveSessionModifyRequest(in VideoCallProfile videoCallProfile);
/**
* Internal definition of a callback interface, used for an InCallUi to respond to video
* telephony changes.
*
* @see android.telecomm.InCallService.VideoCall.Listener
*
* {@hide}
*/
oneway interface IVideoCallback {
void receiveSessionModifyRequest(in VideoProfile videoProfile);
void receiveSessionModifyResponse(int status, in VideoCallProfile requestedProfile,
in VideoCallProfile responseProfile);
void receiveSessionModifyResponse(
int status,
in VideoProfile requestedProfile,
in VideoProfile responseProfile);
void handleCallSessionEvent(int event);
@@ -39,5 +41,5 @@ oneway interface IVideoCallCallback {
void changeCallDataUsage(int dataUsage);
void changeCameraCapabilities(in CallCameraCapabilities callCameraCapabilities);
void changeCameraCapabilities(in CameraCapabilities cameraCapabilities);
}

View File

@@ -17,15 +17,15 @@
package com.android.internal.telecomm;
import android.view.Surface;
import android.telecomm.VideoCallProfile;
import android.telecomm.VideoProfile;
/**
* Internal remote interface for a video call provider.
* @see android.telecomm.VideoCallProvider
* @see android.telecomm.VideoProvider
* @hide
*/
oneway interface IVideoCallProvider {
void setVideoCallListener(IBinder videoCallListenerBinder);
oneway interface IVideoProvider {
void setVideoListener(IBinder videoListenerBinder);
void setCamera(String cameraId);
@@ -37,9 +37,9 @@ oneway interface IVideoCallProvider {
void setZoom(float value);
void sendSessionModifyRequest(in VideoCallProfile reqProfile);
void sendSessionModifyRequest(in VideoProfile reqProfile);
void sendSessionModifyResponse(in VideoCallProfile responseProfile);
void sendSessionModifyResponse(in VideoProfile responseProfile);
void requestCameraCapabilities();

View File

@@ -19,7 +19,7 @@ package com.android.ims;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.telecomm.VideoCallProfile;
import android.telecomm.VideoProfile;
/**
* Parcelable object to handle IMS call profile.
@@ -290,7 +290,7 @@ public class ImsCallProfile implements Parcelable {
/**
* Converts from the call types defined in {@link com.android.ims.ImsCallProfile} to the
* video state values defined in {@link android.telecomm.VideoCallProfile}.
* video state values defined in {@link VideoProfile}.
*
* @param callType The call type.
* @return The video state.
@@ -298,32 +298,32 @@ public class ImsCallProfile implements Parcelable {
public static int getVideoStateFromCallType(int callType) {
switch (callType) {
case CALL_TYPE_VT_NODIR:
return VideoCallProfile.VideoState.PAUSED |
VideoCallProfile.VideoState.BIDIRECTIONAL;
return VideoProfile.VideoState.PAUSED |
VideoProfile.VideoState.BIDIRECTIONAL;
case CALL_TYPE_VT_TX:
return VideoCallProfile.VideoState.TX_ENABLED;
return VideoProfile.VideoState.TX_ENABLED;
case CALL_TYPE_VT_RX:
return VideoCallProfile.VideoState.RX_ENABLED;
return VideoProfile.VideoState.RX_ENABLED;
case CALL_TYPE_VT:
return VideoCallProfile.VideoState.BIDIRECTIONAL;
return VideoProfile.VideoState.BIDIRECTIONAL;
case CALL_TYPE_VOICE:
return VideoCallProfile.VideoState.AUDIO_ONLY;
return VideoProfile.VideoState.AUDIO_ONLY;
default:
return VideoCallProfile.VideoState.AUDIO_ONLY;
return VideoProfile.VideoState.AUDIO_ONLY;
}
}
/**
* Converts from the video state values defined in {@link android.telecomm.VideoCallProfile}
* Converts from the video state values defined in {@link VideoProfile}
* to the call types defined in {@link ImsCallProfile}.
*
* @param videoState The video state.
* @return The call type.
*/
public static int getCallTypeFromVideoState(int videoState) {
boolean videoTx = isVideoStateSet(videoState, VideoCallProfile.VideoState.TX_ENABLED);
boolean videoRx = isVideoStateSet(videoState, VideoCallProfile.VideoState.RX_ENABLED);
boolean isPaused = isVideoStateSet(videoState, VideoCallProfile.VideoState.PAUSED);
boolean videoTx = isVideoStateSet(videoState, VideoProfile.VideoState.TX_ENABLED);
boolean videoRx = isVideoStateSet(videoState, VideoProfile.VideoState.RX_ENABLED);
boolean isPaused = isVideoStateSet(videoState, VideoProfile.VideoState.PAUSED);
if (isPaused) {
return ImsCallProfile.CALL_TYPE_VT_NODIR;
} else if (videoTx && !videoRx) {

View File

@@ -16,8 +16,8 @@
package com.android.ims.internal;
import android.telecomm.CallCameraCapabilities;
import android.telecomm.VideoCallProfile;
import android.telecomm.CameraCapabilities;
import android.telecomm.VideoProfile;
/**
* Internal remote interface for IMS's video call provider.
@@ -32,10 +32,10 @@ import android.telecomm.VideoCallProfile;
* {@hide}
*/
oneway interface IImsVideoCallCallback {
void receiveSessionModifyRequest(in VideoCallProfile videoCallProfile);
void receiveSessionModifyRequest(in VideoProfile videoProfile);
void receiveSessionModifyResponse(int status, in VideoCallProfile requestedProfile,
in VideoCallProfile responseProfile);
void receiveSessionModifyResponse(int status, in VideoProfile requestedProfile,
in VideoProfile responseProfile);
void handleCallSessionEvent(int event);
@@ -43,5 +43,5 @@ oneway interface IImsVideoCallCallback {
void changeCallDataUsage(int dataUsage);
void changeCameraCapabilities(in CallCameraCapabilities callCameraCapabilities);
void changeCameraCapabilities(in CameraCapabilities cameraCapabilities);
}

View File

@@ -17,7 +17,7 @@
package com.android.ims.internal;
import android.view.Surface;
import android.telecomm.VideoCallProfile;
import android.telecomm.VideoProfile;
import com.android.ims.internal.IImsVideoCallCallback;
@@ -52,9 +52,9 @@ oneway interface IImsVideoCallProvider {
void setZoom(float value);
void sendSessionModifyRequest(in VideoCallProfile reqProfile);
void sendSessionModifyRequest(in VideoProfile reqProfile);
void sendSessionModifyResponse(in VideoCallProfile responseProfile);
void sendSessionModifyResponse(in VideoProfile responseProfile);
void requestCameraCapabilities();