diff --git a/core/api/current.txt b/core/api/current.txt index 32134fcf20262..2c095ebd34516 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -42360,6 +42360,7 @@ package android.telephony.ims { method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getVoWiFiModeSetting(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isAdvancedCallingSettingEnabled(); + method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isCrossSimCallingEnabledByUser() throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isTtyOverVolteEnabled(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVoWiFiRoamingSettingEnabled(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVoWiFiSettingEnabled(); diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 473a2808cd00a..370751c796da5 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -11089,6 +11089,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUiccApplicationsEnabled(int, boolean); field @RequiresPermission(android.Manifest.permission.MANAGE_SUBSCRIPTION_PLANS) public static final String ACTION_SUBSCRIPTION_PLANS_CHANGED = "android.telephony.action.SUBSCRIPTION_PLANS_CHANGED"; field @NonNull public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI; + field @NonNull public static final android.net.Uri CROSS_SIM_ENABLED_CONTENT_URI; field @Deprecated public static final int PROFILE_CLASS_DEFAULT = -1; // 0xffffffff field public static final int PROFILE_CLASS_OPERATIONAL = 2; // 0x2 field public static final int PROFILE_CLASS_PROVISIONING = 1; // 0x1 @@ -12278,6 +12279,7 @@ package android.telephony.ims { method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void isSupported(int, int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer) throws android.telephony.ims.ImsException; method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAdvancedCallingSettingEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCrossSimCallingEnabled(boolean) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRttCapabilitySetting(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiModeSetting(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiNonPersistent(boolean, int); diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 904232b54b8f5..d4c2bc9d9b8b4 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -372,6 +372,26 @@ public class SubscriptionManager { public static final Uri WFC_ROAMING_ENABLED_CONTENT_URI = Uri.withAppendedPath( CONTENT_URI, "wfc_roaming_enabled"); + /** + * A content {@link Uri} used to receive updates on cross sim enabled user setting. + *

+ * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the + * subscription cross sim calling enabled + * {@link ImsMmTelManager#isCrossSimCallingEnabledByUser()} + * while your app is running. You can also use a {@link android.app.job.JobService} + * to ensure your app + * is notified of changes to the {@link Uri} even when it is not running. + * Note, however, that using a {@link android.app.job.JobService} does not guarantee timely + * delivery of updates to the {@link Uri}. + * To be notified of changes to a specific subId, append subId to the URI + * {@link Uri#withAppendedPath(Uri, String)}. + * @hide + */ + @NonNull + @SystemApi + public static final Uri CROSS_SIM_ENABLED_CONTENT_URI = Uri.withAppendedPath(CONTENT_URI, + SimInfo.COLUMN_CROSS_SIM_CALLING_ENABLED); + /** * TelephonyProvider unique key column name is the subscription id. *

Type: TEXT (String)

diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java index 218875e347c73..fe443f8a410ee 100644 --- a/telephony/java/android/telephony/ims/ImsMmTelManager.java +++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java @@ -978,6 +978,105 @@ public class ImsMmTelManager implements RegistrationManager { } } + /** + * This configuration is meaningful only on dual sim device. + * If enabled, this will result in the device setting up IMS of all other + * active subscriptions over the INTERNET APN of the primary default data subscription + * when any of those subscriptions are roaming or out of service and if wifi is not available + * for VoWifi. This feature will be disabled if + * {@link CarrierConfigManager#KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL} is set to false. + *

Following are the conditions in which system will try to register IMS over + * cross sim + *

+ *

This API requires one of the following: + *

+ *

The profile owner is an app that owns a managed profile on the device; for more details + * see Work profiles. + * Access by profile owners is deprecated and will be removed in a future release. + * + * @throws ImsException if the IMS service associated with this subscription is not available or + * the IMS service is not available. + * @return true if the user's setting for Voice over Cross SIM is enabled and false if it is not + */ + @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). + @RequiresPermission(anyOf = { + android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, + android.Manifest.permission.READ_PRECISE_PHONE_STATE}) + public boolean isCrossSimCallingEnabledByUser() throws ImsException { + ITelephony iTelephony = getITelephony(); + if (iTelephony == null) { + throw new ImsException("Could not find Telephony Service.", + ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); + } + + try { + return iTelephony.isCrossSimCallingEnabledByUser(mSubId); + } catch (ServiceSpecificException sse) { + throw new ImsException(sse.getMessage(), sse.errorCode); + } catch (RemoteException e) { + e.rethrowAsRuntimeException(); + } + // Not reachable. Adding return to make compiler happy. + return false; + } + + /** + * Sets the user's setting for whether or not Voice over Cross SIM is enabled. + * If enabled, this will result in the device setting up IMS of all other + * active subscriptions over the INTERNET APN of the primary default data subscription + * when any of those subscriptions are roaming or out of service and if wifi is not available + * for VoWifi. This feature will be disabled if + * {@link CarrierConfigManager#KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL} is set to false. + * + *

Following are the conditions in which system will try to register IMS over + * cross sim + *

+ * @throws ImsException if the IMS service associated with this subscription is not available or + * the IMS service is not available. + * @param isEnabled true if the user's setting for Voice over Cross SIM is enabled, + * false otherwise + * @see #isCrossSimCallingEnabledByUser() + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + public void setCrossSimCallingEnabled(boolean isEnabled) throws ImsException { + ITelephony iTelephony = getITelephony(); + if (iTelephony == null) { + throw new ImsException("Could not find Telephony Service.", + ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); + } + + try { + iTelephony.setCrossSimCallingEnabled(mSubId, isEnabled); + } catch (ServiceSpecificException sse) { + throw new ImsException(sse.getMessage(), sse.errorCode); + } catch (RemoteException e) { + e.rethrowAsRuntimeException(); + } + } + /** * Returns the user's voice over WiFi roaming setting associated with the current subscription. * diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 74753ca1560a3..d6dbcb139b3a6 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1963,6 +1963,16 @@ interface ITelephony { */ void setVoWiFiSettingEnabled(int subId, boolean isEnabled); + /** + * return true if the user's setting for Voice over Cross SIM is enabled and false if it is not + */ + boolean isCrossSimCallingEnabledByUser(int subId); + + /** + * Sets the user's setting for whether or not Voice over Cross SIM is enabled. + */ + void setCrossSimCallingEnabled(int subId, boolean isEnabled); + /** * return true if the user's setting for Voice over WiFi while roaming is enabled. */