mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
Issue 418
When no accounts are set for automatic sync, the MailService is stopped. When the MailService is stopped, the Android platform is given greater leeway in killing the entire K9 process in order to free system resources.
This commit is contained in:
parent
4a6f2e419b
commit
8e51d6cf14
@ -41,7 +41,7 @@ public class MailService extends Service {
|
|||||||
|
|
||||||
private Listener mListener = new Listener();
|
private Listener mListener = new Listener();
|
||||||
|
|
||||||
// private int mStartId;
|
private int mStartId;
|
||||||
|
|
||||||
public static void actionReschedule(Context context) {
|
public static void actionReschedule(Context context) {
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
@ -68,7 +68,7 @@ public class MailService extends Service {
|
|||||||
setForeground(true); // if it gets killed once, it'll never restart
|
setForeground(true); // if it gets killed once, it'll never restart
|
||||||
Log.v(Email.LOG_TAG, "***** MailService *****: onStart(" + intent + ", " + startId + ")");
|
Log.v(Email.LOG_TAG, "***** MailService *****: onStart(" + intent + ", " + startId + ")");
|
||||||
super.onStart(intent, startId);
|
super.onStart(intent, startId);
|
||||||
// this.mStartId = startId;
|
this.mStartId = startId;
|
||||||
|
|
||||||
// MessagingController.getInstance(getApplication()).addListener(mListener);
|
// MessagingController.getInstance(getApplication()).addListener(mListener);
|
||||||
if (ACTION_CHECK_MAIL.equals(intent.getAction())) {
|
if (ACTION_CHECK_MAIL.equals(intent.getAction())) {
|
||||||
@ -151,6 +151,7 @@ public class MailService extends Service {
|
|||||||
if (shortestInterval == -1) {
|
if (shortestInterval == -1) {
|
||||||
Log.v(Email.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName());
|
Log.v(Email.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName());
|
||||||
alarmMgr.cancel(pi);
|
alarmMgr.cancel(pi);
|
||||||
|
stopSelf(mStartId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user