Loading core/java/android/accounts/Account.java +7 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; import java.util.Objects; import java.util.Set; /** Loading Loading @@ -86,6 +87,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; Loading services/core/java/com/android/server/accounts/AccountManagerService.java +0 −12 Original line number Diff line number Diff line Loading @@ -1820,14 +1820,6 @@ public class AccountManagerService if (account == null) { return false; } if (account.name != null && account.name.length() > 200) { Log.w(TAG, "Account cannot be added - Name longer than 200 chars"); return false; } if (account.type != null && account.type.length() > 200) { Log.w(TAG, "Account cannot be added - Name longer than 200 chars"); return false; } if (!isLocalUnlockedUser(accounts.userId)) { Log.w(TAG, "Account " + account.toSafeString() + " cannot be added - user " + accounts.userId + " is locked. callingUid=" + callingUid); Loading Loading @@ -2103,10 +2095,6 @@ public class AccountManagerService private Account renameAccountInternal( UserAccounts accounts, Account accountToRename, String newName) { Account resultAccount = null; if (newName != null && newName.length() > 200) { Log.e(TAG, "renameAccount failed - account name longer than 200"); return null; } /* * Cancel existing notifications. Let authenticators * re-post notifications as required. But we don't know if Loading services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java +0 −22 Original line number Diff line number Diff line Loading @@ -247,28 +247,6 @@ public class AccountManagerServiceTest extends AndroidTestCase { assertEquals(a31, accounts[1]); } @SmallTest public void testCheckAddAccountLongName() throws Exception { unlockSystemUser(); String longString = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaa"; Account a11 = new Account(longString, AccountManagerServiceTestFixtures.ACCOUNT_TYPE_1); Account a21 = new Account("account2", longString); mAms.addAccountExplicitly( a11, /* password= */ "p11", /* extras= */ null, /* callerPackage= */ null); mAms.addAccountExplicitly( a21, /* password= */ "p12", /* extras= */ null, /* callerPackage= */ null); String[] list = new String[]{AccountManagerServiceTestFixtures.CALLER_PACKAGE}; when(mMockPackageManager.getPackagesForUid(anyInt())).thenReturn(list); Account[] accounts = mAms.getAccountsAsUser(null, UserHandle.getCallingUserId(), mContext.getOpPackageName()); assertEquals(0, accounts); } @SmallTest public void testPasswords() throws Exception { unlockSystemUser(); Loading Loading
core/java/android/accounts/Account.java +7 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; import java.util.Objects; import java.util.Set; /** Loading Loading @@ -86,6 +87,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; Loading
services/core/java/com/android/server/accounts/AccountManagerService.java +0 −12 Original line number Diff line number Diff line Loading @@ -1820,14 +1820,6 @@ public class AccountManagerService if (account == null) { return false; } if (account.name != null && account.name.length() > 200) { Log.w(TAG, "Account cannot be added - Name longer than 200 chars"); return false; } if (account.type != null && account.type.length() > 200) { Log.w(TAG, "Account cannot be added - Name longer than 200 chars"); return false; } if (!isLocalUnlockedUser(accounts.userId)) { Log.w(TAG, "Account " + account.toSafeString() + " cannot be added - user " + accounts.userId + " is locked. callingUid=" + callingUid); Loading Loading @@ -2103,10 +2095,6 @@ public class AccountManagerService private Account renameAccountInternal( UserAccounts accounts, Account accountToRename, String newName) { Account resultAccount = null; if (newName != null && newName.length() > 200) { Log.e(TAG, "renameAccount failed - account name longer than 200"); return null; } /* * Cancel existing notifications. Let authenticators * re-post notifications as required. But we don't know if Loading
services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java +0 −22 Original line number Diff line number Diff line Loading @@ -247,28 +247,6 @@ public class AccountManagerServiceTest extends AndroidTestCase { assertEquals(a31, accounts[1]); } @SmallTest public void testCheckAddAccountLongName() throws Exception { unlockSystemUser(); String longString = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaa"; Account a11 = new Account(longString, AccountManagerServiceTestFixtures.ACCOUNT_TYPE_1); Account a21 = new Account("account2", longString); mAms.addAccountExplicitly( a11, /* password= */ "p11", /* extras= */ null, /* callerPackage= */ null); mAms.addAccountExplicitly( a21, /* password= */ "p12", /* extras= */ null, /* callerPackage= */ null); String[] list = new String[]{AccountManagerServiceTestFixtures.CALLER_PACKAGE}; when(mMockPackageManager.getPackagesForUid(anyInt())).thenReturn(list); Account[] accounts = mAms.getAccountsAsUser(null, UserHandle.getCallingUserId(), mContext.getOpPackageName()); assertEquals(0, accounts); } @SmallTest public void testPasswords() throws Exception { unlockSystemUser(); Loading