Don't put Credentials in HostAuth parcels
The problem is that exchange isn't compiled with this change, so HostAuth parcels to or from exchange fail. Ultimately, we'll need to probably create a HostAuth2 object or something along those lines. For now, just change the format of HostAuth parcels back, so they stay compatible with exchange, I'll figure out a real solution later. Change-Id: I9c8c8639b7b474fe82dfdc37a9e51a0451820105
This commit is contained in:
parent
2bf9590ddd
commit
05723aa0f6
@ -742,12 +742,13 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
// Also, remember which operation in the array they represent
|
||||
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
|
||||
if (mHostAuthRecv != null) {
|
||||
if (mHostAuthRecv.mCredential != null) {
|
||||
recvCredentialsIndex = index++;
|
||||
ops.add(ContentProviderOperation.newInsert(mHostAuthRecv.mCredential.mBaseUri)
|
||||
.withValues(mHostAuthRecv.mCredential.toContentValues())
|
||||
.build());
|
||||
}
|
||||
// TODO: This causes problems because it's incompatible with Exchange.
|
||||
// if (mHostAuthRecv.mCredential != null) {
|
||||
// recvCredentialsIndex = index++;
|
||||
// ops.add(ContentProviderOperation.newInsert(mHostAuthRecv.mCredential.mBaseUri)
|
||||
// .withValues(mHostAuthRecv.mCredential.toContentValues())
|
||||
// .build());
|
||||
// }
|
||||
|
||||
recvIndex = index++;
|
||||
final ContentProviderOperation.Builder b = ContentProviderOperation.newInsert(
|
||||
@ -761,18 +762,19 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
ops.add(b.build());
|
||||
}
|
||||
if (mHostAuthSend != null) {
|
||||
if (mHostAuthSend.mCredential != null) {
|
||||
if (mHostAuthRecv.mCredential != null &&
|
||||
mHostAuthRecv.mCredential.equals(mHostAuthSend.mCredential)) {
|
||||
// TODO: This causes problems because it's incompatible with Exchange.
|
||||
// if (mHostAuthSend.mCredential != null) {
|
||||
// if (mHostAuthRecv.mCredential != null &&
|
||||
// mHostAuthRecv.mCredential.equals(mHostAuthSend.mCredential)) {
|
||||
// These two credentials are identical, use the same row.
|
||||
sendCredentialsIndex = recvCredentialsIndex;
|
||||
} else {
|
||||
sendCredentialsIndex = index++;
|
||||
ops.add(ContentProviderOperation.newInsert(mHostAuthRecv.mCredential.mBaseUri)
|
||||
.withValues(mHostAuthRecv.mCredential.toContentValues())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
// sendCredentialsIndex = recvCredentialsIndex;
|
||||
// } else {
|
||||
// sendCredentialsIndex = index++;
|
||||
// ops.add(ContentProviderOperation.newInsert(mHostAuthRecv.mCredential.mBaseUri)
|
||||
// .withValues(mHostAuthRecv.mCredential.toContentValues())
|
||||
// .build());
|
||||
// }
|
||||
// }
|
||||
sendIndex = index++;
|
||||
final ContentProviderOperation.Builder b = ContentProviderOperation.newInsert(
|
||||
mHostAuthSend.mBaseUri);
|
||||
|
@ -68,8 +68,6 @@ public final class HostAuth extends EmailContent implements HostAuthColumns, Par
|
||||
public byte[] mServerCert = null;
|
||||
public long mCredentialKey;
|
||||
|
||||
public transient Credential mCredential;
|
||||
|
||||
public static final int CONTENT_ID_COLUMN = 0;
|
||||
public static final int CONTENT_PROTOCOL_COLUMN = 1;
|
||||
public static final int CONTENT_ADDRESS_COLUMN = 2;
|
||||
@ -96,22 +94,23 @@ public final class HostAuth extends EmailContent implements HostAuthColumns, Par
|
||||
}
|
||||
|
||||
/**
|
||||
* getOrCreateCredentials
|
||||
* getOrCreateCredential
|
||||
* Return the credential object for this HostAuth, creating it if it does not yet exist.
|
||||
* This should not be called on the main thread.
|
||||
* @param context
|
||||
* @return the credential object for this HostAuth
|
||||
*/
|
||||
public Credential getOrCreateCredentials(Context context) {
|
||||
|
||||
if (mCredential == null) {
|
||||
if (mCredentialKey >= 0) {
|
||||
mCredential = Credential.restoreCredentialsWithId(context, mCredentialKey);
|
||||
} else {
|
||||
mCredential = new Credential();
|
||||
}
|
||||
}
|
||||
return mCredential;
|
||||
public Credential getOrCreateCredential(Context context) {
|
||||
// TODO: This causes problems because it's incompatible with Exchange.
|
||||
// if (mCredential == null) {
|
||||
// if (mCredentialKey >= 0) {
|
||||
// mCredential = Credential.restoreCredentialsWithId(context, mCredentialKey);
|
||||
// } else {
|
||||
// mCredential = new Credential();
|
||||
// }
|
||||
// }
|
||||
// return mCredential;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,12 +121,14 @@ public final class HostAuth extends EmailContent implements HostAuthColumns, Par
|
||||
* @return
|
||||
*/
|
||||
public Credential getCredentials(Context context) {
|
||||
if (mCredential == null) {
|
||||
if (mCredentialKey >= 0) {
|
||||
mCredential = Credential.restoreCredentialsWithId(context, mCredentialKey);
|
||||
}
|
||||
}
|
||||
return mCredential;
|
||||
// TODO: This causes problems because it's incompatible with Exchange.
|
||||
// if (mCredential == null) {
|
||||
// if (mCredentialKey >= 0) {
|
||||
// mCredential = Credential.restoreCredentialsWithId(context, mCredentialKey);
|
||||
// }
|
||||
// }
|
||||
// return mCredential;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -370,12 +371,13 @@ public final class HostAuth extends EmailContent implements HostAuthColumns, Par
|
||||
dest.writeString(mPassword);
|
||||
dest.writeString(mDomain);
|
||||
dest.writeString(mClientCertAlias);
|
||||
dest.writeLong(mCredentialKey);
|
||||
if (mCredential == null) {
|
||||
Credential.EMPTY.writeToParcel(dest, flags);
|
||||
} else {
|
||||
mCredential.writeToParcel(dest, flags);
|
||||
}
|
||||
// dest.writeLong(mCredentialKey);
|
||||
// TODO: This causes problems because it's incompatible with Exchange.
|
||||
// if (mCredential == null) {
|
||||
// Credential.EMPTY.writeToParcel(dest, flags);
|
||||
// } else {
|
||||
// mCredential.writeToParcel(dest, flags);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -392,11 +394,11 @@ public final class HostAuth extends EmailContent implements HostAuthColumns, Par
|
||||
mPassword = in.readString();
|
||||
mDomain = in.readString();
|
||||
mClientCertAlias = in.readString();
|
||||
mCredentialKey = in.readLong();
|
||||
mCredential = new Credential(in);
|
||||
if (mCredential.equals(Credential.EMPTY)) {
|
||||
mCredential = null;
|
||||
}
|
||||
// mCredentialKey = in.readLong();
|
||||
// mCredential = new Credential(in);
|
||||
// if (mCredential.equals(Credential.EMPTY)) {
|
||||
// mCredential = null;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user