mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-14 07:08:00 -05:00
Addresses mpredosin's comments on r420
This commit is contained in:
parent
f4417e7bae
commit
f1232a119a
@ -2647,13 +2647,14 @@ public class MessagingController implements Runnable {
|
|||||||
final boolean useManualWakeLock,
|
final boolean useManualWakeLock,
|
||||||
final MessagingListener listener) {
|
final MessagingListener listener) {
|
||||||
|
|
||||||
|
WakeLock twakeLock = null;
|
||||||
if (useManualWakeLock) {
|
if (useManualWakeLock) {
|
||||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email");
|
twakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email");
|
||||||
wakeLock.setReferenceCounted(false);
|
twakeLock.setReferenceCounted(false);
|
||||||
wakeLock.acquire(Email.MANUAL_WAKE_LOCK_TIMEOUT);
|
twakeLock.acquire(Email.MANUAL_WAKE_LOCK_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
final WakeLock wakeLock = twakeLock;
|
||||||
|
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners()) {
|
||||||
l.checkMailStarted(context, account);
|
l.checkMailStarted(context, account);
|
||||||
@ -2870,7 +2871,10 @@ public class MessagingController implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
Log.i(Email.LOG_TAG, "Finished mail sync");
|
Log.i(Email.LOG_TAG, "Finished mail sync");
|
||||||
|
if (wakeLock != null)
|
||||||
|
{
|
||||||
|
wakeLock.release();
|
||||||
|
}
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners()) {
|
||||||
l.checkMailFinished(context, account);
|
l.checkMailFinished(context, account);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user