Merge "APIs for SIM call manager voice status"

This commit is contained in:
Jack Yu
2022-08-12 20:40:03 +00:00
committed by Gerrit Code Review
5 changed files with 89 additions and 4 deletions

View File

@@ -39102,8 +39102,10 @@ package android.telecom {
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_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
field public static final int CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS = 65536; // 0x10000
field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
field public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE = 256; // 0x100
field public static final int CAPABILITY_VOICE_CALLING_AVAILABLE = 131072; // 0x20000
field @NonNull public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
field public static final String EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE = "android.telecom.extra.ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE";
field public static final String EXTRA_ALWAYS_USE_VOIP_AUDIO_MODE = "android.telecom.extra.ALWAYS_USE_VOIP_AUDIO_MODE";

View File

@@ -2509,6 +2509,7 @@ package android.telephony {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
method public void setCarrierTestOverride(String, String, String, String, String, String, String, String, String);
method @RequiresPermission(android.Manifest.permission.BIND_TELECOM_CONNECTION_SERVICE) public void setVoiceServiceStateOverride(boolean);
field public static final int UNKNOWN_CARRIER_ID_LIST_VERSION = -1; // 0xffffffff
}

View File

@@ -380,7 +380,45 @@ public final class PhoneAccount implements Parcelable {
*/
public static final int CAPABILITY_CALL_COMPOSER = 0x8000;
/* NEXT CAPABILITY: 0x10000 */
/**
* Flag indicating that this {@link PhoneAccount} provides SIM-based voice calls, potentially as
* an over-the-top solution such as wi-fi calling.
*
* <p>Similar to {@link #CAPABILITY_SUPPORTS_VIDEO_CALLING}, this capability indicates this
* {@link PhoneAccount} has the ability to make voice calls (but not necessarily at this time).
* Whether this {@link PhoneAccount} can make a voice call is ultimately controlled by {@link
* #CAPABILITY_VOICE_CALLING_AVAILABLE}, which indicates whether this {@link PhoneAccount} is
* currently capable of making a voice call. Consider a case where, for example, a {@link
* PhoneAccount} supports making voice calls (e.g. {@link
* #CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS}), but a current lack of network connectivity
* prevents voice calls from being made (e.g. {@link #CAPABILITY_VOICE_CALLING_AVAILABLE}).
*
* <p>In order to declare this capability, this {@link PhoneAccount} must also declare {@link
* #CAPABILITY_SIM_SUBSCRIPTION} or {@link #CAPABILITY_CONNECTION_MANAGER} and satisfy the
* associated requirements.
*
* @see #CAPABILITY_VOICE_CALLING_AVAILABLE
* @see #getCapabilities
*/
public static final int CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS = 0x10000;
/**
* Flag indicating that this {@link PhoneAccount} is <em>currently</em> able to place SIM-based
* voice calls, similar to {@link #CAPABILITY_VIDEO_CALLING}.
*
* <p>See also {@link #CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS}, which indicates whether
* the {@code PhoneAccount} supports placing SIM-based voice calls or not.
*
* <p>In order to declare this capability, this {@link PhoneAccount} must also declare {@link
* #CAPABILITY_SIM_SUBSCRIPTION} or {@link #CAPABILITY_CONNECTION_MANAGER} and satisfy the
* associated requirements.
*
* @see #CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS
* @see #getCapabilities
*/
public static final int CAPABILITY_VOICE_CALLING_AVAILABLE = 0x20000;
/* NEXT CAPABILITY: 0x40000 */
/**
* URI scheme for telephone number URIs.
@@ -1102,14 +1140,20 @@ public final class PhoneAccount implements Parcelable {
sb.append("SimSub ");
}
if (hasCapabilities(CAPABILITY_RTT)) {
sb.append("Rtt");
sb.append("Rtt ");
}
if (hasCapabilities(CAPABILITY_ADHOC_CONFERENCE_CALLING)) {
sb.append("AdhocConf");
sb.append("AdhocConf ");
}
if (hasCapabilities(CAPABILITY_CALL_COMPOSER)) {
sb.append("CallComposer ");
}
if (hasCapabilities(CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS)) {
sb.append("SuppVoice ");
}
if (hasCapabilities(CAPABILITY_VOICE_CALLING_AVAILABLE)) {
sb.append("Voice ");
}
return sb.toString();
}

View File

@@ -150,7 +150,6 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* Provides access to information about the telephony services on
* the device. Applications can use the methods in this class to
@@ -16763,4 +16762,37 @@ public class TelephonyManager {
}
mTelephonyRegistryMgr.removeCarrierPrivilegesCallback(callback);
}
/**
* Sets a voice service state override from telecom based on the current {@link PhoneAccount}s
* registered. See {@link PhoneAccount#CAPABILITY_VOICE_CALLING_AVAILABLE}.
*
* <p>Currently, this API is only called to indicate over-the-top voice calling capability of
* the SIM call manager, which will get merged into {@link ServiceState#getState} and propagated
* to interested callers via {@link #getServiceState} and {@link
* TelephonyCallback.ServiceStateListener}.
*
* <p>If callers are truly interested in the actual device <-> tower connection status and not
* an overall "device can make voice calls" boolean, they can use {@link
* ServiceState#getNetworkRegistrationInfo} to check CS registration state.
*
* <p>TODO(b/215240050) In the future, this API will be removed and replaced with a new superset
* API to disentangle the "true" {@link ServiceState} meaning of "this is the connection status
* to the tower" from IMS registration state and over-the-top voice calling capabilities.
*
* @hide
*/
@TestApi
@RequiresPermission(Manifest.permission.BIND_TELECOM_CONNECTION_SERVICE)
public void setVoiceServiceStateOverride(boolean hasService) {
try {
ITelephony telephony = getITelephony();
if (telephony == null) {
throw new IllegalStateException("Telephony service is null");
}
telephony.setVoiceServiceStateOverride(getSubId(), hasService, getOpPackageName());
} catch (RemoteException ex) {
ex.rethrowAsRuntimeException();
}
}
}

View File

@@ -2539,6 +2539,12 @@ interface ITelephony {
*/
boolean isRcsProvisioningRequiredForCapability(int subId, int capability, int tech);
/**
* Sets a voice service state from telecom based on the current PhoneAccounts registered. See
* PhoneAccount#CAPABILITY_VOICE_CALLING_AVAILABLE.
*/
void setVoiceServiceStateOverride(int subId, boolean hasService, String callingPackage);
/**
* Returns the package name that provides the {@link CarrierService} implementation for the
* specified {@code logicalSlotIndex}, or {@code null} if no package with carrier privileges