am ea878be1: Make sure we hold WakeLock during mail sending (fixes #2180551)
Merge commit 'ea878be11729cd793d9183fc264118241cd5a5b6' into eclair-mr2
* commit 'ea878be11729cd793d9183fc264118241cd5a5b6':
Make sure we hold WakeLock during mail sending (fixes #2180551)
diff --git a/res/drawable-hdpi/divider_vertical_light_opaque.9.png b/res/drawable-hdpi/divider_vertical_light_opaque.9.png
new file mode 100755
index 0000000..8f35315
--- /dev/null
+++ b/res/drawable-hdpi/divider_vertical_light_opaque.9.png
Binary files differ
diff --git a/res/drawable-mdpi/divider_vertical_light_opaque.9.png b/res/drawable-mdpi/divider_vertical_light_opaque.9.png
new file mode 100755
index 0000000..8f35315
--- /dev/null
+++ b/res/drawable-mdpi/divider_vertical_light_opaque.9.png
Binary files differ
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fc811b9..953414c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -199,14 +199,14 @@
<!-- Version number, shown only on debug screen -->
<string name="debug_version_fmt">Version: <xliff:g id="version">%s</xliff:g></string>
- <!-- Checkbox label, shown only on debug screen -->
- <string name="debug_enable_debug_logging_label">Enable extra debug logging?</string>
- <!-- Checkbox label, shown only on debug screen -->
- <string name="debug_enable_sensitive_logging_label">Enable sensitive information debug logging? (May show passwords in logs.)</string>
- <!-- Checkbox label, shown only on debug screen -->
- <string name="debug_enable_exchange_logging_label">Enable exchange parser logging? (Extremely verbose)</string>
- <!-- Checkbox label, shown only on debug screen -->
- <string name="debug_enable_exchange_file_logging_label">Enable exchange sd card logging?</string>
+ <!-- Do Not Translate. Checkbox label, shown only on debug screen -->
+ <string name="debug_enable_debug_logging_label" translatable="false">Enable extra debug logging?</string>
+ <!-- Do Not Translate. Checkbox label, shown only on debug screen -->
+ <string name="debug_enable_sensitive_logging_label" translatable="false">Enable sensitive information debug logging? (May show passwords in logs.)</string>
+ <!-- Do Not Translate. Checkbox label, shown only on debug screen -->
+ <string name="debug_enable_exchange_logging_label" translatable="false">Enable exchange parser logging? (Extremely verbose)</string>
+ <!-- Do Not Translate. Checkbox label, shown only on debug screen -->
+ <string name="debug_enable_exchange_file_logging_label" translatable="false">Enable exchange sd card logging?</string>
<!-- The text in the small separator between smart folders and the accounts -->
<string name="account_folder_list_separator_accounts">Accounts</string>
diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java
index a604669..1b24799 100644
--- a/src/com/android/exchange/EasSyncService.java
+++ b/src/com/android/exchange/EasSyncService.java
@@ -208,6 +208,12 @@
userLog("Validation (OPTIONS) response: " + code);
if (code == HttpStatus.SC_OK) {
// No exception means successful validation
+ Header commands = resp.getFirstHeader("MS-ASProtocolCommands");
+ Header versions = resp.getFirstHeader("ms-asprotocolversions");
+ if (commands == null || versions == null) {
+ userLog("OPTIONS response without commands or versions; reporting I/O error");
+ throw new MessagingException(MessagingException.IOERROR);
+ }
userLog("Validation successful");
return;
}
diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java
index ece930c..8e6119a 100644
--- a/src/com/android/exchange/SyncManager.java
+++ b/src/com/android/exchange/SyncManager.java
@@ -1295,13 +1295,16 @@
synchronized (sSyncToken) {
Account acct = Account.restoreAccountWithId(this, m.mAccountKey);
if (acct != null) {
- AbstractSyncService service;
- service = new EasSyncService(this, m);
- service.mSyncReason = reason;
- if (req != null) {
- service.addPartRequest(req);
+ // Always make sure there's not a running instance of this service
+ AbstractSyncService service = mServiceMap.get(m.mId);
+ if (service == null) {
+ service = new EasSyncService(this, m);
+ service.mSyncReason = reason;
+ if (req != null) {
+ service.addPartRequest(req);
+ }
+ startService(service, m);
}
- startService(service, m);
}
}
}
@@ -1490,18 +1493,18 @@
deletedMailboxes.add(mailboxId);
}
}
- }
- // If so, stop them or remove them from the map
- for (Long mailboxId: deletedMailboxes) {
- AbstractSyncService svc = mServiceMap.get(mailboxId);
- if (svc != null) {
- boolean alive = svc.mThread.isAlive();
- log("Deleted mailbox: " + svc.mMailboxName);
- if (alive) {
- stopManualSync(mailboxId);
- } else {
- log("Removing from serviceMap");
- releaseMailbox(mailboxId);
+ // If so, stop them or remove them from the map
+ for (Long mailboxId: deletedMailboxes) {
+ AbstractSyncService svc = mServiceMap.get(mailboxId);
+ if (svc != null) {
+ boolean alive = svc.mThread.isAlive();
+ log("Deleted mailbox: " + svc.mMailboxName);
+ if (alive) {
+ stopManualSync(mailboxId);
+ } else {
+ log("Removing from serviceMap");
+ releaseMailbox(mailboxId);
+ }
}
}
}
@@ -1517,7 +1520,10 @@
try {
while (c.moveToNext()) {
long mid = c.getLong(Mailbox.CONTENT_ID_COLUMN);
- AbstractSyncService service = mServiceMap.get(mid);
+ AbstractSyncService service = null;
+ synchronized (sSyncToken) {
+ service = mServiceMap.get(mid);
+ }
if (service == null) {
// Check whether we're in a hold (temporary or permanent)
SyncError syncError = mSyncErrorMap.get(mid);
diff --git a/src/com/android/exchange/adapter/ContactsSyncAdapter.java b/src/com/android/exchange/adapter/ContactsSyncAdapter.java
index fff6400..1228354 100644
--- a/src/com/android/exchange/adapter/ContactsSyncAdapter.java
+++ b/src/com/android/exchange/adapter/ContactsSyncAdapter.java
@@ -1628,6 +1628,15 @@
}
}
+ private void sendPhoto(Serializer s, ContentValues cv) throws IOException {
+ if (cv.containsKey(Photo.PHOTO)) {
+ byte[] bytes = cv.getAsByteArray(Photo.PHOTO);
+ byte[] encodedBytes = Base64.encodeBase64(bytes);
+ String pic = new String(encodedBytes);
+ s.data(Tags.CONTACTS_PICTURE, pic);
+ }
+ }
+
private void sendOrganization(Serializer s, ContentValues cv) throws IOException {
if (cv.containsKey(Organization.TITLE)) {
s.data(Tags.CONTACTS_JOB_TITLE, cv.getAsString(Organization.TITLE));
@@ -1854,8 +1863,7 @@
} else if (mimeType.equals(Note.CONTENT_ITEM_TYPE)) {
sendNote(s, cv);
} else if (mimeType.equals(Photo.CONTENT_ITEM_TYPE)) {
- // For now, the user can change the photo, but the change won't be
- // uploaded.
+ sendPhoto(s, cv);
} else {
userLog("Contacts upsync, unknown data: ", mimeType);
}
diff --git a/src/com/android/exchange/adapter/EmailSyncAdapter.java b/src/com/android/exchange/adapter/EmailSyncAdapter.java
index 6a5d2a5..6838b52 100644
--- a/src/com/android/exchange/adapter/EmailSyncAdapter.java
+++ b/src/com/android/exchange/adapter/EmailSyncAdapter.java
@@ -62,6 +62,9 @@
private static final String[] UPDATES_PROJECTION =
{MessageColumns.FLAG_READ, MessageColumns.MAILBOX_KEY, SyncColumns.SERVER_ID,
MessageColumns.FLAG_FAVORITE};
+
+ private static final int MESSAGE_ID_SUBJECT_ID_COLUMN = 0;
+ private static final int MESSAGE_ID_SUBJECT_SUBJECT_COLUMN = 1;
private static final String[] MESSAGE_ID_SUBJECT_PROJECTION =
new String[] { Message.RECORD_ID, MessageColumns.SUBJECT };
@@ -323,9 +326,10 @@
Cursor c = getServerIdCursor(serverId, MESSAGE_ID_SUBJECT_PROJECTION);
try {
if (c.moveToFirst()) {
- deletes.add(c.getLong(0));
+ deletes.add(c.getLong(MESSAGE_ID_SUBJECT_ID_COLUMN));
if (Eas.USER_LOG) {
- userLog("Deleting ", serverId + ", " + c.getString(1));
+ userLog("Deleting ", serverId + ", "
+ + c.getString(MESSAGE_ID_SUBJECT_SUBJECT_COLUMN));
}
}
} finally {