Send was being aborted because the cursor was not being closed.
Strict mode issue fixed.
Change-Id: Ibd7d095b63331b5fe5bd5e1c95c3b0432e87e979
diff --git a/src/com/android/mail/utils/AccountUtils.java b/src/com/android/mail/utils/AccountUtils.java
index 26d927a..b745291 100644
--- a/src/com/android/mail/utils/AccountUtils.java
+++ b/src/com/android/mail/utils/AccountUtils.java
@@ -74,14 +74,21 @@
public static Account[] getSyncingAccounts(Context context,
AccountManagerCallback<Account[]> callback, String type, String[] features) {
ContentResolver resolver = context.getContentResolver();
- Cursor accountsCursor = resolver.query(AccountCacheProvider.getAccountsUri(),
- UIProvider.ACCOUNTS_PROJECTION, null, null, null);
+ Cursor accountsCursor = null;
ArrayList<Account> accounts = new ArrayList<Account>();
Account account;
- if (accountsCursor != null) {
- while (accountsCursor.moveToNext()) {
- account = new Account(accountsCursor);
- accounts.add(account);
+ try {
+ accountsCursor = resolver.query(AccountCacheProvider.getAccountsUri(),
+ UIProvider.ACCOUNTS_PROJECTION, null, null, null);
+ if (accountsCursor != null) {
+ while (accountsCursor.moveToNext()) {
+ account = new Account(accountsCursor);
+ accounts.add(account);
+ }
+ }
+ } finally {
+ if (accountsCursor != null) {
+ accountsCursor.close();
}
}
return accounts.toArray(new Account[accounts.size()]);