Fixes Issue 3102 in cooperation with vincent...@gmail.com

Reset service enablement and MailService scheduling whenever a storage
medium is mounted or unmounted.
This commit is contained in:
danapple 2011-03-09 23:04:05 -06:00
parent 4f59a04fd5
commit 7891b24c31
2 changed files with 4 additions and 6 deletions

View file

@ -320,11 +320,7 @@ public class K9 extends Application {
}
public static void setServicesEnabled(Context context, Integer wakeLockId) {
setServicesEnabled(context, Preferences.getPreferences(context).getAvailableAccounts().size() > 0, wakeLockId);
}
public static void setServicesEnabled(Context context, boolean enabled, Integer wakeLockId) {
private static void setServicesEnabled(Context context, boolean enabled, Integer wakeLockId) {
PackageManager pm = context.getPackageManager();

View file

@ -659,6 +659,8 @@ public class StorageManager {
sync.writeLock.lock();
sync.unmounting = false;
sync.writeLock.unlock();
K9.setServicesEnabled(K9.app);
}
/**
@ -684,7 +686,7 @@ public class StorageManager {
}
// XXX we should reset mail service ONLY if there are accounts using the storage (this is not done in a regular listener because it has to be invoked afterward)
MailService.actionReset(mApplication, null);
K9.setServicesEnabled(K9.app);
}
/**