Skip to content

Commit 359170f

Browse files
ThomasStuartAndroid Build Coastguard Worker
authored andcommitted
enforce stricter rules when registering phoneAccounts
- include disable accounts when looking up accounts for a package to check if the limit is reached (10) - put a new limit of 10 supported schemes - put a new limit of 256 characters per scheme - put a new limit of 256 characters per address - ensure the Icon can write to memory w/o throwing an exception bug: 259064622 bug: 256819769 Test: cts + unit (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b07326f1fb3d0e42a6bab902c271974c42d93c06) Merged-In: Ia7d8d00d9de0fb6694ded6a80c40bd55d7fdf7a7 Change-Id: Ia7d8d00d9de0fb6694ded6a80c40bd55d7fdf7a7
1 parent e211ac0 commit 359170f

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

telecomm/java/android/telecom/PhoneAccount.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,11 @@ public Builder setLabel(CharSequence label) {
555555

556556
/**
557557
* Sets the address. See {@link PhoneAccount#getAddress}.
558+
* <p>
559+
* Note: The entire URI value is limited to 256 characters. This check is
560+
* enforced when registering the PhoneAccount via
561+
* {@link TelecomManager#registerPhoneAccount(PhoneAccount)} and will cause an
562+
* {@link IllegalArgumentException} to be thrown if URI is over 256.
558563
*
559564
* @param value The address of the phone account.
560565
* @return The builder.
@@ -588,6 +593,10 @@ public Builder setCapabilities(int value) {
588593

589594
/**
590595
* Sets the icon. See {@link PhoneAccount#getIcon}.
596+
* <p>
597+
* Note: An {@link IllegalArgumentException} if the Icon cannot be written to memory.
598+
* This check is enforced when registering the PhoneAccount via
599+
* {@link TelecomManager#registerPhoneAccount(PhoneAccount)}
591600
*
592601
* @param icon The icon to set.
593602
*/
@@ -621,6 +630,10 @@ public Builder setShortDescription(CharSequence value) {
621630
/**
622631
* Specifies an additional URI scheme supported by the {@link PhoneAccount}.
623632
*
633+
* <p>
634+
* Each URI scheme is limited to 256 characters. Adding a scheme over 256 characters will
635+
* cause an {@link IllegalArgumentException} to be thrown when the account is registered.
636+
*
624637
* @param uriScheme The URI scheme.
625638
* @return The builder.
626639
*/
@@ -634,6 +647,12 @@ public Builder addSupportedUriScheme(String uriScheme) {
634647
/**
635648
* Specifies the URI schemes supported by the {@link PhoneAccount}.
636649
*
650+
* <p>
651+
* A max of 10 URI schemes can be added per account. Additionally, each URI scheme is
652+
* limited to 256 characters. Adding more than 10 URI schemes or 256 characters on any
653+
* scheme will cause an {@link IllegalArgumentException} to be thrown when the account
654+
* is registered.
655+
*
637656
* @param uriSchemes The URI schemes.
638657
* @return The builder.
639658
*/

0 commit comments

Comments
 (0)