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
|
* Invoked when the connection enters idle mode
|
||||||
*/
|
*/
|
||||||
public void onIdled();
|
public void onIdled();
|
||||||
|
/**
|
||||||
|
* Invoked when idle state is left
|
||||||
|
*/
|
||||||
|
public void onIdlingDone();
|
||||||
/**
|
/**
|
||||||
* Invoked when a new change is communicated by the server.
|
* Invoked when a new change is communicated by the server.
|
||||||
*
|
*
|
||||||
@ -313,6 +317,9 @@ public class ImapFolder extends Folder {
|
|||||||
mIdling = false;
|
mIdling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onIdlingDone();
|
||||||
|
}
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
cleanupConnection(connection, false);
|
cleanupConnection(connection, false);
|
||||||
synchronized (mIdleSync) {
|
synchronized (mIdleSync) {
|
||||||
|
@ -197,6 +197,12 @@ public class ImapService extends Service {
|
|||||||
scheduleKickIdleConnection();
|
scheduleKickIdleConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onIdlingDone() {
|
||||||
|
cancelKickIdleConnection();
|
||||||
|
resetPingDelay();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewServerChange(final boolean needSync, final List<String> fetchMessages) {
|
public void onNewServerChange(final boolean needSync, final List<String> fetchMessages) {
|
||||||
// Instead of checking every received change, request a sync of the mailbox
|
// Instead of checking every received change, request a sync of the mailbox
|
||||||
@ -551,6 +557,10 @@ public class ImapService extends Service {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
cancelIdleConnectionRestart();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectivityRestored(int networkType) {
|
public void onConnectivityRestored(int networkType) {
|
||||||
if (Logging.LOGD) {
|
if (Logging.LOGD) {
|
||||||
@ -778,6 +788,7 @@ public class ImapService extends Service {
|
|||||||
ImapIdleFolderHolder.getInstance().unregisterAllIdledMailboxes(true);
|
ImapIdleFolderHolder.getInstance().unregisterAllIdledMailboxes(true);
|
||||||
mConnectivityManager.unregister();
|
mConnectivityManager.unregister();
|
||||||
getContentResolver().unregisterContentObserver(mLocalChangesObserver);
|
getContentResolver().unregisterContentObserver(mLocalChangesObserver);
|
||||||
|
mConnectivityManager.destroy();
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user