AI 148377: Push Mode changes: (1) Add android.permission.WAKE_LOCK and

READ_PHONE_STATE so a push mode service can hold an active
  network connection, monitor roaming status, etc.  (2) Refresh
  push mode status on Refresh(), not just on Check, so UI
  (settings) changes, which call refresh(), propagate immediately
  to the stores.
  BUG=1776149

Automated import of CL 148377
This commit is contained in:
Andy Stadler 2009-05-06 17:50:29 -07:00 committed by The Android Open Source Project
parent 63a22008c7
commit dab90a7b35
2 changed files with 9 additions and 3 deletions

View File

@ -22,6 +22,11 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<!-- Only required if a store implements push mail and needs to keep network open -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<permission android:name="com.android.email.permission.READ_ATTACHMENT"
android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="dangerous"

View File

@ -163,10 +163,11 @@ public class MailService extends Service {
int shortestInterval = -1;
for (Account account : Preferences.getPreferences(this).getAccounts()) {
if (account.getAutomaticCheckIntervalMinutes() > 0
&& (account.getAutomaticCheckIntervalMinutes() < shortestInterval || shortestInterval == -1)) {
shortestInterval = account.getAutomaticCheckIntervalMinutes();
int interval = account.getAutomaticCheckIntervalMinutes();
if (interval > 0 && (interval < shortestInterval || shortestInterval == -1)) {
shortestInterval = interval;
}
enablePushMail(account, interval == Account.CHECK_INTERVAL_PUSH);
}
if (shortestInterval == -1) {