diff --git a/api/system-current.txt b/api/system-current.txt index 7cade61d9ad57..0581b7cdce48a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6875,12 +6875,18 @@ package android.telephony.ims { public class ProvisioningManager { method public static android.telephony.ims.ProvisioningManager createForSubscriptionId(android.content.Context, int); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getProvisioningIntValue(int); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getProvisioningStringValue(int); + method @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getProvisioningIntValue(int); + method @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getProvisioningStringValue(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerProvisioningChangedCallback(java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setProvisioningIntValue(int, int); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setProvisioningStringValue(int, String); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningIntValue(int, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, String); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.Callback); + field public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27; // 0x1b + field public static final int KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE = 26; // 0x1a + field public static final int PROVISIONING_VALUE_DISABLED = 0; // 0x0 + field public static final int PROVISIONING_VALUE_ENABLED = 1; // 0x1 + field public static final String STRING_QUERY_RESULT_ERROR_GENERIC = "STRING_QUERY_RESULT_ERROR_GENERIC"; + field public static final String STRING_QUERY_RESULT_ERROR_NOT_READY = "STRING_QUERY_RESULT_ERROR_NOT_READY"; } public static class ProvisioningManager.Callback { diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java index 9414abd98b1cd..5b2e635b179f6 100644 --- a/telephony/java/android/telephony/ims/ImsMmTelManager.java +++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java @@ -86,9 +86,7 @@ public class ImsMmTelManager { /** * Prefer registering for IMS over IWLAN if possible if WiFi signal quality is high enough. - * @hide */ - @SystemApi public static final int WIFI_MODE_WIFI_PREFERRED = 2; /** diff --git a/telephony/java/android/telephony/ims/ProvisioningManager.java b/telephony/java/android/telephony/ims/ProvisioningManager.java index d37198a3e25d2..210934cdda141 100644 --- a/telephony/java/android/telephony/ims/ProvisioningManager.java +++ b/telephony/java/android/telephony/ims/ProvisioningManager.java @@ -21,6 +21,7 @@ import android.annotation.CallbackExecutor; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemApi; +import android.annotation.WorkerThread; import android.content.Context; import android.os.Binder; import android.os.RemoteException; @@ -38,12 +39,67 @@ import java.util.concurrent.Executor; * to changes in these configurations. * * Note: IMS provisioning keys are defined per carrier or OEM using OMA-DM or other provisioning - * applications and may vary. + * applications and may vary. For compatibility purposes, the first 100 integer values used in + * {@link #setProvisioningIntValue(int, int)} have been reserved for existing provisioning keys + * previously defined in the Android framework. Some common constants have been defined in this + * class to make integrating with other system apps easier. USE WITH CARE! + * + * To avoid collisions, please use String based configurations when possible: + * {@link #setProvisioningStringValue(int, String)} and {@link #getProvisioningStringValue(int)}. * @hide */ @SystemApi public class ProvisioningManager { + /** + * The query from {@link #getProvisioningStringValue(int)} has resulted in an unspecified error. + */ + public static final String STRING_QUERY_RESULT_ERROR_GENERIC = + "STRING_QUERY_RESULT_ERROR_GENERIC"; + + /** + * The query from {@link #getProvisioningStringValue(int)} has resulted in an error because the + * ImsService implementation was not ready for provisioning queries. + */ + public static final String STRING_QUERY_RESULT_ERROR_NOT_READY = + "STRING_QUERY_RESULT_ERROR_NOT_READY"; + + /** + * The integer result of provisioning for the queried key is disabled. + */ + public static final int PROVISIONING_VALUE_DISABLED = 0; + + /** + * The integer result of provisioning for the queried key is enabled. + */ + public static final int PROVISIONING_VALUE_ENABLED = 1; + + + /** + * Override the user-defined WiFi Roaming enabled setting for this subscription, defined in + * {@link SubscriptionManager#WFC_ROAMING_ENABLED_CONTENT_URI}, for the purposes of provisioning + * the subscription for WiFi Calling. + * + * @see #getProvisioningIntValue(int) + * @see #setProvisioningIntValue(int, int) + */ + public static final int KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE = 26; + + /** + * Override the user-defined WiFi mode for this subscription, defined in + * {@link SubscriptionManager#WFC_MODE_CONTENT_URI}, for the purposes of provisioning + * this subscription for WiFi Calling. + * + * Valid values for this key are: + * {@link ImsMmTelManager#WIFI_MODE_WIFI_ONLY}, + * {@link ImsMmTelManager#WIFI_MODE_CELLULAR_PREFERRED}, or + * {@link ImsMmTelManager#WIFI_MODE_WIFI_PREFERRED}. + * + * @see #getProvisioningIntValue(int) + * @see #setProvisioningIntValue(int, int) + */ + public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27; + /** * Callback for IMS provisioning changes. */ @@ -180,10 +236,15 @@ public class ProvisioningManager { /** * Query for the integer value associated with the provided key. + * + * This operation is blocking and should not be performed on the UI thread. + * * @param key An integer that represents the provisioning key, which is defined by the OEM. - * @return an integer value for the provided key. + * @return an integer value for the provided key, or + * {@link ImsConfigImplBase#CONFIG_RESULT_UNKNOWN} if the key doesn't exist. * @throws IllegalArgumentException if the key provided was invalid. */ + @WorkerThread @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getProvisioningIntValue(int key) { try { @@ -195,10 +256,16 @@ public class ProvisioningManager { /** * Query for the String value associated with the provided key. - * @param key An integer that represents the provisioning key, which is defined by the OEM. - * @return a String value for the provided key, or {@code null} if the key doesn't exist. + * + * This operation is blocking and should not be performed on the UI thread. + * + * @param key A String that represents the provisioning key, which is defined by the OEM. + * @return a String value for the provided key, {@code null} if the key doesn't exist, or one + * of the following error codes: {@link #STRING_QUERY_RESULT_ERROR_GENERIC}, + * {@link #STRING_QUERY_RESULT_ERROR_NOT_READY}. * @throws IllegalArgumentException if the key provided was invalid. */ + @WorkerThread @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getProvisioningStringValue(int key) { try { @@ -210,10 +277,16 @@ public class ProvisioningManager { /** * Set the integer value associated with the provided key. + * + * This operation is blocking and should not be performed on the UI thread. + * + * Use {@link #setProvisioningStringValue(int, String)} with proper namespacing (to be defined + * per OEM or carrier) when possible instead to avoid key collision if needed. * @param key An integer that represents the provisioning key, which is defined by the OEM. * @param value a integer value for the provided key. * @return the result of setting the configuration value. */ + @WorkerThread @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public @ImsConfigImplBase.SetConfigResult int setProvisioningIntValue(int key, int value) { try { @@ -226,10 +299,14 @@ public class ProvisioningManager { /** * Set the String value associated with the provided key. * - * @param key An integer that represents the provisioning key, which is defined by the OEM. + * This operation is blocking and should not be performed on the UI thread. + * + * @param key A String that represents the provisioning key, which is defined by the OEM and + * should be appropriately namespaced to avoid collision. * @param value a String value for the provided key. * @return the result of setting the configuration value. */ + @WorkerThread @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public @ImsConfigImplBase.SetConfigResult int setProvisioningStringValue(int key, String value) { diff --git a/telephony/java/com/android/ims/ImsConfig.java b/telephony/java/com/android/ims/ImsConfig.java index 71a21743a449c..4fc6a19d1f385 100644 --- a/telephony/java/com/android/ims/ImsConfig.java +++ b/telephony/java/com/android/ims/ImsConfig.java @@ -277,12 +277,14 @@ public class ImsConfig { * Wi-Fi calling roaming status. * Value is in Integer format. ON (1), OFF(0). */ - public static final int VOICE_OVER_WIFI_ROAMING = 26; + public static final int VOICE_OVER_WIFI_ROAMING = + ProvisioningManager.KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE; /** * Wi-Fi calling modem - WfcModeFeatureValueConstants. * Value is in Integer format. */ - public static final int VOICE_OVER_WIFI_MODE = 27; + public static final int VOICE_OVER_WIFI_MODE = + ProvisioningManager.KEY_VOICE_OVER_WIFI_MODE_OVERRIDE; /** * VOLTE Status for voice over wifi status of Enabled (1), or Disabled (0). * Value is in Integer format.