View Issue Details

IDProjectCategoryView StatusLast Update
0011798MMAGeneralpublic2014-12-02 20:03
Reportermarek Assigned To 
PriorityurgentSeveritymajorReproducibilitysometimes
Status resolvedResolutionfixed 
Product Version1.0.4 
Target Version1.1.0Fixed in Version1.1.0 
Summary0011798: Initialization of application in Application instance --> battery drain & other issues
DescriptionMany things are initialized in onCreate method of application instance. But this method shouldn't be used this way, because Application is not real component with complete lifecycle and it is not reliable.

It probably causes these issues:
1. Content provider is not created. All DB operations fails because URLs are unknown.
2. Theme is not set. It cause NPE sometimes.
3. Sometimes, application instance is created twice.

According to
http://developer.android.com/guide/components/fundamentals.html
and
http://stackoverflow.com/questions/3947052/android-application-class-being-called-twice

all this initialization procedures should be moved to Services or Activities.

We are now using DbInfoRefreshSevice, that might be improved and all DB operations might be moved here. After that we have to implement running of this Service from Activity. StartActivity might be the best candidate.
TagsNo tags attached.
Attached Files
logs-1114341319.zip (102,893 bytes)
Fixed in build345

Relationships

parent of 0011770 closedmarek StorageObserverService fails to stop sometimes 

Activities

marek

2014-02-04 17:38

developer   ~0039510

I have found another issue.

Start of MediaMonkey app causes start of StorageObserverService. This service is stopped when MediaMonkey goes to background. But MediaMonkey instance can be created even when no activity is started so there is nothing that can stop the service. This cause battery drain because MMA fails to stop. This is quite rare but important issue. I have attached log with this issue at 15:58:02.940.

marek

2014-02-17 17:06

developer   ~0039640

Last edited: 2014-02-17 17:07

Partly fixed in build 228

Some functionality were moved to SyncLauncher. Here it started only when some Activity is started. This should fix the battery drain issue and some crashes. This is probably save. I have made some tests but it should be tested further..especially some special cases like:

a. mounting/unmounting storage when MMA is not running
  - MMA should start but finish shortly
b. finishing while some sync is running
  - i.e. stop delay should expire before sync is finished..i.e. it might be easily tested with short notification stop delays
  - MMA should not restart StorageObserverService and should finish after some sync service (WifiSyncService, MediaStoreService, UsbSyncService) is finished. This is visible in system options..in details of running app.
c. it should be tested with various notifications stop delays

But there is still some code that should be moved from MediaMonkey instance.

marek

2014-12-02 10:49

developer   ~0041268

Fixed in build 345