am 2b1e6779: Merge change 25639 into eclair
Merge commit '2b1e67790bf101b2d65e0b38c8b0f3b8676d0129' into eclair-plus-aosp * commit '2b1e67790bf101b2d65e0b38c8b0f3b8676d0129': do not use transactions for calls that just read the DB
This commit is contained in:
@@ -287,25 +287,18 @@ public class AccountManagerService
|
|||||||
|
|
||||||
private String readUserDataFromDatabase(Account account, String key) {
|
private String readUserDataFromDatabase(Account account, String key) {
|
||||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||||
db.beginTransaction();
|
Cursor cursor = db.query(TABLE_EXTRAS, new String[]{EXTRAS_VALUE},
|
||||||
|
EXTRAS_ACCOUNTS_ID
|
||||||
|
+ "=(select _id FROM accounts WHERE name=? AND type=?) AND "
|
||||||
|
+ EXTRAS_KEY + "=?",
|
||||||
|
new String[]{account.name, account.type, key}, null, null, null);
|
||||||
try {
|
try {
|
||||||
long accountId = getAccountId(db, account);
|
if (cursor.moveToNext()) {
|
||||||
if (accountId < 0) {
|
return cursor.getString(0);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Cursor cursor = db.query(TABLE_EXTRAS, new String[]{EXTRAS_VALUE},
|
|
||||||
EXTRAS_ACCOUNTS_ID + "=" + accountId + " AND " + EXTRAS_KEY + "=?",
|
|
||||||
new String[]{key}, null, null, null);
|
|
||||||
try {
|
|
||||||
if (cursor.moveToNext()) {
|
|
||||||
return cursor.getString(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} finally {
|
|
||||||
cursor.close();
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
cursor.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,15 +523,18 @@ public class AccountManagerService
|
|||||||
|
|
||||||
public String readAuthTokenFromDatabase(Account account, String authTokenType) {
|
public String readAuthTokenFromDatabase(Account account, String authTokenType) {
|
||||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||||
db.beginTransaction();
|
Cursor cursor = db.query(TABLE_AUTHTOKENS, new String[]{AUTHTOKENS_AUTHTOKEN},
|
||||||
|
AUTHTOKENS_ACCOUNTS_ID + "=(select _id FROM accounts WHERE name=? AND type=?) AND "
|
||||||
|
+ AUTHTOKENS_TYPE + "=?",
|
||||||
|
new String[]{account.name, account.type, authTokenType},
|
||||||
|
null, null, null);
|
||||||
try {
|
try {
|
||||||
long accountId = getAccountId(db, account);
|
if (cursor.moveToNext()) {
|
||||||
if (accountId < 0) {
|
return cursor.getString(0);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
return getAuthToken(db, accountId, authTokenType);
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
cursor.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,21 +1065,6 @@ public class AccountManagerService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAuthToken(SQLiteDatabase db, long accountId, String authTokenType) {
|
|
||||||
Cursor cursor = db.query(TABLE_AUTHTOKENS, new String[]{AUTHTOKENS_AUTHTOKEN},
|
|
||||||
AUTHTOKENS_ACCOUNTS_ID + "=" + accountId + " AND " + AUTHTOKENS_TYPE + "=?",
|
|
||||||
new String[]{authTokenType},
|
|
||||||
null, null, null);
|
|
||||||
try {
|
|
||||||
if (cursor.moveToNext()) {
|
|
||||||
return cursor.getString(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} finally {
|
|
||||||
cursor.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private abstract class Session extends IAccountAuthenticatorResponse.Stub
|
private abstract class Session extends IAccountAuthenticatorResponse.Stub
|
||||||
implements AuthenticatorBindHelper.Callback, IBinder.DeathRecipient {
|
implements AuthenticatorBindHelper.Callback, IBinder.DeathRecipient {
|
||||||
IAccountManagerResponse mResponse;
|
IAccountManagerResponse mResponse;
|
||||||
|
|||||||
Reference in New Issue
Block a user