Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f577b865 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Prevent apps from spamming addAccountExplicitly. See comment here for...

Merge "Prevent apps from spamming addAccountExplicitly. See comment here for the discussion on solution https://b.corp.google.com/issues/169762606#comment14" into rvc-dev am: c744a25d

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

Change-Id: I4c20720c9e9fe6925f9a17a453c736a008b49d41
parents bda0f78f c744a25d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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;
+5 −0
Original line number Diff line number Diff line
@@ -1820,6 +1820,11 @@ public class AccountManagerService
                                + ", skipping since the account already exists");
                        return false;
                    }
                    if (accounts.accountsDb.findAllDeAccounts().size() > 100) {
                        Log.w(TAG, "insertAccountIntoDatabase: " + account.toSafeString()
                                + ", skipping since more than 50 accounts on device exist");
                        return false;
                    }
                    long accountId = accounts.accountsDb.insertCeAccount(account, password);
                    if (accountId < 0) {
                        Log.w(TAG, "insertAccountIntoDatabase: " + account.toSafeString()