summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2015-06-17 09:17:45 +0200
committerDanny Baumann <dannybaumann@web.de>2015-06-18 12:45:19 +0200
commita2383f878fb2f2f98208fc957d0eb3deb0dc2ebd (patch)
tree7e3bca9764f247a5f524c55ad8fb78dec1daaad7
parente2edd7c99a74e147e6a911123422b57b7e8b42ad (diff)
downloadandroid_packages_apps_Email-a2383f878fb2f2f98208fc957d0eb3deb0dc2ebd.tar.gz
android_packages_apps_Email-a2383f878fb2f2f98208fc957d0eb3deb0dc2ebd.tar.bz2
android_packages_apps_Email-a2383f878fb2f2f98208fc957d0eb3deb0dc2ebd.zip
Properly unregister alarm manager callbacks.
Change-Id: I2d474bc1cee168a5b76b8710b382498cd6c2fd59
-rw-r--r--provider_src/com/android/email/mail/store/ImapFolder.java7
-rw-r--r--provider_src/com/android/email/service/ImapService.java11
2 files changed, 18 insertions, 0 deletions
diff --git a/provider_src/com/android/email/mail/store/ImapFolder.java b/provider_src/com/android/email/mail/store/ImapFolder.java
index 05f44c477..bb7a6fe4b 100644
--- a/provider_src/com/android/email/mail/store/ImapFolder.java
+++ b/provider_src/com/android/email/mail/store/ImapFolder.java
@@ -85,6 +85,10 @@ public class ImapFolder extends Folder {
*/
public void onIdled();
/**
+ * Invoked when idle state is left
+ */
+ public void onIdlingDone();
+ /**
* Invoked when a new change is communicated by the server.
*
* @param needSync whether a sync is required
@@ -313,6 +317,9 @@ public class ImapFolder extends Folder {
mIdling = false;
}
+ if (callback != null) {
+ callback.onIdlingDone();
+ }
} catch (MessagingException me) {
cleanupConnection(connection, false);
synchronized (mIdleSync) {
diff --git a/provider_src/com/android/email/service/ImapService.java b/provider_src/com/android/email/service/ImapService.java
index 9fe925861..044a32593 100644
--- a/provider_src/com/android/email/service/ImapService.java
+++ b/provider_src/com/android/email/service/ImapService.java
@@ -197,6 +197,12 @@ public class ImapService extends Service {
}
@Override
+ public void onIdlingDone() {
+ cancelKickIdleConnection();
+ resetPingDelay();
+ }
+
+ @Override
public void onNewServerChange(final boolean needSync, final List<String> fetchMessages) {
// Instead of checking every received change, request a sync of the mailbox
if (Logging.LOGD) {
@@ -550,6 +556,10 @@ public class ImapService extends Service {
mContext = context;
}
+ public void destroy() {
+ cancelIdleConnectionRestart();
+ }
+
@Override
public void onConnectivityRestored(int networkType) {
if (Logging.LOGD) {
@@ -777,6 +787,7 @@ public class ImapService extends Service {
ImapIdleFolderHolder.getInstance().unregisterAllIdledMailboxes(true);
mConnectivityManager.unregister();
getContentResolver().unregisterContentObserver(mLocalChangesObserver);
+ mConnectivityManager.destroy();
super.onDestroy();
}