From 658d3c8b3ad1c10f243012531f05127de4874fa3 Mon Sep 17 00:00:00 2001 From: Shishir Agrawal Date: Wed, 17 Feb 2016 15:52:09 -0800 Subject: [PATCH] DO NOT MERGE: Multi-SIM - Fixing inconsistent naming in CarrierConfigManager. All MSIM specific calls should not use a suffix/prefix. Bug: 26772894 Change-Id: I49488dfc41bb7996a1a44447968ec11132e4dac7 --- api/current.txt | 6 ++- api/system-current.txt | 6 ++- .../telephony/CarrierConfigManager.java | 46 +++++++++++++++++-- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/api/current.txt b/api/current.txt index 9b95967e32e63..82c294ab5b0e8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -30565,9 +30565,11 @@ package android.telecom { package android.telephony { public class CarrierConfigManager { + method public android.os.PersistableBundle getConfig(int); method public android.os.PersistableBundle getConfig(); - method public android.os.PersistableBundle getConfigForSubId(int); - method public void notifyConfigChangedForSubId(int); + method public deprecated android.os.PersistableBundle getConfigForSubId(int); + method public void notifyConfigChanged(int); + method public deprecated void notifyConfigChangedForSubId(int); field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED"; field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool"; field public static final java.lang.String KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool"; diff --git a/api/system-current.txt b/api/system-current.txt index 4b606dce622d0..0bc4f64a6e3f8 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -32838,10 +32838,12 @@ package android.telecom { package android.telephony { public class CarrierConfigManager { + method public android.os.PersistableBundle getConfig(int); method public android.os.PersistableBundle getConfig(); - method public android.os.PersistableBundle getConfigForSubId(int); + method public deprecated android.os.PersistableBundle getConfigForSubId(int); method public static android.os.PersistableBundle getDefaultConfig(); - method public void notifyConfigChangedForSubId(int); + method public void notifyConfigChanged(int); + method public deprecated void notifyConfigChangedForSubId(int); method public void updateConfigForPhoneId(int, java.lang.String); field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED"; field public static final java.lang.String BOOL_ALLOW_EMERGENCY_VIDEO_CALLS = "bool_allow_emergency_video_calls"; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 581dfa246e60f..70e382025648c 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -685,9 +685,28 @@ public class CarrierConfigManager { * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}. * @return A {@link PersistableBundle} containing the config for the given subId, or default * values for an invalid subId. + * + * @deprecated use getConfig. */ @Nullable public PersistableBundle getConfigForSubId(int subId) { + return getConfig(subId); + } + + /** + * Gets the configuration values for a particular subscription, which is associated with a + * specific SIM card. If an invalid subId is used, the returned config will contain default + * values. + * + *

Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * + * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}. + * @return A {@link PersistableBundle} containing the config for the given subId, or default + * values for an invalid subId. + */ + @Nullable + public PersistableBundle getConfig(int subId) { try { return getICarrierConfigLoader().getConfigForSubId(subId); } catch (RemoteException ex) { @@ -706,11 +725,32 @@ public class CarrierConfigManager { *

Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * - * @see #getConfigForSubId + * @return A {@link PersistableBundle} containing the config for the default subscription. */ @Nullable public PersistableBundle getConfig() { - return getConfigForSubId(SubscriptionManager.getDefaultSubscriptionId()); + return getConfig(SubscriptionManager.getDefaultSubscriptionId()); + } + + /** + * Calling this method triggers telephony services to fetch the current carrier configuration. + *

+ * 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 + * moment. + *

+ *

Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges + *

+ * This method returns before the reload has completed, and + * {@link android.service.carrier.CarrierService#onLoadConfig} will be called from an + * arbitrary thread. + *

+ * + * @deprecated use notifyConfigChanged. + */ + public void notifyConfigChangedForSubId(int subId) { + notifyConfigChanged(subId); } /** @@ -728,7 +768,7 @@ public class CarrierConfigManager { * arbitrary thread. *

*/ - public void notifyConfigChangedForSubId(int subId) { + public void notifyConfigChanged(int subId) { try { getICarrierConfigLoader().notifyConfigChangedForSubId(subId); } catch (RemoteException ex) {