summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-06-29 15:13:51 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-06-29 15:13:51 -0700
commit26c925693e2d60a91bd1f27969921bd8f8797068 (patch)
treee3c33c0370ea5359385c9896ec8751b87463fa43
parent505719d8c7eba3f810be42f0cd406e526893b52e (diff)
parented5b76a12e19c474ba8b157be9296fe6743933ad (diff)
Merge "Strip +1 when subscribing to VVM3"
am: ed5b76a12e Change-Id: Ifa0542fe81ce75129cd488727e7c55e4852060e9
-rw-r--r--java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
index 3bbda4797..41598e047 100644
--- a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
+++ b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
@@ -89,7 +89,7 @@ public class Vvm3Subscriber {
private static final String OPERATION_GET_SPG_URL = "retrieveSPGURL";
private static final String SPG_URL_TAG = "spgurl";
private static final String TRANSACTION_ID_TAG = "transactionid";
- //language=XML
+ // language=XML
private static final String VMG_XML_REQUEST_FORMAT =
""
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
@@ -159,6 +159,7 @@ public class Vvm3Subscriber {
}
@WorkerThread
+ @SuppressWarnings("missingPermission")
public Vvm3Subscriber(
ActivationTask task,
PhoneAccountHandle handle,
@@ -175,11 +176,23 @@ public class Vvm3Subscriber {
// Assuming getLine1Number() will work with VVM3. For unprovisioned users the IMAP username
// is not included in the status SMS, thus no other way to get the current phone number.
number =
- this.helper
- .getContext()
- .getSystemService(TelephonyManager.class)
- .createForPhoneAccountHandle(this.handle)
- .getLine1Number();
+ stripInternational(
+ this.helper
+ .getContext()
+ .getSystemService(TelephonyManager.class)
+ .createForPhoneAccountHandle(this.handle)
+ .getLine1Number());
+ }
+
+ /**
+ * Self provisioning gateway expects 10 digit national format, but {@link
+ * TelephonyManager#getLine1Number()} might return e164 with "+1" at front.
+ */
+ private static String stripInternational(String number) {
+ if (number.startsWith("+1")) {
+ number = number.substring(2);
+ }
+ return number;
}
@WorkerThread