diff options
| author | 2022-01-26 06:37:08 +0000 | |
|---|---|---|
| committer | 2022-01-26 06:37:08 +0000 | |
| commit | b476f8b522089a76dbd41b147ccf7ff641210c4f (patch) | |
| tree | 6cb3c4a8927a8c79afdfc2eb573b690ae97c8483 | |
| parent | 92d4b9f7951b7cbd779ba1afba75e1936ed9b909 (diff) | |
| parent | 2526568630228e3f7c11a16aef7afae6e69de4ba (diff) | |
Merge "APIs for SIM call manager voice status"
| -rw-r--r-- | core/api/current.txt | 2 | ||||
| -rw-r--r-- | core/api/test-current.txt | 1 | ||||
| -rw-r--r-- | telecomm/java/android/telecom/PhoneAccount.java | 50 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 34 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 6 |
5 files changed, 89 insertions, 4 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 413132f3f3e3..f08d68421282 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -40048,8 +40048,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"; diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 6a9d807aee68..8190880c0700 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -2499,6 +2499,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 } diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index e332d3ff2b4d..ec18c6a696b8 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -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(); } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 536517c12313..edb817e33ac1 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -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 @@ -16805,4 +16804,37 @@ public class TelephonyManager { } mTelephonyRegistryMgr.removeCarrierPrivilegesListener(listener); } + + /** + * 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(); + } + } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index bce7a246463d..dc96b3585864 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -2543,4 +2543,10 @@ interface ITelephony { * registration technology specified, false if it is not required. */ 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); } |