From 8e51d6cf14e006498bb57c1250bb2fc05a179e3b Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Thu, 14 May 2009 02:26:23 +0000 Subject: [PATCH] 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. --- src/com/android/email/service/MailService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/service/MailService.java b/src/com/android/email/service/MailService.java index 5dc112491..6fb6ab20c 100644 --- a/src/com/android/email/service/MailService.java +++ b/src/com/android/email/service/MailService.java @@ -41,7 +41,7 @@ public class MailService extends Service { private Listener mListener = new Listener(); - // private int mStartId; + private int mStartId; public static void actionReschedule(Context context) { Intent i = new Intent(); @@ -68,7 +68,7 @@ public class MailService extends Service { setForeground(true); // if it gets killed once, it'll never restart Log.v(Email.LOG_TAG, "***** MailService *****: onStart(" + intent + ", " + startId + ")"); super.onStart(intent, startId); - // this.mStartId = startId; + this.mStartId = startId; // MessagingController.getInstance(getApplication()).addListener(mListener); if (ACTION_CHECK_MAIL.equals(intent.getAction())) { @@ -151,6 +151,7 @@ public class MailService extends Service { if (shortestInterval == -1) { Log.v(Email.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName()); alarmMgr.cancel(pi); + stopSelf(mStartId); } else {