Fix implicit locale string formatting bugs

Depending on the phone language the default format may use Arabic
numerals, etc. when not desired.

Bug: fixes #7006
Closes #7040
This commit is contained in:
Veeti Paananen
2017-10-04 19:32:32 +03:00
committed by Moxie Marlinspike
parent 9a876a3672
commit eb456ef2b0
3 changed files with 7 additions and 3 deletions

View File

@@ -6,6 +6,8 @@ import android.net.ConnectivityManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import java.util.Locale;
public class TelephonyUtil {
private static final String TAG = TelephonyUtil.class.getSimpleName();
@@ -25,7 +27,7 @@ public class TelephonyUtil {
return tm.getNetworkOperator();
} else if (configMcc != 0 && configMnc != 0) {
Log.w(TAG, "Choosing MCC+MNC info from current context's Configuration");
return String.format("%03d%d",
return String.format(Locale.ROOT, "%03d%d",
configMcc,
configMnc == Configuration.MNC_ZERO ? 0 : configMnc);
} else {