Loading telephony/java/android/telephony/SmsManager.java +22 −8 Original line number Diff line number Diff line Loading @@ -951,8 +951,7 @@ public final class SmsManager { * @return associated subscription id */ public int getSubscriptionId() { final int subId = (mSubId == DEFAULT_SUBSCRIPTION_ID) ? getDefaultSmsSubscriptionId() : mSubId; final int subId = getSubIdOrDefault(); boolean isSmsSimPickActivityNeeded = false; final Context context = ActivityThread.currentApplication().getApplicationContext(); try { Loading Loading @@ -984,6 +983,17 @@ public final class SmsManager { return subId; } /** * @return the subscription ID associated with this {@link SmsManager} or the default set by the * user if this instance was created using {@link SmsManager#getDefault}. * * If there is no default set by the user, this method returns * {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}. */ private int getSubIdOrDefault() { return (mSubId == DEFAULT_SUBSCRIPTION_ID) ? getDefaultSmsSubscriptionId() : mSubId; } /** * Returns the ISms service, or throws an UnsupportedOperationException if * the service does not exist. Loading Loading @@ -1151,8 +1161,9 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.enableCellBroadcastForSubscriber( getSubscriptionId(), messageIdentifier, ranType); // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.enableCellBroadcastForSubscriber(getSubIdOrDefault(), messageIdentifier, ranType); } } catch (RemoteException ex) { // ignore it Loading Loading @@ -1187,8 +1198,9 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.disableCellBroadcastForSubscriber( getSubscriptionId(), messageIdentifier, ranType); // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.disableCellBroadcastForSubscriber(getSubIdOrDefault(), messageIdentifier, ranType); } } catch (RemoteException ex) { // ignore it Loading Loading @@ -1230,7 +1242,8 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.enableCellBroadcastRangeForSubscriber(getSubscriptionId(), // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.enableCellBroadcastRangeForSubscriber(getSubIdOrDefault(), startMessageId, endMessageId, ranType); } } catch (RemoteException ex) { Loading Loading @@ -1273,7 +1286,8 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.disableCellBroadcastRangeForSubscriber(getSubscriptionId(), // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.disableCellBroadcastRangeForSubscriber(getSubIdOrDefault(), startMessageId, endMessageId, ranType); } } catch (RemoteException ex) { Loading Loading
telephony/java/android/telephony/SmsManager.java +22 −8 Original line number Diff line number Diff line Loading @@ -951,8 +951,7 @@ public final class SmsManager { * @return associated subscription id */ public int getSubscriptionId() { final int subId = (mSubId == DEFAULT_SUBSCRIPTION_ID) ? getDefaultSmsSubscriptionId() : mSubId; final int subId = getSubIdOrDefault(); boolean isSmsSimPickActivityNeeded = false; final Context context = ActivityThread.currentApplication().getApplicationContext(); try { Loading Loading @@ -984,6 +983,17 @@ public final class SmsManager { return subId; } /** * @return the subscription ID associated with this {@link SmsManager} or the default set by the * user if this instance was created using {@link SmsManager#getDefault}. * * If there is no default set by the user, this method returns * {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}. */ private int getSubIdOrDefault() { return (mSubId == DEFAULT_SUBSCRIPTION_ID) ? getDefaultSmsSubscriptionId() : mSubId; } /** * Returns the ISms service, or throws an UnsupportedOperationException if * the service does not exist. Loading Loading @@ -1151,8 +1161,9 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.enableCellBroadcastForSubscriber( getSubscriptionId(), messageIdentifier, ranType); // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.enableCellBroadcastForSubscriber(getSubIdOrDefault(), messageIdentifier, ranType); } } catch (RemoteException ex) { // ignore it Loading Loading @@ -1187,8 +1198,9 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.disableCellBroadcastForSubscriber( getSubscriptionId(), messageIdentifier, ranType); // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.disableCellBroadcastForSubscriber(getSubIdOrDefault(), messageIdentifier, ranType); } } catch (RemoteException ex) { // ignore it Loading Loading @@ -1230,7 +1242,8 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.enableCellBroadcastRangeForSubscriber(getSubscriptionId(), // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.enableCellBroadcastRangeForSubscriber(getSubIdOrDefault(), startMessageId, endMessageId, ranType); } } catch (RemoteException ex) { Loading Loading @@ -1273,7 +1286,8 @@ public final class SmsManager { try { ISms iSms = getISmsService(); if (iSms != null) { success = iSms.disableCellBroadcastRangeForSubscriber(getSubscriptionId(), // If getSubIdOrDefault() returns INVALID, we will use the default phone internally. success = iSms.disableCellBroadcastRangeForSubscriber(getSubIdOrDefault(), startMessageId, endMessageId, ranType); } } catch (RemoteException ex) { Loading