Loading telephony/java/android/telephony/SubscriptionManager.java +19 −30 Original line number Diff line number Diff line Loading @@ -140,6 +140,10 @@ public class SubscriptionManager { public static final String CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY = "cache_key.telephony.get_default_data_sub_id"; /** @hide */ public static final String CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY = "cache_key.telephony.get_default_sms_sub_id"; /** @hide */ public static final String CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY = "cache_key.telephony.get_active_data_sub_id"; Loading Loading @@ -190,13 +194,15 @@ public class SubscriptionManager { CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY, INVALID_SUBSCRIPTION_ID); private static PropertyInvalidatedCache<Void, Integer> sDefaultSmsSubIdCache = new SubscriptionPropertyInvalidatedCache<>(ISub::getDefaultSmsSubId, CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY, INVALID_SUBSCRIPTION_ID); private static PropertyInvalidatedCache<Void, Integer> sActiveDataSubIdCache = new PropertyInvalidatedCache<Void, Integer>( MAX_CACHE_SIZE, CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY) { @Override protected Integer recompute(Void query) { return getActiveDataSubscriptionIdInternal(); }}; new SubscriptionPropertyInvalidatedCache<>(ISub::getActiveDataSubscriptionId, CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY, INVALID_SUBSCRIPTION_ID); /** * Generates a content {@link Uri} used to receive updates on simInfo change Loading Loading @@ -2001,19 +2007,7 @@ public class SubscriptionManager { * @return the default SMS subscription Id. */ public static int getDefaultSmsSubscriptionId() { int subId = INVALID_SUBSCRIPTION_ID; try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { subId = iSub.getDefaultSmsSubId(); } } catch (RemoteException ex) { // ignore it } if (VDBG) logd("getDefaultSmsSubscriptionId, sub id = " + subId); return subId; return sDefaultSmsSubIdCache.query(null); } /** Loading Loading @@ -3301,17 +3295,6 @@ public class SubscriptionManager { return sActiveDataSubIdCache.query(null); } private static int getActiveDataSubscriptionIdInternal() { try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { return iSub.getActiveDataSubscriptionId(); } } catch (RemoteException ex) { } return SubscriptionManager.INVALID_SUBSCRIPTION_ID; } /** * Helper method that puts a subscription id on an intent with the constants: * PhoneConstant.SUBSCRIPTION_KEY and SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX. Loading @@ -3337,6 +3320,11 @@ public class SubscriptionManager { PropertyInvalidatedCache.invalidateCache(CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY); } /** @hide */ public static void invalidateDefaultSmsSubIdCaches() { PropertyInvalidatedCache.invalidateCache(CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY); } /** @hide */ public static void invalidateActiveDataSubIdCaches() { PropertyInvalidatedCache.invalidateCache(CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY); Loading @@ -3351,5 +3339,6 @@ public class SubscriptionManager { sDefaultSubIdCache.disableLocal(); sDefaultDataSubIdCache.disableLocal(); sActiveDataSubIdCache.disableLocal(); sDefaultSmsSubIdCache.disableLocal(); } } telephony/java/android/telephony/TelephonyManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -13104,6 +13104,7 @@ public class TelephonyManager { SubscriptionManager.invalidateDefaultSubIdCaches(); SubscriptionManager.invalidateDefaultDataSubIdCaches(); SubscriptionManager.invalidateActiveDataSubIdCaches(); SubscriptionManager.invalidateDefaultSmsSubIdCaches(); } if (sISms != null) { sISms.asBinder().unlinkToDeath(sServiceDeath, 0); Loading Loading
telephony/java/android/telephony/SubscriptionManager.java +19 −30 Original line number Diff line number Diff line Loading @@ -140,6 +140,10 @@ public class SubscriptionManager { public static final String CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY = "cache_key.telephony.get_default_data_sub_id"; /** @hide */ public static final String CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY = "cache_key.telephony.get_default_sms_sub_id"; /** @hide */ public static final String CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY = "cache_key.telephony.get_active_data_sub_id"; Loading Loading @@ -190,13 +194,15 @@ public class SubscriptionManager { CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY, INVALID_SUBSCRIPTION_ID); private static PropertyInvalidatedCache<Void, Integer> sDefaultSmsSubIdCache = new SubscriptionPropertyInvalidatedCache<>(ISub::getDefaultSmsSubId, CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY, INVALID_SUBSCRIPTION_ID); private static PropertyInvalidatedCache<Void, Integer> sActiveDataSubIdCache = new PropertyInvalidatedCache<Void, Integer>( MAX_CACHE_SIZE, CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY) { @Override protected Integer recompute(Void query) { return getActiveDataSubscriptionIdInternal(); }}; new SubscriptionPropertyInvalidatedCache<>(ISub::getActiveDataSubscriptionId, CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY, INVALID_SUBSCRIPTION_ID); /** * Generates a content {@link Uri} used to receive updates on simInfo change Loading Loading @@ -2001,19 +2007,7 @@ public class SubscriptionManager { * @return the default SMS subscription Id. */ public static int getDefaultSmsSubscriptionId() { int subId = INVALID_SUBSCRIPTION_ID; try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { subId = iSub.getDefaultSmsSubId(); } } catch (RemoteException ex) { // ignore it } if (VDBG) logd("getDefaultSmsSubscriptionId, sub id = " + subId); return subId; return sDefaultSmsSubIdCache.query(null); } /** Loading Loading @@ -3301,17 +3295,6 @@ public class SubscriptionManager { return sActiveDataSubIdCache.query(null); } private static int getActiveDataSubscriptionIdInternal() { try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { return iSub.getActiveDataSubscriptionId(); } } catch (RemoteException ex) { } return SubscriptionManager.INVALID_SUBSCRIPTION_ID; } /** * Helper method that puts a subscription id on an intent with the constants: * PhoneConstant.SUBSCRIPTION_KEY and SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX. Loading @@ -3337,6 +3320,11 @@ public class SubscriptionManager { PropertyInvalidatedCache.invalidateCache(CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY); } /** @hide */ public static void invalidateDefaultSmsSubIdCaches() { PropertyInvalidatedCache.invalidateCache(CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY); } /** @hide */ public static void invalidateActiveDataSubIdCaches() { PropertyInvalidatedCache.invalidateCache(CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY); Loading @@ -3351,5 +3339,6 @@ public class SubscriptionManager { sDefaultSubIdCache.disableLocal(); sDefaultDataSubIdCache.disableLocal(); sActiveDataSubIdCache.disableLocal(); sDefaultSmsSubIdCache.disableLocal(); } }
telephony/java/android/telephony/TelephonyManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -13104,6 +13104,7 @@ public class TelephonyManager { SubscriptionManager.invalidateDefaultSubIdCaches(); SubscriptionManager.invalidateDefaultDataSubIdCaches(); SubscriptionManager.invalidateActiveDataSubIdCaches(); SubscriptionManager.invalidateDefaultSmsSubIdCaches(); } if (sISms != null) { sISms.asBinder().unlinkToDeath(sServiceDeath, 0); Loading