diff --git a/src/com/android/email/Email.java b/src/com/android/email/Email.java index 5377c40b6..7b27ac60a 100644 --- a/src/com/android/email/Email.java +++ b/src/com/android/email/Email.java @@ -143,11 +143,11 @@ public class Email extends Application { public static final int MANUAL_WAKE_LOCK_TIMEOUT = 120000; - public static final int PUSH_WAKE_LOCK_TIMEOUT = 30000; + public static final int PUSH_WAKE_LOCK_TIMEOUT = 40000; public static final int MAIL_SERVICE_WAKE_LOCK_TIMEOUT = 30000; - + public static final int BOOT_RECEIVER_WAKE_LOCK_TIMEOUT = 10000; /** * LED color used for the new email notitication */ diff --git a/src/com/android/email/mail/store/ImapStore.java b/src/com/android/email/mail/store/ImapStore.java index d6d77ebda..a21c66c04 100644 --- a/src/com/android/email/mail/store/ImapStore.java +++ b/src/com/android/email/mail/store/ImapStore.java @@ -1872,7 +1872,7 @@ public class ImapStore extends Store { public void start() throws MessagingException { - + receiver.pushInProgress(); Runnable runner = new Runnable() { public void run() diff --git a/src/com/android/email/service/BootReceiver.java b/src/com/android/email/service/BootReceiver.java index fe3b07dd0..2174e84fb 100644 --- a/src/com/android/email/service/BootReceiver.java +++ b/src/com/android/email/service/BootReceiver.java @@ -4,6 +4,8 @@ package com.android.email.service; import com.android.email.Email; import android.net.ConnectivityManager; +import android.os.PowerManager; +import android.os.PowerManager.WakeLock; import android.util.Log; import android.content.BroadcastReceiver; @@ -12,6 +14,13 @@ import android.content.Intent; public class BootReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email"); + wakeLock.setReferenceCounted(false); + wakeLock.acquire(Email.BOOT_RECEIVER_WAKE_LOCK_TIMEOUT); + // TODO: For now, let the wakeLock expire on its own, don't release it at the end of this method, + // otherwise there's no point to it. We're trying to give the MailService some time to start. + Log.v(Email.LOG_TAG, "BootReceiver.onReceive" + intent); if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { @@ -30,6 +39,12 @@ public class BootReceiver extends BroadcastReceiver { else if (ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED.equals(intent.getAction())) { MailService.backgroundDataChanged(context); } +// else if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) { +// MailService.batteryStatusChange(context, true); +// } +// else if (Intent.ACTION_BATTERY_OKAY.equals(intent.getAction())) { +// MailService.batteryStatusChange(context, false); +// } } }