Update uses of PhoneAccount builder methods.
+ Parse the subscription number into a Uri to provide to the builder,
rather than providing the subscription number as a string.
Bug: 17390175
Bug: 17329632
Change-Id: If8829f7a2699d2a9a279b7bb8a8484af6d91d0a0
diff --git a/sip/src/com/android/services/telephony/sip/SipAccountRegistry.java b/sip/src/com/android/services/telephony/sip/SipAccountRegistry.java
index f830f67..6149231 100644
--- a/sip/src/com/android/services/telephony/sip/SipAccountRegistry.java
+++ b/sip/src/com/android/services/telephony/sip/SipAccountRegistry.java
@@ -30,6 +30,7 @@
import com.android.phone.R;
+import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -70,20 +71,19 @@
PhoneAccountHandle accountHandle =
SipUtil.createAccountHandle(context, mProfile.getUriString());
-
- PhoneAccount.Builder builder = PhoneAccount.builder()
- .withAccountHandle(accountHandle)
- .withCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
- .withHandle(Uri.parse(mProfile.getUriString()))
- .withLabel(mProfile.getDisplayName())
- .withShortDescription(mProfile.getDisplayName())
- .withIconResId(R.drawable.ic_dialer_sip_black_24dp)
- .withSupportedUriScheme(PhoneAccount.SCHEME_SIP);
-
+ List supportedUriSchemes = Arrays.asList(PhoneAccount.SCHEME_SIP);
if (useSipForPstnCalls) {
- builder.withSupportedUriScheme(PhoneAccount.SCHEME_TEL);
+ supportedUriSchemes.add(PhoneAccount.SCHEME_TEL);
}
+ PhoneAccount.Builder builder = PhoneAccount.builder(
+ accountHandle, mProfile.getDisplayName())
+ .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
+ .setAddress(Uri.parse(mProfile.getUriString()))
+ .setShortDescription(mProfile.getDisplayName())
+ .setIconResId(R.drawable.ic_dialer_sip_black_24dp)
+ .setSupportedUriSchemes(supportedUriSchemes);
+
return builder.build();
}
}
diff --git a/src/com/android/services/telephony/TelecommAccountRegistry.java b/src/com/android/services/telephony/TelecommAccountRegistry.java
index 1eaf6e1..0aba6b4 100644
--- a/src/com/android/services/telephony/TelecommAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecommAccountRegistry.java
@@ -33,6 +33,7 @@
import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.TelephonyIntents;
+import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -95,17 +96,16 @@
String description = isEmergency
? "Emergency calling only"
: dummyPrefix + "SIM card in slot " + slotId;
- PhoneAccount account = PhoneAccount.builder()
- .withAccountHandle(phoneAccountHandle)
- .withHandle(Uri.fromParts(PhoneAccount.SCHEME_TEL, line1Number, null))
- .withSubscriptionNumber(subNumber)
- .withCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
+ PhoneAccount account = PhoneAccount.builder(phoneAccountHandle, label)
+ .setAddress(Uri.fromParts(PhoneAccount.SCHEME_TEL, line1Number, null))
+ .setSubscriptionAddress(
+ Uri.fromParts(PhoneAccount.SCHEME_TEL, subNumber, null))
+ .setCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
PhoneAccount.CAPABILITY_CALL_PROVIDER)
- .withIconResId(getPhoneAccountIcon(slotId))
- .withLabel(label)
- .withShortDescription(description)
- .withSupportedUriScheme(PhoneAccount.SCHEME_TEL)
- .withSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
+ .setIconResId(getPhoneAccountIcon(slotId))
+ .setShortDescription(description)
+ .setSupportedUriSchemes(Arrays.asList(
+ PhoneAccount.SCHEME_TEL, PhoneAccount.SCHEME_VOICEMAIL))
.build();
// Register with Telecomm and put into the account entry.