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 am: a0226b4d47 am: b65ac540d2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405290

Change-Id: Ib461e405d5bd65840fb4f1e962cdd5d1061a882f
This commit is contained in:
TreeHugger Robot
2021-09-01 00:49:59 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ import android.util.Log;
import com.android.internal.annotations.GuardedBy;
import java.util.Objects;
import java.util.Set;
/**
@@ -85,6 +86,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;