summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHunter Knepshield <hknepshield@google.com>2022-01-19 02:25:06 -0800
committerJack Yu <jackyu@google.com>2022-08-12 18:22:29 +0000
commitd98616989e71e942658c71114191b260fd4166a0 (patch)
tree04eb57a01913e0bb76a6babb3f09d8ef8c847f48
parent1db210c09c29208236effde051090bc8dfb25f33 (diff)
downloadbase-d98616989e71e942658c71114191b260fd4166a0.tar.gz
APIs for SIM call manager voice status
This CL creates two new PhoneAccount capabilities for the SIM call manager (and potentially telephony itself for PSTN PhoneAccounts) to advertise that they support voice calling, potentially independent of voice service state. With this information, telecom will feed updated back into telephony for plumbing through the standard ServiceState-based APIs. Bug: 205737545 Test: atest android.telecom.cts.PhoneAccountOperationsTest (an additional CTS test for the TelephonyManager API will be added as a follow-up) Change-Id: If7a5b03a7aa630823ac238ef27721e5e6cc596e6 Merged-In: If7a5b03a7aa630823ac238ef27721e5e6cc596e6
-rw-r--r--core/api/current.txt2
-rw-r--r--core/api/test-current.txt1
-rw-r--r--telecomm/java/android/telecom/PhoneAccount.java50
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java34
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl6
5 files changed, 89 insertions, 4 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index e513bba57f9f..d6b095b6fbfd 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -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";
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 51ecd4cc61c6..8be445a11edd 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -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
}
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 1990b0162d26..ef4204d4541b 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
@@ -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();
+ }
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 20b9f3a5c8c5..56aa8191271c 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -2540,6 +2540,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
* declares one.