diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-09-01 00:11:36 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-09-01 00:11:36 +0000 |
| commit | a0226b4d47787307a79759e471b9727cdd06ba05 (patch) | |
| tree | 678622f01eabad4daa490a3d5c4d74e2f76f8625 /core/java | |
| parent | b0fccf4d9d0bea39b9ad2d7163a65677d6d03cee (diff) | |
| parent | 5beff34b5738ee050d04ff5786e8c883bb5585f8 (diff) | |
Merge "Prevent apps from spamming addAccountExplicitly. See comment here for the discussion on solution https://b.corp.google.com/issues/169762606#comment14" into pi-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/accounts/Account.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/android/accounts/Account.java b/core/java/android/accounts/Account.java index 3f90f36fb2a1..1546ae14862d 100644 --- a/core/java/android/accounts/Account.java +++ b/core/java/android/accounts/Account.java @@ -28,6 +28,7 @@ import android.util.ArraySet; import android.util.Log; import com.android.internal.annotations.GuardedBy; +import java.util.Objects; import java.util.Set; /** @@ -80,6 +81,12 @@ public class Account implements Parcelable { if (TextUtils.isEmpty(type)) { throw new IllegalArgumentException("the type must not be empty: " + type); } + if (name.length() > 200) { + throw new IllegalArgumentException("account name is longer than 200 characters"); + } + if (type.length() > 200) { + throw new IllegalArgumentException("account type is longer than 200 characters"); + } this.name = name; this.type = type; this.accessId = accessId; |
