Merge change 25897 into eclair

* changes:
  Revert change to AccountManager naming; use email address again
This commit is contained in:
Android (Google) Code Review 2009-09-19 13:18:52 -04:00
commit 24bbde3747
5 changed files with 15 additions and 17 deletions

View File

@ -83,7 +83,7 @@ public class ExchangeStore extends Store {
AccountManagerCallback<Bundle> callback) {
// Create a description of the new account
Bundle options = new Bundle();
options.putString(EasAuthenticatorService.OPTIONS_USERNAME, acct.mHostAuthRecv.mLogin);
options.putString(EasAuthenticatorService.OPTIONS_USERNAME, acct.mEmailAddress);
options.putString(EasAuthenticatorService.OPTIONS_PASSWORD, acct.mHostAuthRecv.mPassword);
options.putBoolean(EasAuthenticatorService.OPTIONS_CONTACTS_SYNC_ENABLED, syncContacts);

View File

@ -60,13 +60,13 @@ public class EmailProvider extends ContentProvider {
// Any changes to the database format *must* include update-in-place code.
// Original version: 3
// Version 4: Database wipe required; changing AccountManager interface w/Exchange
public static final int DATABASE_VERSION = 4;
public static final int DATABASE_VERSION = 5;
// Any changes to the database format *must* include update-in-place code.
// Original version: 2
// Version 3: Add "sourceKey" column
// Version 4: Database wipe required; changing AccountManager interface w/Exchange
public static final int BODY_DATABASE_VERSION = 4;
public static final int BODY_DATABASE_VERSION = 5;
public static final String EMAIL_AUTHORITY = "com.android.email.provider";
@ -496,7 +496,7 @@ public class EmailProvider extends ContentProvider {
}
static void upgradeBodyTable(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < 4) {
if (oldVersion < 5) {
try {
db.execSQL("drop table " + Body.TABLE_NAME);
createBodyTable(db);
@ -572,9 +572,9 @@ public class EmailProvider extends ContentProvider {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// For versions prior to 4, delete all data
// Versions >= 4 require that data be preserved!
if (oldVersion < 4) {
// For versions prior to 5, delete all data
// Versions >= 5 require that data be preserved!
if (oldVersion < 5) {
android.accounts.Account[] accounts =
AccountManager.get(mContext).getAccountsByType(Eas.ACCOUNT_MANAGER_TYPE);
for (android.accounts.Account account: accounts) {

View File

@ -133,7 +133,6 @@ public class EasSyncService extends AbstractSyncService {
private boolean mSsl = true;
private boolean mTrustSsl = false;
public ContentResolver mContentResolver;
public String mHostLogin;
private String[] mBindArguments = new String[2];
private ArrayList<String> mPingChangeList;
private HttpPost mPendingPost = null;
@ -148,7 +147,6 @@ public class EasSyncService extends AbstractSyncService {
super(_context, _mailbox);
mContentResolver = _context.getContentResolver();
HostAuth ha = HostAuth.restoreHostAuthWithId(_context, mAccount.mHostAuthKeyRecv);
mHostLogin = ha.mLogin;
mSsl = (ha.mFlags & HostAuth.FLAG_SSL) != 0;
mTrustSsl = (ha.mFlags & HostAuth.FLAG_TRUST_ALL_CERTIFICATES) != 0;
}

View File

@ -443,7 +443,7 @@ public class SyncManager extends Service implements Runnable {
stopAccountSyncs(account.mId, true);
// Delete this from AccountManager...
android.accounts.Account acct =
new android.accounts.Account(account.mHostAuthRecv.mLogin,
new android.accounts.Account(account.mEmailAddress,
Eas.ACCOUNT_MANAGER_TYPE);
AccountManager.get(SyncManager.this).removeAccount(acct, null, null);
mAccountKeyList = null;
@ -1037,7 +1037,7 @@ public class SyncManager extends Service implements Runnable {
if (contactsId != Mailbox.NO_MAILBOX) {
// Create an AccountManager style Account
android.accounts.Account acct =
new android.accounts.Account(easAccount.mHostAuthRecv.mLogin,
new android.accounts.Account(easAccount.mEmailAddress,
Eas.ACCOUNT_MANAGER_TYPE);
// Get the Contacts mailbox; this happens rarely so it's ok to get it all
Mailbox contacts = Mailbox.restoreMailboxWithId(this, contactsId);
@ -1076,7 +1076,7 @@ public class SyncManager extends Service implements Runnable {
AccountManager.get(this).getAccountsByType(Eas.ACCOUNT_MANAGER_TYPE);
List<Account> easAccounts = getAccountList();
for (Account easAccount: easAccounts) {
String accountName = easAccount.mHostAuthRecv.mLogin;
String accountName = easAccount.mEmailAddress;
boolean found = false;
for (android.accounts.Account acct: accts) {
if (acct.name.equalsIgnoreCase(accountName)) {
@ -1407,7 +1407,7 @@ public class SyncManager extends Service implements Runnable {
getAccountById(c.getInt(Mailbox.CONTENT_ACCOUNT_KEY_COLUMN));
if (account != null) {
android.accounts.Account a =
new android.accounts.Account(account.mHostAuthRecv.mLogin,
new android.accounts.Account(account.mEmailAddress,
Eas.ACCOUNT_MANAGER_TYPE);
if (!ContentResolver.getSyncAutomatically(a,
ContactsContract.AUTHORITY)) {

View File

@ -151,7 +151,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
setSyncKey("0", false);
// Make sure ungrouped contacts for Exchange are defaultly visible
ContentValues cv = new ContentValues();
cv.put(Groups.ACCOUNT_NAME, mService.mHostLogin);
cv.put(Groups.ACCOUNT_NAME, mAccount.mEmailAddress);
cv.put(Groups.ACCOUNT_TYPE, Eas.ACCOUNT_MANAGER_TYPE);
cv.put(Settings.UNGROUPED_VISIBLE, true);
client.insert(Settings.CONTENT_URI, cv);
@ -190,7 +190,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
public android.accounts.Account getAccountManagerAccount() {
if (mAccountManagerAccount == null) {
mAccountManagerAccount =
new android.accounts.Account(mService.mHostLogin, Eas.ACCOUNT_MANAGER_TYPE);
new android.accounts.Account(mAccount.mEmailAddress, Eas.ACCOUNT_MANAGER_TYPE);
}
return mAccountManagerAccount;
}
@ -880,7 +880,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
private Uri uriWithAccountAndIsSyncAdapter(Uri uri) {
return uri.buildUpon()
.appendQueryParameter(RawContacts.ACCOUNT_NAME, mService.mHostLogin)
.appendQueryParameter(RawContacts.ACCOUNT_NAME, mAccount.mEmailAddress)
.appendQueryParameter(RawContacts.ACCOUNT_TYPE, Eas.ACCOUNT_MANAGER_TYPE)
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
.build();
@ -1724,7 +1724,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
// First, let's find Contacts that have changed.
ContentResolver cr = mService.mContentResolver;
Uri uri = RawContacts.CONTENT_URI.buildUpon()
.appendQueryParameter(RawContacts.ACCOUNT_NAME, mService.mHostLogin)
.appendQueryParameter(RawContacts.ACCOUNT_NAME, mAccount.mEmailAddress)
.appendQueryParameter(RawContacts.ACCOUNT_TYPE, Eas.ACCOUNT_MANAGER_TYPE)
.build();