diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3c1e25d7df..e5458b8a4d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -863,6 +863,7 @@
Unsecured SMS
Unsecured MMS
From %1$s
+ SIM %1$d
Send
Message composition
Toggle emoji keyboard
diff --git a/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java b/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java
index 789d2405b0..1d462a9a74 100644
--- a/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java
+++ b/src/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java
@@ -8,12 +8,11 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.util.ServiceUtil;
import org.whispersystems.libsignal.util.guava.Function;
import org.whispersystems.libsignal.util.guava.Optional;
-import org.whispersystems.signalservice.api.util.InvalidNumberException;
-import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
import java.util.Collection;
import java.util.Collections;
@@ -90,16 +89,18 @@ public final class SubscriptionManagerCompat {
}
@RequiresApi(api = 22)
- private static Map getDescriptionsFor(@NonNull Collection subscriptions) {
+ private Map getDescriptionsFor(@NonNull Collection subscriptions) {
Map descriptions;
descriptions = createDescriptionMap(subscriptions, SubscriptionInfo::getDisplayName);
if (hasNoDuplicates(descriptions.values())) return descriptions;
- descriptions = createDescriptionMap(subscriptions, SubscriptionInfo::getCarrierName);
- if (hasNoDuplicates(descriptions.values())) return descriptions;
+ return createDescriptionMap(subscriptions, this::describeSimIndex);
+ }
- return createDescriptionMap(subscriptions, (subscriptionInfo) -> formatNumber(subscriptionInfo.getNumber()));
+ @RequiresApi(api = 22)
+ private String describeSimIndex(SubscriptionInfo info) {
+ return context.getString(R.string.conversation_activity__sim_n, info.getSimSlotIndex() + 1);
}
private static Map createDescriptionMap(@NonNull Collection subscriptions,
@@ -123,14 +124,6 @@ public final class SubscriptionManagerCompat {
return true;
}
- private static String formatNumber(String number) {
- try {
- return PhoneNumberFormatter.formatNumber(number, number);
- } catch (InvalidNumberException e) {
- return number;
- }
- }
-
private boolean isReady(@NonNull SubscriptionInfo subscriptionInfo) {
if (Build.VERSION.SDK_INT < 24) return true;