diff options
Diffstat (limited to 'src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java')
-rw-r--r-- | src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java b/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java index a3377a277b..ba69d8a7c0 100644 --- a/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +++ b/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java @@ -1069,6 +1069,8 @@ public class SubscriptionManagerService extends ISub.Stub { int subId = insertSubscriptionInfo(embeddedProfile.getIccid(), SubscriptionManager.INVALID_SIM_SLOT_INDEX, null, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); + mSubscriptionDatabaseManager.setDisplayName(subId, mContext.getResources() + .getString(R.string.default_card_name, subId)); subInfo = mSubscriptionDatabaseManager.getSubscriptionInfoInternal(subId); } @@ -1116,6 +1118,7 @@ public class SubscriptionManagerService extends ISub.Stub { // CARD_ID field should not contain the EID if (cardId >= 0 && mUiccController.getCardIdForDefaultEuicc() != TelephonyManager.UNSUPPORTED_CARD_ID) { + builder.setCardId(cardId); builder.setCardString(mUiccController.convertToCardString(cardId)); } @@ -1345,6 +1348,8 @@ public class SubscriptionManagerService extends ISub.Stub { // This is a new SIM card. Insert a new record. subId = insertSubscriptionInfo(iccId, phoneId, null, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); + mSubscriptionDatabaseManager.setDisplayName(subId, + mContext.getResources().getString(R.string.default_card_name, subId)); } else { subId = subInfo.getSubscriptionId(); log("updateSubscription: Found existing subscription. subId= " + subId @@ -1421,12 +1426,15 @@ public class SubscriptionManagerService extends ISub.Stub { } // Attempt to restore SIM specific settings when SIM is loaded. - mContext.getContentResolver().call( + Bundle result = mContext.getContentResolver().call( SubscriptionManager.SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI, SubscriptionManager.RESTORE_SIM_SPECIFIC_SETTINGS_METHOD_NAME, iccId, null); - log("Reload the database."); - mSubscriptionDatabaseManager.reloadDatabase(); + if (result != null && result.getBoolean( + SubscriptionManager.RESTORE_SIM_SPECIFIC_SETTINGS_DATABASE_UPDATED)) { + logl("Sim specific settings changed the database."); + mSubscriptionDatabaseManager.reloadDatabaseSync(); + } } log("updateSubscription: " + mSubscriptionDatabaseManager @@ -3562,10 +3570,10 @@ public class SubscriptionManagerService extends ISub.Stub { * * @param subId the unique SubscriptionInfo index in database * @return userHandle associated with this subscription - * or {@code null} if subscription is not associated with any user. + * or {@code null} if subscription is not associated with any user + * or {code null} if subscripiton is not available on the device. * * @throws SecurityException if doesn't have required permission. - * @throws IllegalArgumentException if {@code subId} is invalid. */ @Override @Nullable @@ -3578,8 +3586,7 @@ public class SubscriptionManagerService extends ISub.Stub { SubscriptionInfoInternal subInfo = mSubscriptionDatabaseManager .getSubscriptionInfoInternal(subId); if (subInfo == null) { - throw new IllegalArgumentException("getSubscriptionUserHandle: Invalid subId: " - + subId); + return null; } UserHandle userHandle = UserHandle.of(subInfo.getUserId()); @@ -3727,12 +3734,16 @@ public class SubscriptionManagerService extends ISub.Stub { Bundle bundle = new Bundle(); bundle.putByteArray(SubscriptionManager.KEY_SIM_SPECIFIC_SETTINGS_DATA, data); logl("restoreAllSimSpecificSettingsFromBackup"); - mContext.getContentResolver().call( + Bundle result = mContext.getContentResolver().call( SubscriptionManager.SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI, SubscriptionManager.RESTORE_SIM_SPECIFIC_SETTINGS_METHOD_NAME, null, bundle); - // After restoring, we need to reload the content provider into the cache. - mSubscriptionDatabaseManager.reloadDatabase(); + + if (result != null && result.getBoolean( + SubscriptionManager.RESTORE_SIM_SPECIFIC_SETTINGS_DATABASE_UPDATED)) { + logl("Sim specific settings changed the database."); + mSubscriptionDatabaseManager.reloadDatabaseSync(); + } } finally { Binder.restoreCallingIdentity(token); } |