am 8799b96e: Merge change 26314 into eclair
Merge commit '8799b96ea09d5fdd9904dd9de3002c0a9cd28fdc' into eclair-plus-aosp * commit '8799b96ea09d5fdd9904dd9de3002c0a9cd28fdc': Delay broadcasting ACCOUNTS_CHANGED until we're certain AndroidId is ready.
This commit is contained in:
@@ -73,6 +73,10 @@ import com.android.internal.R;
|
|||||||
public class AccountManagerService
|
public class AccountManagerService
|
||||||
extends IAccountManager.Stub
|
extends IAccountManager.Stub
|
||||||
implements RegisteredServicesCacheListener {
|
implements RegisteredServicesCacheListener {
|
||||||
|
private static final String GOOGLE_ACCOUNT_TYPE = "com.google.GAIA";
|
||||||
|
|
||||||
|
private static final String NO_BROADCAST_FLAG = "nobroadcast";
|
||||||
|
|
||||||
private static final String TAG = "AccountManagerService";
|
private static final String TAG = "AccountManagerService";
|
||||||
|
|
||||||
private static final int TIMEOUT_DELAY_MS = 1000 * 60;
|
private static final int TIMEOUT_DELAY_MS = 1000 * 60;
|
||||||
@@ -357,6 +361,14 @@ public class AccountManagerService
|
|||||||
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
try {
|
try {
|
||||||
|
boolean noBroadcast = false;
|
||||||
|
if (account.type.equals(GOOGLE_ACCOUNT_TYPE)) {
|
||||||
|
// Look for the 'nobroadcast' flag and remove it since we don't want it to persist
|
||||||
|
// in the db.
|
||||||
|
noBroadcast = extras.getBoolean(NO_BROADCAST_FLAG, false);
|
||||||
|
extras.remove(NO_BROADCAST_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
long numMatches = DatabaseUtils.longForQuery(db,
|
long numMatches = DatabaseUtils.longForQuery(db,
|
||||||
"select count(*) from " + TABLE_ACCOUNTS
|
"select count(*) from " + TABLE_ACCOUNTS
|
||||||
+ " WHERE " + ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
+ " WHERE " + ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||||
@@ -381,7 +393,9 @@ public class AccountManagerService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
sendAccountsChangedBroadcast();
|
if (!noBroadcast) {
|
||||||
|
sendAccountsChangedBroadcast();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
@@ -608,6 +622,10 @@ public class AccountManagerService
|
|||||||
public void setUserData(Account account, String key, String value) {
|
public void setUserData(Account account, String key, String value) {
|
||||||
checkAuthenticateAccountsPermission(account);
|
checkAuthenticateAccountsPermission(account);
|
||||||
long identityToken = clearCallingIdentity();
|
long identityToken = clearCallingIdentity();
|
||||||
|
if (account.type.equals(GOOGLE_ACCOUNT_TYPE) && key.equals("broadcast")) {
|
||||||
|
sendAccountsChangedBroadcast();
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
writeUserdataIntoDatabase(account, key, value);
|
writeUserdataIntoDatabase(account, key, value);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user