Properly unregister alarm manager callbacks.
Change-Id: I2d474bc1cee168a5b76b8710b382498cd6c2fd59
This commit is contained in:
parent
a7bc7d8572
commit
c96099279b
@ -84,6 +84,10 @@ public class ImapFolder extends Folder {
|
||||
* Invoked when the connection enters idle mode
|
||||
*/
|
||||
public void onIdled();
|
||||
/**
|
||||
* Invoked when idle state is left
|
||||
*/
|
||||
public void onIdlingDone();
|
||||
/**
|
||||
* Invoked when a new change is communicated by the server.
|
||||
*
|
||||
@ -313,6 +317,9 @@ public class ImapFolder extends Folder {
|
||||
mIdling = false;
|
||||
}
|
||||
|
||||
if (callback != null) {
|
||||
callback.onIdlingDone();
|
||||
}
|
||||
} catch (MessagingException me) {
|
||||
cleanupConnection(connection, false);
|
||||
synchronized (mIdleSync) {
|
||||
|
@ -197,6 +197,12 @@ public class ImapService extends Service {
|
||||
scheduleKickIdleConnection();
|
||||
}
|
||||
|
||||
@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
|
||||
@ -551,6 +557,10 @@ public class ImapService extends Service {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
cancelIdleConnectionRestart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectivityRestored(int networkType) {
|
||||
if (Logging.LOGD) {
|
||||
@ -778,6 +788,7 @@ public class ImapService extends Service {
|
||||
ImapIdleFolderHolder.getInstance().unregisterAllIdledMailboxes(true);
|
||||
mConnectivityManager.unregister();
|
||||
getContentResolver().unregisterContentObserver(mLocalChangesObserver);
|
||||
mConnectivityManager.destroy();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user