Merge "Update javadoc of CarrierConfigManager"

This commit is contained in:
Rambo Wang
2021-11-09 23:44:42 +00:00
committed by Gerrit Code Review
2 changed files with 36 additions and 28 deletions

View File

@@ -40737,11 +40737,11 @@ package android.telephony {
} }
public class CarrierConfigManager { public class CarrierConfigManager {
method @Nullable public android.os.PersistableBundle getConfig(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.os.PersistableBundle getConfig();
method @Nullable public android.os.PersistableBundle getConfigByComponentForSubId(@NonNull String, int); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.os.PersistableBundle getConfigByComponentForSubId(@NonNull String, int);
method @Nullable public android.os.PersistableBundle getConfigForSubId(int); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.os.PersistableBundle getConfigForSubId(int);
method public static boolean isConfigForIdentifiedCarrier(android.os.PersistableBundle); method public static boolean isConfigForIdentifiedCarrier(android.os.PersistableBundle);
method public void notifyConfigChangedForSubId(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyConfigChangedForSubId(int);
field public static final String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED"; field public static final String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
field public static final int CARRIER_NR_AVAILABILITY_NSA = 1; // 0x1 field public static final int CARRIER_NR_AVAILABILITY_NSA = 1; // 0x1
field public static final int CARRIER_NR_AVAILABILITY_SA = 2; // 0x2 field public static final int CARRIER_NR_AVAILABILITY_SA = 2; // 0x2

View File

@@ -21,6 +21,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.RequiresPermission; import android.annotation.RequiresPermission;
import android.annotation.SuppressAutoDoc;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.annotation.SystemService; import android.annotation.SystemService;
@@ -5885,12 +5886,15 @@ public class CarrierConfigManager {
* any carrier specific configuration has been applied. * any carrier specific configuration has been applied.
* *
* <p>Requires Permission: * <p>Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}, or the calling app
* has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges()}).
* *
* @param subId the subscription ID, normally obtained from {@link SubscriptionManager}. * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}.
* @return A {@link PersistableBundle} containing the config for the given subId, or default * @return A {@link PersistableBundle} containing the config for the given subId, or default
* values for an invalid subId. * values for an invalid subId.
*/ */
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
@Nullable @Nullable
public PersistableBundle getConfigForSubId(int subId) { public PersistableBundle getConfigForSubId(int subId) {
try { try {
@@ -5979,10 +5983,13 @@ public class CarrierConfigManager {
* called to confirm whether any carrier specific configuration has been applied. * called to confirm whether any carrier specific configuration has been applied.
* *
* <p>Requires Permission: * <p>Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}, or the calling app
* has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges()}).
* *
* @see #getConfigForSubId * @see #getConfigForSubId
*/ */
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
@Nullable @Nullable
public PersistableBundle getConfig() { public PersistableBundle getConfig() {
return getConfigForSubId(SubscriptionManager.getDefaultSubscriptionId()); return getConfigForSubId(SubscriptionManager.getDefaultSubscriptionId());
@@ -5991,8 +5998,8 @@ public class CarrierConfigManager {
/** /**
* Determines whether a configuration {@link PersistableBundle} obtained from * Determines whether a configuration {@link PersistableBundle} obtained from
* {@link #getConfig()} or {@link #getConfigForSubId(int)} corresponds to an identified carrier. * {@link #getConfig()} or {@link #getConfigForSubId(int)} corresponds to an identified carrier.
* <p> *
* When an app receives the {@link CarrierConfigManager#ACTION_CARRIER_CONFIG_CHANGED} * <p>When an app receives the {@link CarrierConfigManager#ACTION_CARRIER_CONFIG_CHANGED}
* broadcast which informs it that the carrier configuration has changed, it is possible * broadcast which informs it that the carrier configuration has changed, it is possible
* that another reload of the carrier configuration has begun since the intent was sent. * that another reload of the carrier configuration has begun since the intent was sent.
* In this case, the carrier configuration the app fetches (e.g. via {@link #getConfig()}) * In this case, the carrier configuration the app fetches (e.g. via {@link #getConfig()})
@@ -6001,14 +6008,12 @@ public class CarrierConfigManager {
* return true because it may belong to another previous identified carrier. Users should * return true because it may belong to another previous identified carrier. Users should
* always call {@link #getConfig()} or {@link #getConfigForSubId(int)} after receiving the * always call {@link #getConfig()} or {@link #getConfigForSubId(int)} after receiving the
* broadcast {@link #ACTION_CARRIER_CONFIG_CHANGED}. * broadcast {@link #ACTION_CARRIER_CONFIG_CHANGED}.
* </p> *
* <p> * <p>After using {@link #getConfig()} or {@link #getConfigForSubId(int)} an app should always
* After using {@link #getConfig()} or {@link #getConfigForSubId(int)} an app should always
* use this method to confirm whether any carrier specific configuration has been applied. * use this method to confirm whether any carrier specific configuration has been applied.
* Especially when an app misses the broadcast {@link #ACTION_CARRIER_CONFIG_CHANGED} but it * Especially when an app misses the broadcast {@link #ACTION_CARRIER_CONFIG_CHANGED} but it
* still needs to get the current configuration, it must use this method to verify whether the * still needs to get the current configuration, it must use this method to verify whether the
* configuration is default or carrier overridden. * configuration is default or carrier overridden.
* </p>
* *
* @param bundle the configuration bundle to be checked. * @param bundle the configuration bundle to be checked.
* @return boolean true if any carrier specific configuration bundle has been applied, false * @return boolean true if any carrier specific configuration bundle has been applied, false
@@ -6020,19 +6025,20 @@ public class CarrierConfigManager {
/** /**
* Calling this method triggers telephony services to fetch the current carrier configuration. * Calling this method triggers telephony services to fetch the current carrier configuration.
* <p> *
* Normally this does not need to be called because the platform reloads config on its own. * <p>Normally this does not need to be called because the platform reloads config on its own.
* This should be called by a carrier service app if it wants to update config at an arbitrary * This should be called by a carrier service app if it wants to update config at an arbitrary
* moment. * moment.
* </p> *
* <p>Requires that the calling app has carrier privileges. * <p>Requires Permission:
* <p> * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or the calling app
* This method returns before the reload has completed, and * has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges()}).
* {@link android.service.carrier.CarrierService#onLoadConfig} will be called from an *
* arbitrary thread. * <p>This method returns before the reload has completed, and {@link
* </p> * android.service.carrier.CarrierService#onLoadConfig} will be called from an arbitrary thread.
* @see TelephonyManager#hasCarrierPrivileges
*/ */
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void notifyConfigChangedForSubId(int subId) { public void notifyConfigChangedForSubId(int subId) {
try { try {
ICarrierConfigLoader loader = getICarrierConfigLoader(); ICarrierConfigLoader loader = getICarrierConfigLoader();
@@ -6048,11 +6054,10 @@ public class CarrierConfigManager {
} }
/** /**
* Request the carrier config loader to update the cofig for phoneId. * Request the carrier config loader to update the config for phoneId.
* <p> *
* Depending on simState, the config may be cleared or loaded from config app. This is only used * <p>Depending on simState, the config may be cleared or loaded from config app. This is only
* by SubscriptionInfoUpdater. * used by SubscriptionInfoUpdater.
* </p>
* *
* @hide * @hide
*/ */
@@ -6123,13 +6128,16 @@ public class CarrierConfigManager {
* Gets the configuration values for a component using its prefix. * Gets the configuration values for a component using its prefix.
* *
* <p>Requires Permission: * <p>Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}, or the calling app
* has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges()}).
* *
* @param prefix prefix of the component. * @param prefix prefix of the component.
* @param subId the subscription ID, normally obtained from {@link SubscriptionManager}. * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}.
* *
* @see #getConfigForSubId * @see #getConfigForSubId
*/ */
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
@Nullable @Nullable
public PersistableBundle getConfigByComponentForSubId(@NonNull String prefix, int subId) { public PersistableBundle getConfigByComponentForSubId(@NonNull String prefix, int subId) {
PersistableBundle configs = getConfigForSubId(subId); PersistableBundle configs = getConfigForSubId(subId);