Loading core/java/android/accounts/AccountManagerService.java +4 −7 Original line number Original line Diff line number Diff line Loading @@ -46,7 +46,6 @@ import android.util.Pair; import android.app.PendingIntent; import android.app.PendingIntent; import android.app.NotificationManager; import android.app.NotificationManager; import android.app.Notification; import android.app.Notification; import android.app.Activity; import android.Manifest; import android.Manifest; import java.io.FileDescriptor; import java.io.FileDescriptor; Loading Loading @@ -471,6 +470,7 @@ public class AccountManagerService extends IAccountManager.Stub { } } private boolean saveAuthTokenToDatabase(Account account, String type, String authToken) { private boolean saveAuthTokenToDatabase(Account account, String type, String authToken) { cancelNotification(getSigninRequiredNotificationId(account)); SQLiteDatabase db = mOpenHelper.getWritableDatabase(); SQLiteDatabase db = mOpenHelper.getWritableDatabase(); db.beginTransaction(); db.beginTransaction(); try { try { Loading Loading @@ -523,7 +523,7 @@ public class AccountManagerService extends IAccountManager.Stub { checkAuthenticateAccountsPermission(account); checkAuthenticateAccountsPermission(account); long identityToken = clearCallingIdentity(); long identityToken = clearCallingIdentity(); try { try { cacheAuthToken(account, authTokenType, authToken); saveAuthTokenToDatabase(account, authTokenType, authToken); } finally { } finally { restoreCallingIdentity(identityToken); restoreCallingIdentity(identityToken); } } Loading Loading @@ -686,7 +686,8 @@ public class AccountManagerService extends IAccountManager.Stub { "the type and name should not be empty"); "the type and name should not be empty"); return; return; } } cacheAuthToken(new Account(name, type), authTokenType, authToken); saveAuthTokenToDatabase(new Account(name, type), authTokenType, authToken); } } Intent intent = result.getParcelable(Constants.INTENT_KEY); Intent intent = result.getParcelable(Constants.INTENT_KEY); Loading Loading @@ -1004,10 +1005,6 @@ public class AccountManagerService extends IAccountManager.Stub { } } } } private boolean cacheAuthToken(Account account, String authTokenType, String authToken) { return saveAuthTokenToDatabase(account, authTokenType, authToken); } private long getAccountId(SQLiteDatabase db, Account account) { private long getAccountId(SQLiteDatabase db, Account account) { Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_ID}, Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_ID}, "name=? AND type=?", new String[]{account.name, account.type}, null, null, null); "name=? AND type=?", new String[]{account.name, account.type}, null, null, null); Loading Loading
core/java/android/accounts/AccountManagerService.java +4 −7 Original line number Original line Diff line number Diff line Loading @@ -46,7 +46,6 @@ import android.util.Pair; import android.app.PendingIntent; import android.app.PendingIntent; import android.app.NotificationManager; import android.app.NotificationManager; import android.app.Notification; import android.app.Notification; import android.app.Activity; import android.Manifest; import android.Manifest; import java.io.FileDescriptor; import java.io.FileDescriptor; Loading Loading @@ -471,6 +470,7 @@ public class AccountManagerService extends IAccountManager.Stub { } } private boolean saveAuthTokenToDatabase(Account account, String type, String authToken) { private boolean saveAuthTokenToDatabase(Account account, String type, String authToken) { cancelNotification(getSigninRequiredNotificationId(account)); SQLiteDatabase db = mOpenHelper.getWritableDatabase(); SQLiteDatabase db = mOpenHelper.getWritableDatabase(); db.beginTransaction(); db.beginTransaction(); try { try { Loading Loading @@ -523,7 +523,7 @@ public class AccountManagerService extends IAccountManager.Stub { checkAuthenticateAccountsPermission(account); checkAuthenticateAccountsPermission(account); long identityToken = clearCallingIdentity(); long identityToken = clearCallingIdentity(); try { try { cacheAuthToken(account, authTokenType, authToken); saveAuthTokenToDatabase(account, authTokenType, authToken); } finally { } finally { restoreCallingIdentity(identityToken); restoreCallingIdentity(identityToken); } } Loading Loading @@ -686,7 +686,8 @@ public class AccountManagerService extends IAccountManager.Stub { "the type and name should not be empty"); "the type and name should not be empty"); return; return; } } cacheAuthToken(new Account(name, type), authTokenType, authToken); saveAuthTokenToDatabase(new Account(name, type), authTokenType, authToken); } } Intent intent = result.getParcelable(Constants.INTENT_KEY); Intent intent = result.getParcelable(Constants.INTENT_KEY); Loading Loading @@ -1004,10 +1005,6 @@ public class AccountManagerService extends IAccountManager.Stub { } } } } private boolean cacheAuthToken(Account account, String authTokenType, String authToken) { return saveAuthTokenToDatabase(account, authTokenType, authToken); } private long getAccountId(SQLiteDatabase db, Account account) { private long getAccountId(SQLiteDatabase db, Account account) { Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_ID}, Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_ID}, "name=? AND type=?", new String[]{account.name, account.type}, null, null, null); "name=? AND type=?", new String[]{account.name, account.type}, null, null, null); Loading