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:
parent
63a22008c7
commit
dab90a7b35
@ -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"
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user