Cross SIM configuration API

Provide Cross SIM calling configuration API

Bug: 173250451
Test: CTS
Change-Id: Ib97b6026604ae9203bae76f8d72caeae487ec99d
This commit is contained in:
Sooraj Sasindran
2020-11-23 19:33:52 -08:00
parent 2f01d3d29d
commit d16108783c
5 changed files with 132 additions and 0 deletions

View File

@@ -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<java.lang.Integer>);
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();

View File

@@ -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<java.lang.Boolean>) 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);

View File

@@ -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.
* <p>
* 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.
* <P>Type: TEXT (String)</P>

View File

@@ -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.
* <p>Following are the conditions in which system will try to register IMS over
* cross sim
* <ul>
* <li>Wifi is not available, one SIM is roaming and the default data
* SIM is in home network. Then roaming SIM IMS will be registered over INTERNET APN of the
* default data subscription </li>
* <li>Wifi is not available, one SIM is out of service and the default data
* SIM is in home network. Then out of service SIM IMS will be registered over INTERNET
* APN of the default data subscription </li>
* </ul>
* <p>This API requires one of the following:
* <ul>
* <li>The caller holds the READ_PRECISE_PHONE_STATE permission.</li>
* <li>If the caller is the device or profile owner, the caller holds the
* {@link Manifest.permission#READ_PRECISE_PHONE_STATE} permission.</li>
* <li>The caller has carrier privileges (see
* {@link android.telephony.TelephonyManager#hasCarrierPrivileges}) on any
* active subscription.</li>
* </ul>
* <p>The profile owner is an app that owns a managed profile on the device; for more details
* see <a href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
* 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.
*
* <p>Following are the conditions in which system will try to register IMS over
* cross sim
* <ul>
* <li>Wifi is not available, one SIM is roaming and the default data
* SIM is in home network. Then roaming SIM IMS will be registered over INTERNET APN of the
* default data subscription </li>
* <li>Wifi is not available, one SIM is out of service and the default data
* SIM is in home network. Then out of service SIM IMS will be registered over INTERNET
* APN of the default data subscription </li>
* </ul>
* @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.
*

View File

@@ -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.
*/