public final class PhoneAccount extends Object implements Parcelable
TelecomManager
.
TelecomManager
uses registered PhoneAccount
s to present the user with
alternative options when placing a phone call. When building a PhoneAccount
, the app
should supply a valid PhoneAccountHandle
that references the connection service
implementation Telecom will use to interact with the app.
Modifier and Type | Class and Description |
---|---|
static class |
PhoneAccount.Builder
Helper class for creating a
PhoneAccount . |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static int |
CAPABILITY_CALL_PROVIDER
Flag indicating that this
PhoneAccount can make phone calls in place of
traditional SIM-based telephony calls. |
static int |
CAPABILITY_CALL_SUBJECT
Flag indicating that this
PhoneAccount supports a subject for Calls. |
static int |
CAPABILITY_CONNECTION_MANAGER
Flag indicating that this
PhoneAccount can act as a connection manager for
other connections. |
static int |
CAPABILITY_EMERGENCY_CALLS_ONLY
Flag indicating that this
PhoneAccount should only be used for emergency calls. |
static int |
CAPABILITY_EMERGENCY_VIDEO_CALLING
Flag indicating that for this
PhoneAccount , emergency video calling is allowed. |
static int |
CAPABILITY_MULTI_USER
Flag indicating that this
PhoneAccount is capable of being used by all users. |
static int |
CAPABILITY_PLACE_EMERGENCY_CALLS
Flag indicating that this
PhoneAccount is capable of placing emergency calls. |
static int |
CAPABILITY_SIM_SUBSCRIPTION
Flag indicating that this
PhoneAccount represents a built-in PSTN SIM
subscription. |
static int |
CAPABILITY_VIDEO_CALLING
Flag indicating that this
PhoneAccount is capable of placing video calls. |
static int |
CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE
Flag indicating that for this
PhoneAccount , the ability to make a video call to a
number relies on presence. |
static Parcelable.Creator<PhoneAccount> |
CREATOR |
static String |
EXTRA_CALL_SUBJECT_CHARACTER_ENCODING
PhoneAccount extras key (see getExtras() ) which determines the
character encoding to be used when determining the length of messages. |
static String |
EXTRA_CALL_SUBJECT_MAX_LENGTH
PhoneAccount extras key (see getExtras() ) which determines the
maximum permitted length of a call subject specified via the
TelecomManager.EXTRA_CALL_SUBJECT extra on an
Intent.ACTION_CALL intent. |
static int |
NO_HIGHLIGHT_COLOR
Indicating no hightlight color is set.
|
static int |
NO_ICON_TINT
Indicating no icon tint is set.
|
static int |
NO_RESOURCE_ID
Indicating no resource ID is set.
|
static String |
SCHEME_SIP
URI scheme for SIP URIs.
|
static String |
SCHEME_TEL
URI scheme for telephone number URIs.
|
static String |
SCHEME_VOICEMAIL
URI scheme for voicemail URIs.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
static PhoneAccount.Builder |
builder(PhoneAccountHandle accountHandle,
CharSequence label) |
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
PhoneAccountHandle |
getAccountHandle()
The unique identifier of this
PhoneAccount . |
Uri |
getAddress()
The address (e.g., a phone number) associated with this
PhoneAccount . |
int |
getCapabilities()
The capabilities of this
PhoneAccount . |
Bundle |
getExtras()
The extras associated with this
PhoneAccount . |
String |
getGroupId()
A non-empty
String representing the group that A PhoneAccount is in or an
empty String if the PhoneAccount is not in a group. |
int |
getHighlightColor()
A highlight color to use in displaying information about this
PhoneAccount . |
Icon |
getIcon()
The icon to represent this
PhoneAccount . |
CharSequence |
getLabel()
A short label describing a
PhoneAccount . |
CharSequence |
getShortDescription()
A short paragraph describing this
PhoneAccount . |
Uri |
getSubscriptionAddress()
The raw callback number used for this
PhoneAccount , as distinct from
getAddress() . |
List<String> |
getSupportedUriSchemes()
The URI schemes supported by this
PhoneAccount . |
boolean |
hasCapabilities(int capability)
Determines if this
PhoneAccount has a capabilities specified by the passed in
bit mask. |
boolean |
isEnabled()
Indicates whether the user has enabled this
PhoneAccount or not. |
void |
setIsEnabled(boolean isEnabled)
Sets the enabled state of the phone account.
|
boolean |
supportsUriScheme(String uriScheme)
Determines if the
PhoneAccount supports calls to/from addresses with a specified URI
scheme. |
PhoneAccount.Builder |
toBuilder()
Returns a builder initialized with the current
PhoneAccount instance. |
String |
toString()
Returns a string representation of the object.
|
void |
writeToParcel(Parcel out,
int flags)
Flatten this object in to a Parcel.
|
public static final String EXTRA_CALL_SUBJECT_MAX_LENGTH
PhoneAccount
extras key (see getExtras()
) which determines the
maximum permitted length of a call subject specified via the
TelecomManager.EXTRA_CALL_SUBJECT
extra on an
Intent.ACTION_CALL
intent. Ultimately a ConnectionService
is
responsible for enforcing the maximum call subject length when sending the message, however
this extra is provided so that the user interface can proactively limit the length of the
call subject as the user types it.public static final String EXTRA_CALL_SUBJECT_CHARACTER_ENCODING
PhoneAccount
extras key (see getExtras()
) which determines the
character encoding to be used when determining the length of messages.
The user interface can use this when determining the number of characters the user may type
in a call subject. If empty-string, the call subject message size limit will be enforced on
a 1:1 basis. That is, each character will count towards the messages size limit as a single
character. If a character encoding is specified, the message size limit will be based on the
number of bytes in the message per the specified encoding. See
EXTRA_CALL_SUBJECT_MAX_LENGTH
for more information on the call subject maximum
length.public static final int CAPABILITY_CONNECTION_MANAGER
PhoneAccount
can act as a connection manager for
other connections. The ConnectionService
associated with this PhoneAccount
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.
When a user opts to place a call using the SIM-based telephony stack, the
ConnectionService
associated with this PhoneAccount
will be attempted first
if the user has explicitly selected it to be used as the default connection manager.
public static final int CAPABILITY_CALL_PROVIDER
PhoneAccount
can make phone calls in place of
traditional SIM-based telephony calls. This account will be treated as a distinct method
for placing calls alongside the traditional SIM-based telephony stack. This flag is
distinct from CAPABILITY_CONNECTION_MANAGER
in that it is not allowed to manage
or place calls from the built-in telephony stack.
public static final int CAPABILITY_SIM_SUBSCRIPTION
PhoneAccount
represents a built-in PSTN SIM
subscription.
Only the Android framework can register a PhoneAccount
having this capability.
public static final int CAPABILITY_VIDEO_CALLING
PhoneAccount
is capable of placing video calls.
public static final int CAPABILITY_PLACE_EMERGENCY_CALLS
PhoneAccount
is capable of placing emergency calls.
By default all PSTN PhoneAccount
s are capable of placing emergency calls.
public static final int CAPABILITY_MULTI_USER
PhoneAccount
is capable of being used by all users. This
should only be used by system apps (and will be ignored for all other apps trying to use it).
public static final int CAPABILITY_CALL_SUBJECT
PhoneAccount
supports a subject for Calls. This means a
caller is able to specify a short subject line for an outgoing call. A capable receiving
device displays the call subject on the incoming call screen.
public static final int CAPABILITY_EMERGENCY_CALLS_ONLY
PhoneAccount
should only be used for emergency calls.
public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE
PhoneAccount
, the ability to make a video call to a
number relies on presence. Should only be set if the PhoneAccount
also has
CAPABILITY_VIDEO_CALLING
.
When set, the ConnectionService
is responsible for toggling the
ContactsContract.DataColumns.CARRIER_PRESENCE_VT_CAPABLE
bit on the
ContactsContract.DataColumns.CARRIER_PRESENCE
column to indicate whether
a contact's phone number supports video calling.
public static final int CAPABILITY_EMERGENCY_VIDEO_CALLING
PhoneAccount
, emergency video calling is allowed.
When set, Telecom will allow emergency video calls to be placed. When not set, Telecom will convert all outgoing video calls to emergency numbers to audio-only.
public static final String SCHEME_TEL
public static final String SCHEME_VOICEMAIL
public static final String SCHEME_SIP
public static final int NO_ICON_TINT
public static final int NO_HIGHLIGHT_COLOR
public static final int NO_RESOURCE_ID
public static final Parcelable.Creator<PhoneAccount> CREATOR
public static PhoneAccount.Builder builder(PhoneAccountHandle accountHandle, CharSequence label)
public PhoneAccount.Builder toBuilder()
PhoneAccount
instance.public PhoneAccountHandle getAccountHandle()
PhoneAccount
.PhoneAccountHandle
.public Uri getAddress()
PhoneAccount
. This
represents the destination from which outgoing calls using this PhoneAccount
will appear to come, if applicable, and the destination to which incoming calls using this
PhoneAccount
may be addressed.Uri
, for example, a phone number.public Uri getSubscriptionAddress()
PhoneAccount
, as distinct from
getAddress()
. For the majority of PhoneAccount
s this should be registered
as null
. It is used by the system for SIM-based PhoneAccount
registration
where TelephonyManager.setLine1NumberForDisplay(String, String)
has been used to alter the callback number.
public int getCapabilities()
PhoneAccount
.PhoneAccount
's capabilities.public boolean hasCapabilities(int capability)
PhoneAccount
has a capabilities specified by the passed in
bit mask.capability
- The capabilities to check.true
if the phone account has the capability.public CharSequence getLabel()
PhoneAccount
.PhoneAccount
.public CharSequence getShortDescription()
PhoneAccount
.PhoneAccount
.public List<String> getSupportedUriSchemes()
PhoneAccount
.public Bundle getExtras()
PhoneAccount
.
A ConnectionService
may provide implementation specific information about the
PhoneAccount
via the extras.
public Icon getIcon()
PhoneAccount
.public boolean isEnabled()
PhoneAccount
or not. This value is only
populated for PhoneAccount
s returned by TelecomManager.getPhoneAccount(android.telecom.PhoneAccountHandle)
.true
if the account is enabled by the user, false
otherwise.public String getGroupId()
String
representing the group that A PhoneAccount
is in or an
empty String
if the PhoneAccount
is not in a group. If this
PhoneAccount
is in a group, this new PhoneAccount
will replace a registered
PhoneAccount
that is in the same group. When the PhoneAccount
is replaced,
its user defined defaults and enabled status will also pass to this new PhoneAccount
.
Only PhoneAccount
s that share the same ConnectionService
can be replaced.PhoneAccount
belongs to a group.public boolean supportsUriScheme(String uriScheme)
PhoneAccount
supports calls to/from addresses with a specified URI
scheme.uriScheme
- The URI scheme to check.true
if the PhoneAccount
supports calls to/from addresses with the
specified URI scheme.public int getHighlightColor()
PhoneAccount
.public void setIsEnabled(boolean isEnabled)
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel out, int flags)
Parcelable
writeToParcel
in interface Parcelable
out
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())