mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 10:22:15 -05:00
Log message cleanup
This commit is contained in:
parent
f9e8c877ff
commit
875dc31d5a
@ -916,10 +916,10 @@ public class MessagingController implements Runnable
|
|||||||
|
|
||||||
if (Account.EXPUNGE_ON_POLL.equals(account.getExpungePolicy()))
|
if (Account.EXPUNGE_ON_POLL.equals(account.getExpungePolicy()))
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(K9.LOG_TAG, "SYNC: Expunging folder " + account.getDescription() + ":" + folder);
|
Log.d(K9.LOG_TAG, "SYNC: Expunging folder " + account.getDescription() + ":" + folder);
|
||||||
}
|
}
|
||||||
remoteFolder.expunge();
|
remoteFolder.expunge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.w(K9.LOG_TAG, "BootReceiver WakeLock " + wakeLockId + " doesn't exist");
|
if (K9.DEBUG)
|
||||||
|
Log.w(K9.LOG_TAG, "BootReceiver WakeLock " + wakeLockId + " doesn't exist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +65,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
Integer tmpWakeLockId = getWakeLock(context);
|
Integer tmpWakeLockId = getWakeLock(context);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "BootReceiver.onReceive" + intent);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "BootReceiver.onReceive" + intent);
|
||||||
|
|
||||||
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
|
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
|
||||||
{
|
{
|
||||||
@ -97,7 +99,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
||||||
String alarmedAction = alarmedIntent.getAction();
|
String alarmedAction = alarmedIntent.getAction();
|
||||||
|
|
||||||
Log.i(K9.LOG_TAG, "BootReceiver Got alarm to fire alarmedIntent " + alarmedAction);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "BootReceiver Got alarm to fire alarmedIntent " + alarmedAction);
|
||||||
alarmedIntent.putExtra(WAKE_LOCK_ID, tmpWakeLockId);
|
alarmedIntent.putExtra(WAKE_LOCK_ID, tmpWakeLockId);
|
||||||
tmpWakeLockId = null;
|
tmpWakeLockId = null;
|
||||||
if (alarmedIntent != null)
|
if (alarmedIntent != null)
|
||||||
@ -109,7 +112,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
{
|
{
|
||||||
long atTime = intent.getLongExtra(AT_TIME, -1);
|
long atTime = intent.getLongExtra(AT_TIME, -1);
|
||||||
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
||||||
Log.i(K9.LOG_TAG,"BootReceiver Scheduling intent " + alarmedIntent + " for " + new Date(atTime));
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG,"BootReceiver Scheduling intent " + alarmedIntent + " for " + new Date(atTime));
|
||||||
|
|
||||||
PendingIntent pi = buildPendingIntent(context, intent);
|
PendingIntent pi = buildPendingIntent(context, intent);
|
||||||
AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
|
AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
|
||||||
@ -119,7 +123,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
else if (CANCEL_INTENT.equals(intent.getAction()))
|
else if (CANCEL_INTENT.equals(intent.getAction()))
|
||||||
{
|
{
|
||||||
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT);
|
||||||
Log.i(K9.LOG_TAG, "BootReceiver Canceling alarmedIntent " + alarmedIntent);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "BootReceiver Canceling alarmedIntent " + alarmedIntent);
|
||||||
|
|
||||||
PendingIntent pi = buildPendingIntent(context, intent);
|
PendingIntent pi = buildPendingIntent(context, intent);
|
||||||
|
|
||||||
@ -131,7 +136,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
Integer wakeLockId = intent.getIntExtra(WAKE_LOCK_ID, -1);
|
Integer wakeLockId = intent.getIntExtra(WAKE_LOCK_ID, -1);
|
||||||
if (wakeLockId != -1)
|
if (wakeLockId != -1)
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "BootReceiver Release wakeLock " + wakeLockId);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "BootReceiver Release wakeLock " + wakeLockId);
|
||||||
releaseWakeLock(wakeLockId);
|
releaseWakeLock(wakeLockId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +164,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
|
|
||||||
public static void scheduleIntent(Context context, long atTime, Intent alarmedIntent)
|
public static void scheduleIntent(Context context, long atTime, Intent alarmedIntent)
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "BootReceiver Got request to schedule alarmedIntent " + alarmedIntent.getAction());
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "BootReceiver Got request to schedule alarmedIntent " + alarmedIntent.getAction());
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.setClass(context, BootReceiver.class);
|
i.setClass(context, BootReceiver.class);
|
||||||
i.setAction(SCHEDULE_INTENT);
|
i.setAction(SCHEDULE_INTENT);
|
||||||
@ -169,7 +176,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
|
|
||||||
public static void cancelIntent(Context context, Intent alarmedIntent)
|
public static void cancelIntent(Context context, Intent alarmedIntent)
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "BootReceiver Got request to cancel alarmedIntent " + alarmedIntent.getAction());
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "BootReceiver Got request to cancel alarmedIntent " + alarmedIntent.getAction());
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.setClass(context, BootReceiver.class);
|
i.setClass(context, BootReceiver.class);
|
||||||
i.setAction(CANCEL_INTENT);
|
i.setAction(CANCEL_INTENT);
|
||||||
@ -179,7 +187,8 @@ public class BootReceiver extends BroadcastReceiver
|
|||||||
|
|
||||||
public static void releaseWakeLock(Context context, int wakeLockId)
|
public static void releaseWakeLock(Context context, int wakeLockId)
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "BootReceiver Got request to release wakeLock " + wakeLockId);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "BootReceiver Got request to release wakeLock " + wakeLockId);
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.setClass(context, BootReceiver.class);
|
i.setClass(context, BootReceiver.class);
|
||||||
i.setAction(WAKE_LOCK_RELEASE);
|
i.setAction(WAKE_LOCK_RELEASE);
|
||||||
|
@ -49,7 +49,8 @@ public abstract class CoreService extends Service
|
|||||||
wakeLock.setReferenceCounted(false);
|
wakeLock.setReferenceCounted(false);
|
||||||
wakeLock.acquire(K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT);
|
||||||
|
|
||||||
Log.i(K9.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onStart(" + intent + ", " + startId);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onStart(" + intent + ", " + startId);
|
||||||
|
|
||||||
int wakeLockId = intent.getIntExtra(BootReceiver.WAKE_LOCK_ID, -1);
|
int wakeLockId = intent.getIntExtra(BootReceiver.WAKE_LOCK_ID, -1);
|
||||||
if (wakeLockId != -1)
|
if (wakeLockId != -1)
|
||||||
@ -60,16 +61,12 @@ public abstract class CoreService extends Service
|
|||||||
if (coreWakeLockId != null && coreWakeLockId != -1)
|
if (coreWakeLockId != null && coreWakeLockId != -1)
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "Got core wake lock id " + coreWakeLockId);
|
Log.d(K9.LOG_TAG, "Got core wake lock id " + coreWakeLockId);
|
||||||
}
|
|
||||||
WakeLock coreWakeLock = wakeLocks.remove(coreWakeLockId);
|
WakeLock coreWakeLock = wakeLocks.remove(coreWakeLockId);
|
||||||
if (coreWakeLock != null)
|
if (coreWakeLock != null)
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "Found core wake lock with id " + coreWakeLockId + ", releasing");
|
Log.d(K9.LOG_TAG, "Found core wake lock with id " + coreWakeLockId + ", releasing");
|
||||||
}
|
|
||||||
coreWakeLock.release();
|
coreWakeLock.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +99,8 @@ public abstract class CoreService extends Service
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onDestroy()");
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onDestroy()");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
// MessagingController.getInstance(getApplication()).removeListener(mListener);
|
// MessagingController.getInstance(getApplication()).removeListener(mListener);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,8 @@ public class MailService extends CoreService
|
|||||||
public void onCreate()
|
public void onCreate()
|
||||||
{
|
{
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Log.v(K9.LOG_TAG, "***** MailService *****: onCreate");
|
if (K9.DEBUG)
|
||||||
|
Log.v(K9.LOG_TAG, "***** MailService *****: onCreate");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -121,13 +122,15 @@ public class MailService extends CoreService
|
|||||||
}
|
}
|
||||||
|
|
||||||
setForeground(true); // if it gets killed once, it'll never restart
|
setForeground(true); // if it gets killed once, it'll never restart
|
||||||
Log.i(K9.LOG_TAG, "MailService.onStart(" + intent + ", " + startId
|
if (K9.DEBUG)
|
||||||
+ "), hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground);
|
Log.i(K9.LOG_TAG, "MailService.onStart(" + intent + ", " + startId
|
||||||
|
+ "), hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground);
|
||||||
|
|
||||||
// MessagingController.getInstance(getApplication()).addListener(mListener);
|
// MessagingController.getInstance(getApplication()).addListener(mListener);
|
||||||
if (ACTION_CHECK_MAIL.equals(intent.getAction()))
|
if (ACTION_CHECK_MAIL.equals(intent.getAction()))
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "***** MailService *****: checking mail");
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "***** MailService *****: checking mail");
|
||||||
|
|
||||||
if (hasConnectivity && doBackground)
|
if (hasConnectivity && doBackground)
|
||||||
{
|
{
|
||||||
@ -181,7 +184,8 @@ public class MailService extends CoreService
|
|||||||
notifyConnectionStatus(hasConnectivity);
|
notifyConnectionStatus(hasConnectivity);
|
||||||
rescheduleAll(hasConnectivity, doBackground, startIdObj);
|
rescheduleAll(hasConnectivity, doBackground, startIdObj);
|
||||||
startIdObj = null;
|
startIdObj = null;
|
||||||
Log.i(K9.LOG_TAG, "Got connectivity action with hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "Got connectivity action with hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground);
|
||||||
}
|
}
|
||||||
else if (CANCEL_CONNECTIVITY_NOTICE.equals(intent.getAction()))
|
else if (CANCEL_CONNECTIVITY_NOTICE.equals(intent.getAction()))
|
||||||
{
|
{
|
||||||
@ -195,8 +199,8 @@ public class MailService extends CoreService
|
|||||||
stopSelf(startId);
|
stopSelf(startId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long endTime = System.currentTimeMillis();
|
if (K9.DEBUG)
|
||||||
Log.i(K9.LOG_TAG, "MailService.onStart took " + (endTime - startTime) + "ms");
|
Log.i(K9.LOG_TAG, "MailService.onStart took " + (System.currentTimeMillis() - startTime) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rescheduleAll(final boolean hasConnectivity, final boolean doBackground, final Integer startId)
|
private void rescheduleAll(final boolean hasConnectivity, final boolean doBackground, final Integer startId)
|
||||||
@ -246,7 +250,8 @@ public class MailService extends CoreService
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "***** MailService *****: onDestroy()");
|
if (K9.DEBUG)
|
||||||
|
Log.v(K9.LOG_TAG, "***** MailService *****: onDestroy()");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
// MessagingController.getInstance(getApplication()).removeListener(mListener);
|
// MessagingController.getInstance(getApplication()).removeListener(mListener);
|
||||||
}
|
}
|
||||||
@ -278,7 +283,8 @@ public class MailService extends CoreService
|
|||||||
|
|
||||||
if (shortestInterval == -1)
|
if (shortestInterval == -1)
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName());
|
if (K9.DEBUG)
|
||||||
|
Log.v(K9.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName());
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -286,15 +292,18 @@ public class MailService extends CoreService
|
|||||||
long delay = (shortestInterval * (60 * 1000));
|
long delay = (shortestInterval * (60 * 1000));
|
||||||
|
|
||||||
long nextTime = System.currentTimeMillis() + delay;
|
long nextTime = System.currentTimeMillis() + delay;
|
||||||
try
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
String checkString = "Next check for package " + getApplication().getPackageName() + " scheduled for " + new Date(nextTime);
|
try
|
||||||
Log.i(K9.LOG_TAG, checkString);
|
{
|
||||||
}
|
Log.i(K9.LOG_TAG,
|
||||||
catch (Exception e)
|
"Next check for package " + getApplication().getPackageName() + " scheduled for " + new Date(nextTime));
|
||||||
{
|
}
|
||||||
// I once got a NullPointerException deep in new Date();
|
catch (Exception e)
|
||||||
Log.e(K9.LOG_TAG, "Exception while logging", e);
|
{
|
||||||
|
// I once got a NullPointerException deep in new Date();
|
||||||
|
Log.e(K9.LOG_TAG, "Exception while logging", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
@ -407,10 +416,9 @@ public class MailService extends CoreService
|
|||||||
if (minInterval != -1)
|
if (minInterval != -1)
|
||||||
{
|
{
|
||||||
long nextTime = System.currentTimeMillis() + minInterval;
|
long nextTime = System.currentTimeMillis() + minInterval;
|
||||||
String checkString = "Next pusher refresh scheduled for " + new Date(nextTime);
|
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(K9.LOG_TAG, checkString);
|
Log.d(K9.LOG_TAG, "Next pusher refresh scheduled for " + new Date(nextTime));
|
||||||
}
|
}
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
|
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
|
||||||
@ -428,20 +436,23 @@ public class MailService extends CoreService
|
|||||||
final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9");
|
final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9");
|
||||||
wakeLock.setReferenceCounted(false);
|
wakeLock.setReferenceCounted(false);
|
||||||
wakeLock.acquire(wakeLockTime);
|
wakeLock.acquire(wakeLockTime);
|
||||||
Log.i(K9.LOG_TAG, "MailService queueing Runnable " + runner.hashCode() + " with startId " + startId);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "MailService queueing Runnable " + runner.hashCode() + " with startId " + startId);
|
||||||
|
|
||||||
Runnable myRunner = new Runnable()
|
Runnable myRunner = new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (K9.DEBUG)
|
||||||
Log.i(K9.LOG_TAG, "MailService running Runnable " + runner.hashCode() + " with startId " + startId);
|
Log.i(K9.LOG_TAG, "MailService running Runnable " + runner.hashCode() + " with startId " + startId);
|
||||||
runner.run();
|
runner.run();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "MailService completed Runnable " + runner.hashCode() + " with startId " + startId);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "MailService completed Runnable " + runner.hashCode() + " with startId " + startId);
|
||||||
wakeLock.release();
|
wakeLock.release();
|
||||||
if (startId != null)
|
if (startId != null)
|
||||||
{
|
{
|
||||||
|
@ -40,13 +40,15 @@ public class PollService extends CoreService
|
|||||||
{
|
{
|
||||||
if (START_SERVICE.equals(intent.getAction()))
|
if (START_SERVICE.equals(intent.getAction()))
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "PollService started with startId = " + startId);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "PollService started with startId = " + startId);
|
||||||
|
|
||||||
MessagingController controller = MessagingController.getInstance(getApplication());
|
MessagingController controller = MessagingController.getInstance(getApplication());
|
||||||
Listener listener = (Listener)controller.getCheckMailListener();
|
Listener listener = (Listener)controller.getCheckMailListener();
|
||||||
if (listener == null)
|
if (listener == null)
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "***** PollService *****: starting new check");
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "***** PollService *****: starting new check");
|
||||||
mListener.setStartId(startId);
|
mListener.setStartId(startId);
|
||||||
mListener.wakeLockAcquire();
|
mListener.wakeLockAcquire();
|
||||||
controller.setCheckMailListener(mListener);
|
controller.setCheckMailListener(mListener);
|
||||||
@ -54,14 +56,16 @@ public class PollService extends CoreService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG,"***** PollService *****: renewing WakeLock");
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG,"***** PollService *****: renewing WakeLock");
|
||||||
listener.setStartId(startId);
|
listener.setStartId(startId);
|
||||||
listener.wakeLockAcquire();
|
listener.wakeLockAcquire();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (STOP_SERVICE.equals(intent.getAction()))
|
else if (STOP_SERVICE.equals(intent.getAction()))
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "PollService stopping");
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "PollService stopping");
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +162,8 @@ public class PollService extends CoreService
|
|||||||
controller.setCheckMailListener(null);
|
controller.setCheckMailListener(null);
|
||||||
MailService.rescheduleCheck(PollService.this, null);
|
MailService.rescheduleCheck(PollService.this, null);
|
||||||
wakeLockRelease();
|
wakeLockRelease();
|
||||||
Log.i(K9.LOG_TAG, "PollService stopping with startId = " + startId);
|
if (K9.DEBUG)
|
||||||
|
Log.i(K9.LOG_TAG, "PollService stopping with startId = " + startId);
|
||||||
|
|
||||||
stopSelf(startId);
|
stopSelf(startId);
|
||||||
}
|
}
|
||||||
@ -167,7 +172,8 @@ public class PollService extends CoreService
|
|||||||
public void checkMailFinished(Context context, Account account)
|
public void checkMailFinished(Context context, Account account)
|
||||||
{
|
{
|
||||||
|
|
||||||
Log.v(K9.LOG_TAG, "***** PollService *****: checkMailFinished");
|
if (K9.DEBUG)
|
||||||
|
Log.v(K9.LOG_TAG, "***** PollService *****: checkMailFinished");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
checkMailDone(context, account);
|
checkMailDone(context, account);
|
||||||
|
@ -26,9 +26,7 @@ public class SleepService extends CoreService
|
|||||||
{
|
{
|
||||||
Integer id = latchId.getAndIncrement();
|
Integer id = latchId.getAndIncrement();
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "SleepService Preparing CountDownLatch with id = " + id + ", thread " + Thread.currentThread().getName());
|
Log.d(K9.LOG_TAG, "SleepService Preparing CountDownLatch with id = " + id + ", thread " + Thread.currentThread().getName());
|
||||||
}
|
|
||||||
SleepDatum sleepDatum = new SleepDatum();
|
SleepDatum sleepDatum = new SleepDatum();
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
sleepDatum.latch = latch;
|
sleepDatum.latch = latch;
|
||||||
@ -53,9 +51,7 @@ public class SleepService extends CoreService
|
|||||||
if (timedOut == false)
|
if (timedOut == false)
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "SleepService latch timed out for id = " + id + ", thread " + Thread.currentThread().getName());
|
Log.d(K9.LOG_TAG, "SleepService latch timed out for id = " + id + ", thread " + Thread.currentThread().getName());
|
||||||
}
|
|
||||||
// don't call endSleep here or remove the sleepDatum here, instead of the following block.
|
// don't call endSleep here or remove the sleepDatum here, instead of the following block.
|
||||||
// We might not get the wakeLock before
|
// We might not get the wakeLock before
|
||||||
// falling asleep again, so we have to get the wakeLock *first* The alarmed version will
|
// falling asleep again, so we have to get the wakeLock *first* The alarmed version will
|
||||||
@ -77,9 +73,7 @@ public class SleepService extends CoreService
|
|||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long actualSleep = endTime - startTime;
|
long actualSleep = endTime - startTime;
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "SleepService requested sleep time was " + sleepTime + ", actual was " + actualSleep);
|
Log.d(K9.LOG_TAG, "SleepService requested sleep time was " + sleepTime + ", actual was " + actualSleep);
|
||||||
}
|
|
||||||
if (actualSleep < sleepTime)
|
if (actualSleep < sleepTime)
|
||||||
{
|
{
|
||||||
Log.w(K9.LOG_TAG, "SleepService sleep time too short: requested was " + sleepTime + ", actual was " + actualSleep);
|
Log.w(K9.LOG_TAG, "SleepService sleep time too short: requested was " + sleepTime + ", actual was " + actualSleep);
|
||||||
@ -101,9 +95,7 @@ public class SleepService extends CoreService
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "SleepService Counting down CountDownLatch with id = " + id);
|
Log.d(K9.LOG_TAG, "SleepService Counting down CountDownLatch with id = " + id);
|
||||||
}
|
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
reacquireWakeLock(sleepDatum);
|
reacquireWakeLock(sleepDatum);
|
||||||
@ -111,9 +103,7 @@ public class SleepService extends CoreService
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "SleepService Sleep for id " + id + " already finished");
|
Log.d(K9.LOG_TAG, "SleepService Sleep for id " + id + " already finished");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,9 +117,7 @@ public class SleepService extends CoreService
|
|||||||
{
|
{
|
||||||
long timeout = sleepDatum.timeout;
|
long timeout = sleepDatum.timeout;
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
|
||||||
Log.d(K9.LOG_TAG, "SleepService Acquring wakeLock for id for " + timeout + "ms");
|
Log.d(K9.LOG_TAG, "SleepService Acquring wakeLock for id for " + timeout + "ms");
|
||||||
}
|
|
||||||
wakeLock.acquire(timeout);
|
wakeLock.acquire(timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user