Expose Usage Setting API

Expose APIs as follows:
-A CarrierConfig key that allows carriers to override the
 device's usage setting.
-An API that allows callers to query the current usage setting
 for a given subscription.
-A set of constants to describe the usage setting.

Bug: 210023167
Test: atest SubscriptionManagerTest#testCellularUsageSetting;
Test: atest CarrierConfigManager#testGetConfig
Change-Id: I62534d6f304a297f646d1dd4b008a9a4d4a30560
diff --git a/core/api/current.txt b/core/api/current.txt
index 49689e4..952c866 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -41469,6 +41469,7 @@
     field public static final String KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY = "cdma_nonroaming_networks_string_array";
     field public static final String KEY_CDMA_ROAMING_MODE_INT = "cdma_roaming_mode_int";
     field public static final String KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY = "cdma_roaming_networks_string_array";
+    field public static final String KEY_CELLULAR_USAGE_SETTING_INT = "cellular_usage_setting_int";
     field public static final String KEY_CHECK_PRICING_WITH_CARRIER_FOR_DATA_ROAMING_BOOL = "check_pricing_with_carrier_data_roaming_bool";
     field public static final String KEY_CI_ACTION_ON_SYS_UPDATE_BOOL = "ci_action_on_sys_update_bool";
     field public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING = "ci_action_on_sys_update_extra_string";
@@ -43085,6 +43086,7 @@
     method public int getSimSlotIndex();
     method public int getSubscriptionId();
     method public int getSubscriptionType();
+    method public int getUsageSetting();
     method public boolean isEmbedded();
     method public boolean isOpportunistic();
     method public void writeToParcel(android.os.Parcel, int);
@@ -43159,6 +43161,10 @@
     field public static final int PHONE_NUMBER_SOURCE_UICC = 1; // 0x1
     field public static final int SUBSCRIPTION_TYPE_LOCAL_SIM = 0; // 0x0
     field public static final int SUBSCRIPTION_TYPE_REMOTE_SIM = 1; // 0x1
+    field public static final int USAGE_SETTING_DATA_CENTRIC = 2; // 0x2
+    field public static final int USAGE_SETTING_DEFAULT = 0; // 0x0
+    field public static final int USAGE_SETTING_UNKNOWN = -1; // 0xffffffff
+    field public static final int USAGE_SETTING_VOICE_CENTRIC = 1; // 0x1
   }
 
   public static class SubscriptionManager.OnOpportunisticSubscriptionsChangedListener {
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 13d03f16..53261cb 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -4473,6 +4473,10 @@
      * network if the primary use case (voice or data) is not satisfied. Depending on the type
      * of device, it may operate in a voice or data-centric mode by default.
      *
+     * <p>Sets the usage setting in accordance with 3gpp 24.301 sec 4.3 and 3gpp 24.501 sec 4.3.
+     * Also refer to "UE's usage setting" as defined in 3gpp 24.301 section 3.1 and 3gpp 23.221
+     * Annex A.
+     *
      * Either omit this key or pass a value of
      * {@link SubscriptionManager#USAGE_SETTING_UNKNOWN unknown} to preserve the current setting.
      *
@@ -4480,8 +4484,6 @@
      * {@link SubscriptionManager#USAGE_SETTING_VOICE_CENTRIC voice-centric},
      * or {@link SubscriptionManager#USAGE_SETTING_DATA_CENTRIC data-centric}.
      * {@see SubscriptionInfo#getUsageSetting}
-     *
-     * @hide
      */
     public static final String KEY_CELLULAR_USAGE_SETTING_INT =
             "cellular_usage_setting_int";
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index 3cadcb8..c36eb2f 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -826,8 +826,6 @@
      * Get the usage setting for this subscription.
      *
      * @return the usage setting used for this subscription.
-     *
-     * @hide
      */
     public @UsageSetting int getUsageSetting() {
         return mUsageSetting;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 2e4bb9d..4e6a7a3 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1061,8 +1061,6 @@
      *
      * It may also be provided by a carrier that wishes to provide a value to avoid making any
      * settings changes.
-     *
-     * @hide
      */
     public static final int USAGE_SETTING_UNKNOWN = -1;
 
@@ -1076,22 +1074,24 @@
      * An opportunistic subscription will default to data-centric.
      *
      * {@see SubscriptionInfo#isOpportunistic}
-     *
-     * @hide
      */
     public static final int USAGE_SETTING_DEFAULT = 0;
 
     /**
      * This subscription is forced to voice-centric mode
      *
-     * @hide
+     * <p>Refer to voice-centric mode in 3gpp 24.301 sec 4.3 and 3gpp 24.501 sec 4.3.
+     * Also refer to "UE's usage setting" as defined in 3gpp 24.301 section 3.1 and 3gpp 23.221
+     * Annex A.
      */
     public static final int USAGE_SETTING_VOICE_CENTRIC = 1;
 
     /**
      * This subscription is forced to data-centric mode
      *
-     * @hide
+     * <p>Refer to data-centric mode in 3gpp 24.301 sec 4.3 and 3gpp 24.501 sec 4.3.
+     * Also refer to "UE's usage setting" as defined in 3gpp 24.301 section 3.1 and 3gpp 23.221
+     * Annex A.
      */
     public static final int USAGE_SETTING_DATA_CENTRIC = 2;