1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

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 daf04c2a9c
commit a8440032e9
2 changed files with 4 additions and 6 deletions

View File

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

View File

@ -659,6 +659,8 @@ public class StorageManager {
sync.writeLock.lock(); sync.writeLock.lock();
sync.unmounting = false; sync.unmounting = false;
sync.writeLock.unlock(); 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) // 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);
} }
/** /**