Merge "Adding self-managed connection service APIs."

This commit is contained in:
Treehugger Robot
2017-01-19 18:23:33 +00:00
committed by Gerrit Code Review
16 changed files with 425 additions and 28 deletions

View File

@ -80,6 +80,7 @@ package android {
field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES";
field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE"; field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE";
field public static final java.lang.String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS"; field public static final java.lang.String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS";
field public static final java.lang.String MANAGE_OWN_CALLS = "android.permission.MANAGE_OWN_CALLS";
field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR"; field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR";
field public static final java.lang.String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL"; field public static final java.lang.String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL";
field public static final java.lang.String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS"; field public static final java.lang.String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS";
@ -36456,6 +36457,7 @@ package android.telecom {
method public void onReject(); method public void onReject();
method public void onReject(java.lang.String); method public void onReject(java.lang.String);
method public void onSeparate(); method public void onSeparate();
method public void onShowIncomingCallUi();
method public void onStateChanged(int); method public void onStateChanged(int);
method public void onStopDtmfTone(); method public void onStopDtmfTone();
method public void onUnhold(); method public void onUnhold();
@ -36467,6 +36469,7 @@ package android.telecom {
method public final void setActive(); method public final void setActive();
method public final void setAddress(android.net.Uri, int); method public final void setAddress(android.net.Uri, int);
method public final void setAudioModeIsVoip(boolean); method public final void setAudioModeIsVoip(boolean);
method public final void setAudioRoute(int);
method public final void setCallerDisplayName(java.lang.String, int); method public final void setCallerDisplayName(java.lang.String, int);
method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>); method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>);
method public final void setConferenceables(java.util.List<android.telecom.Conferenceable>); method public final void setConferenceables(java.util.List<android.telecom.Conferenceable>);
@ -36515,6 +36518,7 @@ package android.telecom {
field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER"; field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20 field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20
field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10 field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10
field public static final int PROPERTY_SELF_MANAGED = 128; // 0x80
field public static final int STATE_ACTIVE = 4; // 0x4 field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_DIALING = 3; // 0x3 field public static final int STATE_DIALING = 3; // 0x3
field public static final int STATE_DISCONNECTED = 6; // 0x6 field public static final int STATE_DISCONNECTED = 6; // 0x6
@ -36581,7 +36585,9 @@ package android.telecom {
method public final android.os.IBinder onBind(android.content.Intent); method public final android.os.IBinder onBind(android.content.Intent);
method public void onConference(android.telecom.Connection, android.telecom.Connection); method public void onConference(android.telecom.Connection, android.telecom.Connection);
method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
method public void onCreateIncomingConnectionFailed(android.telecom.ConnectionRequest);
method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
method public void onCreateOutgoingConnectionFailed(android.telecom.ConnectionRequest);
method public void onRemoteConferenceAdded(android.telecom.RemoteConference); method public void onRemoteConferenceAdded(android.telecom.RemoteConference);
method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection); method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection);
field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.ConnectionService"; field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.ConnectionService";
@ -36694,6 +36700,7 @@ package android.telecom {
field public static final int CAPABILITY_CALL_SUBJECT = 64; // 0x40 field public static final int CAPABILITY_CALL_SUBJECT = 64; // 0x40
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1 field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10 field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
field public static final int CAPABILITY_SELF_MANAGED = 2048; // 0x800
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4 field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400 field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8 field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
@ -36875,6 +36882,8 @@ package android.telecom {
method public boolean handleMmi(java.lang.String); method public boolean handleMmi(java.lang.String);
method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle); method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle);
method public boolean isInCall(); method public boolean isInCall();
method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
method public boolean isOutgoingCallPermitted(android.telecom.PhoneAccountHandle);
method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String); method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String);
method public void placeCall(android.net.Uri, android.os.Bundle); method public void placeCall(android.net.Uri, android.os.Bundle);
method public void registerPhoneAccount(android.telecom.PhoneAccount); method public void registerPhoneAccount(android.telecom.PhoneAccount);

View File

@ -135,6 +135,7 @@ package android {
field public static final java.lang.String MANAGE_CA_CERTIFICATES = "android.permission.MANAGE_CA_CERTIFICATES"; field public static final java.lang.String MANAGE_CA_CERTIFICATES = "android.permission.MANAGE_CA_CERTIFICATES";
field public static final java.lang.String MANAGE_DEVICE_ADMINS = "android.permission.MANAGE_DEVICE_ADMINS"; field public static final java.lang.String MANAGE_DEVICE_ADMINS = "android.permission.MANAGE_DEVICE_ADMINS";
field public static final java.lang.String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS"; field public static final java.lang.String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS";
field public static final java.lang.String MANAGE_OWN_CALLS = "android.permission.MANAGE_OWN_CALLS";
field public static final java.lang.String MANAGE_USB = "android.permission.MANAGE_USB"; field public static final java.lang.String MANAGE_USB = "android.permission.MANAGE_USB";
field public static final java.lang.String MANAGE_USERS = "android.permission.MANAGE_USERS"; field public static final java.lang.String MANAGE_USERS = "android.permission.MANAGE_USERS";
field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR"; field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR";
@ -39426,6 +39427,7 @@ package android.telecom {
method public void onReject(); method public void onReject();
method public void onReject(java.lang.String); method public void onReject(java.lang.String);
method public void onSeparate(); method public void onSeparate();
method public void onShowIncomingCallUi();
method public void onStateChanged(int); method public void onStateChanged(int);
method public void onStopDtmfTone(); method public void onStopDtmfTone();
method public void onUnhold(); method public void onUnhold();
@ -39437,6 +39439,7 @@ package android.telecom {
method public final void setActive(); method public final void setActive();
method public final void setAddress(android.net.Uri, int); method public final void setAddress(android.net.Uri, int);
method public final void setAudioModeIsVoip(boolean); method public final void setAudioModeIsVoip(boolean);
method public final void setAudioRoute(int);
method public final void setCallerDisplayName(java.lang.String, int); method public final void setCallerDisplayName(java.lang.String, int);
method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>); method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>);
method public final void setConferenceables(java.util.List<android.telecom.Conferenceable>); method public final void setConferenceables(java.util.List<android.telecom.Conferenceable>);
@ -39485,6 +39488,7 @@ package android.telecom {
field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER"; field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20 field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20
field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10 field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10
field public static final int PROPERTY_SELF_MANAGED = 128; // 0x80
field public static final int STATE_ACTIVE = 4; // 0x4 field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_DIALING = 3; // 0x3 field public static final int STATE_DIALING = 3; // 0x3
field public static final int STATE_DISCONNECTED = 6; // 0x6 field public static final int STATE_DISCONNECTED = 6; // 0x6
@ -39551,7 +39555,9 @@ package android.telecom {
method public final android.os.IBinder onBind(android.content.Intent); method public final android.os.IBinder onBind(android.content.Intent);
method public void onConference(android.telecom.Connection, android.telecom.Connection); method public void onConference(android.telecom.Connection, android.telecom.Connection);
method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
method public void onCreateIncomingConnectionFailed(android.telecom.ConnectionRequest);
method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
method public void onCreateOutgoingConnectionFailed(android.telecom.ConnectionRequest);
method public void onRemoteConferenceAdded(android.telecom.RemoteConference); method public void onRemoteConferenceAdded(android.telecom.RemoteConference);
method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection); method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection);
field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.ConnectionService"; field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.ConnectionService";
@ -39788,6 +39794,7 @@ package android.telecom {
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1 field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
field public static final int CAPABILITY_MULTI_USER = 32; // 0x20 field public static final int CAPABILITY_MULTI_USER = 32; // 0x20
field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10 field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
field public static final int CAPABILITY_SELF_MANAGED = 2048; // 0x800
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4 field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400 field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8 field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
@ -40026,6 +40033,8 @@ package android.telecom {
method public boolean handleMmi(java.lang.String); method public boolean handleMmi(java.lang.String);
method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle); method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle);
method public boolean isInCall(); method public boolean isInCall();
method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
method public boolean isOutgoingCallPermitted(android.telecom.PhoneAccountHandle);
method public boolean isRinging(); method public boolean isRinging();
method public boolean isTtySupported(); method public boolean isTtySupported();
method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String); method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String);

View File

@ -80,6 +80,7 @@ package android {
field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES";
field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE"; field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE";
field public static final java.lang.String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS"; field public static final java.lang.String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS";
field public static final java.lang.String MANAGE_OWN_CALLS = "android.permission.MANAGE_OWN_CALLS";
field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR"; field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR";
field public static final java.lang.String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL"; field public static final java.lang.String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL";
field public static final java.lang.String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS"; field public static final java.lang.String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS";
@ -36538,6 +36539,7 @@ package android.telecom {
method public void onReject(); method public void onReject();
method public void onReject(java.lang.String); method public void onReject(java.lang.String);
method public void onSeparate(); method public void onSeparate();
method public void onShowIncomingCallUi();
method public void onStateChanged(int); method public void onStateChanged(int);
method public void onStopDtmfTone(); method public void onStopDtmfTone();
method public void onUnhold(); method public void onUnhold();
@ -36549,6 +36551,7 @@ package android.telecom {
method public final void setActive(); method public final void setActive();
method public final void setAddress(android.net.Uri, int); method public final void setAddress(android.net.Uri, int);
method public final void setAudioModeIsVoip(boolean); method public final void setAudioModeIsVoip(boolean);
method public final void setAudioRoute(int);
method public final void setCallerDisplayName(java.lang.String, int); method public final void setCallerDisplayName(java.lang.String, int);
method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>); method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>);
method public final void setConferenceables(java.util.List<android.telecom.Conferenceable>); method public final void setConferenceables(java.util.List<android.telecom.Conferenceable>);
@ -36597,6 +36600,7 @@ package android.telecom {
field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER"; field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20 field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20
field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10 field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10
field public static final int PROPERTY_SELF_MANAGED = 128; // 0x80
field public static final int STATE_ACTIVE = 4; // 0x4 field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_DIALING = 3; // 0x3 field public static final int STATE_DIALING = 3; // 0x3
field public static final int STATE_DISCONNECTED = 6; // 0x6 field public static final int STATE_DISCONNECTED = 6; // 0x6
@ -36663,7 +36667,9 @@ package android.telecom {
method public final android.os.IBinder onBind(android.content.Intent); method public final android.os.IBinder onBind(android.content.Intent);
method public void onConference(android.telecom.Connection, android.telecom.Connection); method public void onConference(android.telecom.Connection, android.telecom.Connection);
method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
method public void onCreateIncomingConnectionFailed(android.telecom.ConnectionRequest);
method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
method public void onCreateOutgoingConnectionFailed(android.telecom.ConnectionRequest);
method public void onRemoteConferenceAdded(android.telecom.RemoteConference); method public void onRemoteConferenceAdded(android.telecom.RemoteConference);
method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection); method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection);
field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.ConnectionService"; field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.ConnectionService";
@ -36776,6 +36782,7 @@ package android.telecom {
field public static final int CAPABILITY_CALL_SUBJECT = 64; // 0x40 field public static final int CAPABILITY_CALL_SUBJECT = 64; // 0x40
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1 field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10 field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
field public static final int CAPABILITY_SELF_MANAGED = 2048; // 0x800
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4 field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400 field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8 field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
@ -36957,6 +36964,8 @@ package android.telecom {
method public boolean handleMmi(java.lang.String); method public boolean handleMmi(java.lang.String);
method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle); method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle);
method public boolean isInCall(); method public boolean isInCall();
method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
method public boolean isOutgoingCallPermitted(android.telecom.PhoneAccountHandle);
method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String); method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String);
method public void placeCall(android.net.Uri, android.os.Bundle); method public void placeCall(android.net.Uri, android.os.Bundle);
method public void registerPhoneAccount(android.telecom.PhoneAccount); method public void registerPhoneAccount(android.telecom.PhoneAccount);

View File

@ -778,6 +778,16 @@
android:description="@string/permdesc_callPhone" android:description="@string/permdesc_callPhone"
android:protectionLevel="dangerous" /> android:protectionLevel="dangerous" />
<!-- Allows an application to manage its own calls, but rely on the system to route focus to the
currently active call.
<p>Protection level: dangerous
-->
<permission android:name="android.permission.MANAGE_OWN_CALLS"
android:permissionGroup="android.permission-group.PHONE"
android:label="@string/permlab_manageOwnCalls"
android:description="@string/permdesc_manageOwnCalls"
android:protectionLevel="dangerous" />
<!-- Allows an application to access the IMS call service: making and <!-- Allows an application to access the IMS call service: making and
modifying a call modifying a call
<p>Protection level: signature|privileged <p>Protection level: signature|privileged

View File

@ -1056,6 +1056,14 @@
phone number and device IDs, whether a call is active, and the remote number phone number and device IDs, whether a call is active, and the remote number
connected by a call.</string> connected by a call.</string>
<!-- Title of an application permission. When granted the user is giving access to a third
party app to route its calls through the system. -->
<string name="permlab_manageOwnCalls">route calls through the system</string>
<!-- Description of an application permission. When granted the user is giving access to a
third party app to route its calls through the system. -->
<string name="permdesc_manageOwnCalls">Allows the app to route its calls through the system in
order to improve the calling experience.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_wakeLock" product="tablet">prevent tablet from sleeping</string> <string name="permlab_wakeLock" product="tablet">prevent tablet from sleeping</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->

View File

@ -376,8 +376,16 @@ public abstract class Connection extends Conferenceable {
*/ */
public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 1<<6; public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 1<<6;
/**
* Set by the framework to indicate that the {@link Connection} originated from a self-managed
* {@link ConnectionService}.
* <p>
* See {@link PhoneAccount#CAPABILITY_SELF_MANAGED}.
*/
public static final int PROPERTY_SELF_MANAGED = 1<<7;
//********************************************************************************************** //**********************************************************************************************
// Next PROPERTY value: 1<<7 // Next PROPERTY value: 1<<8
//********************************************************************************************** //**********************************************************************************************
/** /**
@ -655,6 +663,10 @@ public abstract class Connection extends Conferenceable {
builder.append("Properties:"); builder.append("Properties:");
} }
if (can(properties, PROPERTY_SELF_MANAGED)) {
builder.append(isLong ? " PROPERTY_SELF_MANAGED" : " self_mng");
}
if (can(properties, PROPERTY_EMERGENCY_CALLBACK_MODE)) { if (can(properties, PROPERTY_EMERGENCY_CALLBACK_MODE)) {
builder.append(isLong ? " PROPERTY_EMERGENCY_CALLBACK_MODE" : " ecbm"); builder.append(isLong ? " PROPERTY_EMERGENCY_CALLBACK_MODE" : " ecbm");
} }
@ -715,6 +727,7 @@ public abstract class Connection extends Conferenceable {
public void onConnectionEvent(Connection c, String event, Bundle extras) {} public void onConnectionEvent(Connection c, String event, Bundle extras) {}
/** @hide */ /** @hide */
public void onConferenceSupportedChanged(Connection c, boolean isConferenceSupported) {} public void onConferenceSupportedChanged(Connection c, boolean isConferenceSupported) {}
public void onAudioRouteChanged(Connection c, int audioRoute) {}
} }
/** /**
@ -2242,6 +2255,25 @@ public abstract class Connection extends Conferenceable {
removeExtras(Arrays.asList(keys)); removeExtras(Arrays.asList(keys));
} }
/**
* Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will
* be change to the {@link #getCallAudioState()}.
* <p>
* Used by self-managed {@link ConnectionService}s which wish to change the audio route for a
* self-managed {@link Connection} (see {@link PhoneAccount#CAPABILITY_SELF_MANAGED}.)
* <p>
* See also {@link InCallService#setAudioRoute(int)}.
*
* @param route The audio route to use (one of {@link CallAudioState#ROUTE_BLUETOOTH},
* {@link CallAudioState#ROUTE_EARPIECE}, {@link CallAudioState#ROUTE_SPEAKER}, or
* {@link CallAudioState#ROUTE_WIRED_HEADSET}).
*/
public final void setAudioRoute(int route) {
for (Listener l : mListeners) {
l.onAudioRouteChanged(this, route);
}
}
/** /**
* Notifies this Connection that the {@link #getAudioState()} property has a new value. * Notifies this Connection that the {@link #getAudioState()} property has a new value.
* *
@ -2397,6 +2429,21 @@ public abstract class Connection extends Conferenceable {
*/ */
public void onExtrasChanged(Bundle extras) {} public void onExtrasChanged(Bundle extras) {}
/**
* Notifies this {@link Connection} that its {@link ConnectionService} is responsible for
* displaying its incoming call user interface for the {@link Connection}.
* <p>
* Will only be called for incoming calls added via a self-managed {@link ConnectionService}
* (see {@link PhoneAccount#CAPABILITY_SELF_MANAGED}), where the {@link ConnectionService}
* should show its own incoming call user interface.
* <p>
* Where there are ongoing calls in other self-managed {@link ConnectionService}s, or in a
* regular {@link ConnectionService}, the Telecom framework will display its own incoming call
* user interface to allow the user to choose whether to answer the new incoming call and
* disconnect other ongoing calls, or to reject the new incoming call.
*/
public void onShowIncomingCallUi() {}
static String toLogSafePhoneNumber(String number) { static String toLogSafePhoneNumber(String number) {
// For unknown number, log empty string. // For unknown number, log empty string.
if (number == null) { if (number == null) {

View File

@ -33,6 +33,7 @@ public final class ConnectionRequest implements Parcelable {
private final Bundle mExtras; private final Bundle mExtras;
private final int mVideoState; private final int mVideoState;
private final String mTelecomCallId; private final String mTelecomCallId;
private final boolean mShouldShowIncomingCallUi;
/** /**
* @param accountHandle The accountHandle which should be used to place the call. * @param accountHandle The accountHandle which should be used to place the call.
@ -43,7 +44,7 @@ public final class ConnectionRequest implements Parcelable {
PhoneAccountHandle accountHandle, PhoneAccountHandle accountHandle,
Uri handle, Uri handle,
Bundle extras) { Bundle extras) {
this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY, null); this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY, null, false);
} }
/** /**
@ -57,7 +58,7 @@ public final class ConnectionRequest implements Parcelable {
Uri handle, Uri handle,
Bundle extras, Bundle extras,
int videoState) { int videoState) {
this(accountHandle, handle, extras, videoState, null); this(accountHandle, handle, extras, videoState, null, false);
} }
/** /**
@ -66,6 +67,10 @@ public final class ConnectionRequest implements Parcelable {
* @param extras Application-specific extra data. * @param extras Application-specific extra data.
* @param videoState Determines the video state for the connection. * @param videoState Determines the video state for the connection.
* @param telecomCallId The telecom call ID. * @param telecomCallId The telecom call ID.
* @param shouldShowIncomingCallUi For a self-managed {@link ConnectionService}, will be
* {@code true} if the {@link ConnectionService} should show its
* own incoming call UI for an incoming call. When
* {@code false}, Telecom shows the incoming call UI.
* @hide * @hide
*/ */
public ConnectionRequest( public ConnectionRequest(
@ -73,12 +78,14 @@ public final class ConnectionRequest implements Parcelable {
Uri handle, Uri handle,
Bundle extras, Bundle extras,
int videoState, int videoState,
String telecomCallId) { String telecomCallId,
boolean shouldShowIncomingCallUi) {
mAccountHandle = accountHandle; mAccountHandle = accountHandle;
mAddress = handle; mAddress = handle;
mExtras = extras; mExtras = extras;
mVideoState = videoState; mVideoState = videoState;
mTelecomCallId = telecomCallId; mTelecomCallId = telecomCallId;
mShouldShowIncomingCallUi = shouldShowIncomingCallUi;
} }
private ConnectionRequest(Parcel in) { private ConnectionRequest(Parcel in) {
@ -87,6 +94,7 @@ public final class ConnectionRequest implements Parcelable {
mExtras = in.readParcelable(getClass().getClassLoader()); mExtras = in.readParcelable(getClass().getClassLoader());
mVideoState = in.readInt(); mVideoState = in.readInt();
mTelecomCallId = in.readString(); mTelecomCallId = in.readString();
mShouldShowIncomingCallUi = in.readInt() == 1;
} }
/** /**
@ -129,6 +137,18 @@ public final class ConnectionRequest implements Parcelable {
return mTelecomCallId; return mTelecomCallId;
} }
/**
* For a self-managed {@link ConnectionService}, indicates for an incoming call whether the
* {@link ConnectionService} should show its own incoming call UI for an incoming call.
*
* @return {@code true} if the {@link ConnectionService} should show its own incoming call UI.
* When {@code false}, Telecom shows the incoming call UI for the call.
* @hide
*/
public boolean shouldShowIncomingCallUi() {
return mShouldShowIncomingCallUi;
}
@Override @Override
public String toString() { public String toString() {
return String.format("ConnectionRequest %s %s", return String.format("ConnectionRequest %s %s",
@ -165,5 +185,6 @@ public final class ConnectionRequest implements Parcelable {
destination.writeParcelable(mExtras, 0); destination.writeParcelable(mExtras, 0);
destination.writeInt(mVideoState); destination.writeInt(mVideoState);
destination.writeString(mTelecomCallId); destination.writeString(mTelecomCallId);
destination.writeInt(mShouldShowIncomingCallUi ? 1 : 0);
} }
} }

View File

@ -42,10 +42,15 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
* An abstract service that should be implemented by any apps which can make phone calls (VoIP or * An abstract service that should be implemented by any apps which either:
* otherwise) and want those calls to be integrated into the built-in phone app. * <ol>
* Once implemented, the {@code ConnectionService} needs two additional steps before it will be * <li>Can make phone calls (VoIP or otherwise) and want those calls to be integrated into the
* integrated into the phone app: * built-in phone app. Referred to as a <b>system managed</b> {@link ConnectionService}.</li>
* <li>Are a standalone calling app and don't want their calls to be integrated into the
* built-in phone app. Referred to as a <b>self managed</b> {@link ConnectionService}.</li>
* </ol>
* Once implemented, the {@link ConnectionService} needs to take the following steps so that Telecom
* will bind to it:
* <p> * <p>
* 1. <i>Registration in AndroidManifest.xml</i> * 1. <i>Registration in AndroidManifest.xml</i>
* <br/> * <br/>
@ -63,16 +68,20 @@ import java.util.concurrent.ConcurrentHashMap;
* <br/> * <br/>
* See {@link PhoneAccount} and {@link TelecomManager#registerPhoneAccount} for more information. * See {@link PhoneAccount} and {@link TelecomManager#registerPhoneAccount} for more information.
* <p> * <p>
* Once registered and enabled by the user in the phone app settings, telecom will bind to a * System managed {@link ConnectionService}s must be enabled by the user in the phone app settings
* {@code ConnectionService} implementation when it wants that {@code ConnectionService} to place * before Telecom will bind to them. Self-manged {@link ConnectionService}s must be granted the
* a call or the service has indicated that is has an incoming call through * appropriate permission before Telecom will bind to them.
* {@link TelecomManager#addNewIncomingCall}. The {@code ConnectionService} can then expect a call * <p>
* to {@link #onCreateIncomingConnection} or {@link #onCreateOutgoingConnection} wherein it * Once registered and enabled by the user in the phone app settings or granted permission, telecom
* should provide a new instance of a {@link Connection} object. It is through this * will bind to a {@link ConnectionService} implementation when it wants that
* {@link Connection} object that telecom receives state updates and the {@code ConnectionService} * {@link ConnectionService} to place a call or the service has indicated that is has an incoming
* call through {@link TelecomManager#addNewIncomingCall}. The {@link ConnectionService} can then
* expect a call to {@link #onCreateIncomingConnection} or {@link #onCreateOutgoingConnection}
* wherein it should provide a new instance of a {@link Connection} object. It is through this
* {@link Connection} object that telecom receives state updates and the {@link ConnectionService}
* receives call-commands such as answer, reject, hold and disconnect. * receives call-commands such as answer, reject, hold and disconnect.
* <p> * <p>
* When there are no more live calls, telecom will unbind from the {@code ConnectionService}. * When there are no more live calls, telecom will unbind from the {@link ConnectionService}.
*/ */
public abstract class ConnectionService extends Service { public abstract class ConnectionService extends Service {
/** /**
@ -1054,6 +1063,7 @@ public abstract class ConnectionService extends Service {
} }
} }
@Override
public void onExtrasRemoved(Connection c, List<String> keys) { public void onExtrasRemoved(Connection c, List<String> keys) {
String id = mIdByConnection.get(c); String id = mIdByConnection.get(c);
if (id != null) { if (id != null) {
@ -1061,7 +1071,6 @@ public abstract class ConnectionService extends Service {
} }
} }
@Override @Override
public void onConnectionEvent(Connection connection, String event, Bundle extras) { public void onConnectionEvent(Connection connection, String event, Bundle extras) {
String id = mIdByConnection.get(connection); String id = mIdByConnection.get(connection);
@ -1069,6 +1078,14 @@ public abstract class ConnectionService extends Service {
mAdapter.onConnectionEvent(id, event, extras); mAdapter.onConnectionEvent(id, event, extras);
} }
} }
@Override
public void onAudioRouteChanged(Connection c, int audioRoute) {
String id = mIdByConnection.get(c);
if (id != null) {
mAdapter.setAudioRoute(id, audioRoute);
}
}
}; };
/** {@inheritDoc} */ /** {@inheritDoc} */
@ -1146,6 +1163,13 @@ public abstract class ConnectionService extends Service {
connection.getDisconnectCause(), connection.getDisconnectCause(),
createIdList(connection.getConferenceables()), createIdList(connection.getConferenceables()),
connection.getExtras())); connection.getExtras()));
if (isIncoming && request.shouldShowIncomingCallUi() &&
(connection.getConnectionProperties() & Connection.PROPERTY_SELF_MANAGED) ==
Connection.PROPERTY_SELF_MANAGED) {
// Tell ConnectionService to show its incoming call UX.
connection.onShowIncomingCallUi();
}
if (isUnknown) { if (isUnknown) {
triggerConferenceRecalculate(); triggerConferenceRecalculate();
} }
@ -1586,6 +1610,38 @@ public abstract class ConnectionService extends Service {
return null; return null;
} }
/**
* Called by Telecom to inform the {@link ConnectionService} that its request to create a new
* incoming {@link Connection} was denied.
* <p>
* Used when a self-managed {@link ConnectionService} attempts to create a new incoming
* {@link Connection}, but Telecom has determined that the call cannot be allowed at this time.
* The {@link ConnectionService} is responsible for silently rejecting the new incoming
* {@link Connection}.
* <p>
* See {@link TelecomManager#isIncomingCallPermitted(PhoneAccountHandle)} for more information.
*
* @param request The incoming connection request.
*/
public void onCreateIncomingConnectionFailed(ConnectionRequest request) {
}
/**
* Called by Telecom to inform the {@link ConnectionService} that its request to create a new
* outgoing {@link Connection} was denied.
* <p>
* Used when a self-managed {@link ConnectionService} attempts to create a new outgoing
* {@link Connection}, but Telecom has determined that the call cannot be placed at this time.
* The {@link ConnectionService} is responisible for informing the user that the
* {@link Connection} cannot be made at this time.
* <p>
* See {@link TelecomManager#isOutgoingCallPermitted(PhoneAccountHandle)} for more information.
*
* @param request The outgoing connection request.
*/
public void onCreateOutgoingConnectionFailed(ConnectionRequest request) {
}
/** /**
* Trigger recalculate functinality for conference calls. This is used when a Telephony * Trigger recalculate functinality for conference calls. This is used when a Telephony
* Connection is part of a conference controller but is not yet added to Connection * Connection is part of a conference controller but is not yet added to Connection

View File

@ -514,6 +514,23 @@ final class ConnectionServiceAdapter implements DeathRecipient {
} }
} }
/**
* Sets the audio route associated with a {@link Connection}.
*
* @param callId The unique ID of the call.
* @param audioRoute The new audio route (see {@code CallAudioState#ROUTE_*}).
*/
void setAudioRoute(String callId, int audioRoute) {
Log.v(this, "setAudioRoute: %s %s", callId, CallAudioState.audioRouteToString(audioRoute));
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
adapter.setAudioRoute(callId, audioRoute, Log.getExternalSession());
} catch (RemoteException ignored) {
}
}
}
/** /**
* Informs Telecom of a connection level event. * Informs Telecom of a connection level event.
* *

View File

@ -67,6 +67,7 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_ON_CONNECTION_EVENT = 26; private static final int MSG_ON_CONNECTION_EVENT = 26;
private static final int MSG_SET_CONNECTION_PROPERTIES = 27; private static final int MSG_SET_CONNECTION_PROPERTIES = 27;
private static final int MSG_SET_PULLING = 28; private static final int MSG_SET_PULLING = 28;
private static final int MSG_SET_AUDIO_ROUTE = 29;
private final IConnectionServiceAdapter mDelegate; private final IConnectionServiceAdapter mDelegate;
@ -289,6 +290,16 @@ final class ConnectionServiceAdapterServant {
} }
break; break;
} }
case MSG_SET_AUDIO_ROUTE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
mDelegate.setAudioRoute((String) args.arg1, args.argi1,
(Session.Info) args.arg2);
} finally {
args.recycle();
}
break;
}
} }
} }
}; };
@ -506,6 +517,17 @@ final class ConnectionServiceAdapterServant {
mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget(); mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
} }
@Override
public final void setAudioRoute(String connectionId, int audioRoute,
Session.Info sessionInfo) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = connectionId;
args.argi1 = audioRoute;
args.arg2 = sessionInfo;
mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
}
@Override @Override
public final void onConnectionEvent(String connectionId, String event, Bundle extras, public final void onConnectionEvent(String connectionId, String event, Bundle extras,
Session.Info sessionInfo) { Session.Info sessionInfo) {

View File

@ -188,6 +188,21 @@ public final class PhoneAccount implements Parcelable {
*/ */
public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 0x400; public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 0x400;
/**
* Flag indicating that this {@link PhoneAccount} is responsible for managing its own
* {@link Connection}s. This type of {@link PhoneAccount} is ideal for use with standalone
* calling apps which do not wish to use the default phone app for {@link Connection} UX,
* but which want to leverage the call and audio routing capabilities of the Telecom framework.
* <p>
* When set, {@link Connection}s created by the self-managed {@link ConnectionService} will not
* be surfaced to implementations of the {@link InCallService} API. Thus it is the
* responsibility of a self-managed {@link ConnectionService} to provide a user interface for
* its {@link Connection}s.
* <p>
* Self-managed {@link Connection}s will, however, be displayed on connected Bluetooth devices.
*/
public static final int CAPABILITY_SELF_MANAGED = 0x800;
/** /**
* URI scheme for telephone number URIs. * URI scheme for telephone number URIs.
*/ */
@ -692,6 +707,14 @@ public final class PhoneAccount implements Parcelable {
mIsEnabled = isEnabled; mIsEnabled = isEnabled;
} }
/**
* @return {@code true} if the {@link PhoneAccount} is self-managed, {@code false} otherwise.
* @hide
*/
public boolean isSelfManaged() {
return (mCapabilities & CAPABILITY_SELF_MANAGED) == CAPABILITY_SELF_MANAGED;
}
// //
// Parcelable implementation // Parcelable implementation
// //
@ -815,6 +838,9 @@ public final class PhoneAccount implements Parcelable {
*/ */
private String capabilitiesToString() { private String capabilitiesToString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (hasCapabilities(CAPABILITY_SELF_MANAGED)) {
sb.append("SelfManaged ");
}
if (hasCapabilities(CAPABILITY_SUPPORTS_VIDEO_CALLING)) { if (hasCapabilities(CAPABILITY_SUPPORTS_VIDEO_CALLING)) {
sb.append("SuppVideo "); sb.append("SuppVideo ");
} }

View File

@ -367,6 +367,15 @@ final class RemoteConnectionService {
} }
} }
@Override
public void setAudioRoute(String callId, int audioRoute, Session.Info sessionInfo) {
if (hasConnection(callId)) {
// TODO(3pcalls): handle this for remote connections.
// Likely we don't want to do anything since it doesn't make sense for self-managed
// connections to go through a connection mgr.
}
}
@Override @Override
public void onConnectionEvent(String callId, String event, Bundle extras, public void onConnectionEvent(String callId, String event, Bundle extras,
Session.Info sessionInfo) { Session.Info sessionInfo) {

View File

@ -1202,17 +1202,25 @@ public class TelecomManager {
/** /**
* Registers a new incoming call. A {@link ConnectionService} should invoke this method when it * Registers a new incoming call. A {@link ConnectionService} should invoke this method when it
* has an incoming call. The specified {@link PhoneAccountHandle} must have been registered * has an incoming call. For managed {@link ConnectionService}s, the specified
* with {@link #registerPhoneAccount} and the user must have enabled the corresponding * {@link PhoneAccountHandle} must have been registered with {@link #registerPhoneAccount} and
* {@link PhoneAccount}. This can be checked using {@link #getPhoneAccount}. Once invoked, this * the user must have enabled the corresponding {@link PhoneAccount}. This can be checked using
* method will cause the system to bind to the {@link ConnectionService} associated with the * {@link #getPhoneAccount}. Self-managed {@link ConnectionService}s must have
* {@link PhoneAccountHandle} and request additional information about the call * {@link android.Manifest.permission#MANAGE_OWN_CALLS} to add a new incoming call.
* (See {@link ConnectionService#onCreateIncomingConnection}) before starting the incoming * <p>
* Once invoked, this method will cause the system to bind to the {@link ConnectionService}
* associated with the {@link PhoneAccountHandle} and request additional information about the
* call (See {@link ConnectionService#onCreateIncomingConnection}) before starting the incoming
* call UI. * call UI.
* <p> * <p>
* A {@link SecurityException} will be thrown if either the {@link PhoneAccountHandle} does not * For a managed {@link ConnectionService}, a {@link SecurityException} will be thrown if either
* correspond to a registered {@link PhoneAccount} or the associated {@link PhoneAccount} is not * the {@link PhoneAccountHandle} does not correspond to a registered {@link PhoneAccount} or
* currently enabled by the user. * the associated {@link PhoneAccount} is not currently enabled by the user.
* <p>
* For a self-managed {@link ConnectionService}, a {@link SecurityException} will be thrown if
* the {@link PhoneAccount} has {@link PhoneAccount#CAPABILITY_SELF_MANAGED} and the calling app
* does not have {@link android.Manifest.permission#MANAGE_OWN_CALLS}.
*
* @param phoneAccount A {@link PhoneAccountHandle} registered with * @param phoneAccount A {@link PhoneAccountHandle} registered with
* {@link #registerPhoneAccount}. * {@link #registerPhoneAccount}.
* @param extras A bundle that will be passed through to * @param extras A bundle that will be passed through to
@ -1379,7 +1387,8 @@ public class TelecomManager {
* method-caller is either the user selected default dialer app or preloaded system dialer * method-caller is either the user selected default dialer app or preloaded system dialer
* app, then emergency calls will also be allowed. * app, then emergency calls will also be allowed.
* *
* Requires permission: {@link android.Manifest.permission#CALL_PHONE} * Placing a call via a managed {@link ConnectionService} requires permission:
* {@link android.Manifest.permission#CALL_PHONE}
* *
* Usage example: * Usage example:
* <pre> * <pre>
@ -1396,11 +1405,20 @@ public class TelecomManager {
* <li>{@link #EXTRA_START_CALL_WITH_SPEAKERPHONE}</li> * <li>{@link #EXTRA_START_CALL_WITH_SPEAKERPHONE}</li>
* <li>{@link #EXTRA_START_CALL_WITH_VIDEO_STATE}</li> * <li>{@link #EXTRA_START_CALL_WITH_VIDEO_STATE}</li>
* </ul> * </ul>
* <p>
* An app which implements the self-managed {@link ConnectionService} API uses
* {@link #placeCall(Uri, Bundle)} to inform Telecom of a new outgoing call. A self-managed
* {@link ConnectionService} must include {@link #EXTRA_PHONE_ACCOUNT_HANDLE} to specify its
* associated {@link android.telecom.PhoneAccountHandle}.
*
* Self-managed {@link ConnectionService}s require permission
* {@link android.Manifest.permission#MANAGE_OWN_CALLS}.
* *
* @param address The address to make the call to. * @param address The address to make the call to.
* @param extras Bundle of extras to use with the call. * @param extras Bundle of extras to use with the call.
*/ */
@RequiresPermission(android.Manifest.permission.CALL_PHONE) @RequiresPermission(anyOf = {android.Manifest.permission.CALL_PHONE,
android.Manifest.permission.MANAGE_OWN_CALLS})
public void placeCall(Uri address, Bundle extras) { public void placeCall(Uri address, Bundle extras) {
ITelecomService service = getTelecomService(); ITelecomService service = getTelecomService();
if (service != null) { if (service != null) {
@ -1476,6 +1494,71 @@ public class TelecomManager {
return result; return result;
} }
/**
* Determines whether Telecom would permit an incoming call to be added via the
* {@link #addNewIncomingCall(PhoneAccountHandle, Bundle)} API for the specified
* {@link PhoneAccountHandle}.
* <p>
* A {@link ConnectionService} may not add a call for the specified {@link PhoneAccountHandle}
* in the following situations:
* <ul>
* <li>{@link PhoneAccount} does not have property
* {@link PhoneAccount#CAPABILITY_SELF_MANAGED} set (i.e. it is a managed
* {@link ConnectionService}), and the active or held call limit has
* been reached.</li>
* <li>There is an ongoing emergency call.</li>
* </ul>
*
* @param phoneAccountHandle The {@link PhoneAccountHandle} the call will be added for.
* @return {@code true} if telecom will permit an incoming call to be added, {@code false}
* otherwise.
*/
public boolean isIncomingCallPermitted(PhoneAccountHandle phoneAccountHandle) {
ITelecomService service = getTelecomService();
if (service != null) {
try {
return service.isIncomingCallPermitted(phoneAccountHandle);
} catch (RemoteException e) {
Log.e(TAG, "Error isIncomingCallPermitted", e);
}
}
return false;
}
/**
* Determines whether Telecom would permit an outgoing call to be placed via the
* {@link #placeCall(Uri, Bundle)} API for the specified {@link PhoneAccountHandle}.
* <p>
* A {@link ConnectionService} may not place a call for the specified {@link PhoneAccountHandle}
* in the following situations:
* <ul>
* <li>{@link PhoneAccount} does not have property
* {@link PhoneAccount#CAPABILITY_SELF_MANAGED} set (i.e. it is a managed
* {@link ConnectionService}), and the active, held or ringing call limit has
* been reached.</li>
* <li>{@link PhoneAccount} has property {@link PhoneAccount#CAPABILITY_SELF_MANAGED} set
* (i.e. it is a self-managed {@link ConnectionService} and there is an ongoing call in
* another {@link ConnectionService}.</li>
* <li>There is an ongoing emergency call.</li>
* </ul>
*
* @param phoneAccountHandle The {@link PhoneAccountHandle} the call will be added for.
* @return {@code true} if telecom will permit an outgoing call to be placed, {@code false}
* otherwise.
*/
public boolean isOutgoingCallPermitted(PhoneAccountHandle phoneAccountHandle) {
ITelecomService service = getTelecomService();
if (service != null) {
try {
return service.isOutgoingCallPermitted(phoneAccountHandle);
} catch (RemoteException e) {
Log.e(TAG, "Error isOutgoingCallPermitted", e);
}
}
return false;
}
private ITelecomService getTelecomService() { private ITelecomService getTelecomService() {
if (mTelecomServiceOverride != null) { if (mTelecomServiceOverride != null) {
return mTelecomServiceOverride; return mTelecomServiceOverride;

View File

@ -0,0 +1,59 @@
/*
* Copyright (C) 2016 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
*/
/**
* The Android Telecom framework is responsible for managing calls on an Android device. This can
* include SIM-based calls using the {@code Telephony} framework, VOIP calls using SIP (e.g. the
* {@code SipConnectionService}), or via a third-party VOIP
* {@link android.telecom.ConnectionService}. Telecom acts as a switchboard, routing calls and
* audio focus between {@link android.telecom.Connection}s provided by
* {@link android.telecom.ConnectionService} implementations, and
* {@link android.telecom.InCallService} implementations which provide a user interface for calls.
* <p>
* Android supports the following calling use cases (with increasing level of complexity):
* <ul>
* <li>Implement the self-managed {@link android.telecom.ConnectionService} API - this is ideal
* for developers of standalone calling apps which do not wish to show their calls within the
* default phone app, and do not wish to have other calls shown in their user interface. Using
* a self-managed {@link android.telecom.ConnectionService} implementation within your
* standalone calling app helps you ensure that your app will interoperate not only with native
* telephony calling on the device, but also other standalone calling apps implementing this
* API. It also manages audio routing and focus for you.</li>
* <li>Implement the managed {@link android.telecom.ConnectionService} API - facilitates
* development of a calling solution that relies on the existing device phone application (see
* {@link android.telecom.TelecomManager#getDefaultDialerPackage()}) to provide the user
* interface for calls. An example might be a third party implementation of SIP calling, or a
* VOIP calling service. A {@link android.telecom.ConnectionService} alone provides only the
* means of connecting calls, but has no associated user interface.</li>
* <li>Implement the {@link android.telecom.InCallService} API - facilitates development of a
* replacement for the device's default Phone/Dialer app. The
* {@link android.telecom.InCallService} alone does not have any calling capability and consists
* of the user-interface side of calling only. An {@link android.telecom.InCallService} must
* handle all Calls the Telecom framework is aware of. It must not make assumptions about the
* nature of the calls (e.g. assuming calls are SIM-based telephony calls), and should not
* implement calling restrictions based on any one {@link android.telecom.ConnectionService}
* (e.g. it should not enforce Telephony restrictions for video calls).</li>
* <li>Implement both the {@link android.telecom.InCallService} and
* {@link android.telecom.ConnectionService} API - ideal if you wish to create your own
* {@link android.telecom.ConnectionService} based calling solution, complete with its own
* full user interface, while showing all other Android calls in the same user interface. Using
* this approach, you must still ensure that your {@link android.telecom.InCallService} makes
* no assumption about the source of the calls it displays. You must also ensure that your
* {@link android.telecom.ConnectionService} implementation can still function without the
* default phone app being set to your custom {@link android.telecom.InCallService}.</li>
* </ul>
*/
package android.telecom;

View File

@ -102,6 +102,8 @@ oneway interface IConnectionServiceAdapter {
void removeExtras(String callId, in List<String> keys, in Session.Info sessionInfo); void removeExtras(String callId, in List<String> keys, in Session.Info sessionInfo);
void setAudioRoute(String callId, int audioRoute, in Session.Info sessionInfo);
void onConnectionEvent(String callId, String event, in Bundle extras, void onConnectionEvent(String callId, String event, in Bundle extras,
in Session.Info sessionInfo); in Session.Info sessionInfo);
} }

View File

@ -249,4 +249,14 @@ interface ITelecomService {
* @see TelecomServiceImpl#createManageBlockedNumbersIntent * @see TelecomServiceImpl#createManageBlockedNumbersIntent
**/ **/
Intent createManageBlockedNumbersIntent(); Intent createManageBlockedNumbersIntent();
/**
* @see TelecomServiceImpl#isIncomingCallPermitted
*/
boolean isIncomingCallPermitted(in PhoneAccountHandle phoneAccountHandle);
/**
* @see TelecomServiceImpl#isOutgoingCallPermitted
*/
boolean isOutgoingCallPermitted(in PhoneAccountHandle phoneAccountHandle);
} }