CompanyGateways / mytracks

Automatically exported from code.google.com/p/mytracks
1 stars 0 forks source link

MyTracks singleton not always available #461

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open My Tracks, start recording (MyTracks activity gets instantiated)
2. Open the track list
3. Go to the home screen
4. Wait for a long time or somehow force MyTracks to be destroyed/evicted
5. Open My Tracks again

What is the expected output? What do you see instead?
Should open the track list. Instead it crashes.

Explanation:
MyTracks is used as a singleton from many activities, when in reality there's 
absolutely no guarantee that it'll be available since the system can decide to 
evict it at any time.

This is a list of instances where this could happen:
WaypointsList
TrackList
SensorStateActivity

These are safe given the current code flow, but we probably want to get rid of 
their singleton use anyway:
ModernAuthManager (if you follow the flow this would be safe, but really, 
mixing auth manager and the activity makes no sense)
ChartSettingsDialog
SendDialog
SendToDocs

One of the possible crashes it may give is this:
E/AndroidRuntime(10071): FATAL EXCEPTION: main
E/AndroidRuntime(10071): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.google.android.maps.mytracks/com.google.android.apps.mytracks.
TrackList}: java.lang.NullPointerException
E/AndroidRuntime(10071): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime(10071): at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime(10071): at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(10071): at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime(10071): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(10071): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(10071): at 
android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(10071): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(10071): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(10071): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(10071): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(10071): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(10071): Caused by: java.lang.NullPointerException
E/AndroidRuntime(10071): at 
com.google.android.apps.mytracks.TrackList.onCreate(TrackList.java:202)
E/AndroidRuntime(10071): at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(10071): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime(10071): ... 11 more
W/ActivityManager(  110):   Force finishing activity 
com.google.android.maps.mytracks/com.google.android.apps.mytracks.TrackList
W/ActivityManager(  110): Activity pause timeout for HistoryRecord{40795a70 
com.google.android.maps.mytracks/com.google.android.apps.mytracks.TrackList

Original issue reported on code.google.com by rdama...@google.com on 17 May 2011 at 5:38

GoogleCodeExporter commented 9 years ago
Another refactoring :)

Original comment by rdama...@google.com on 24 May 2011 at 7:36

GoogleCodeExporter commented 9 years ago
Well, apparently the easiest/best way to do this is to also move tons of stuff 
out of My Tracks, such as send to google.

Original comment by rdama...@google.com on 24 May 2011 at 7:59

GoogleCodeExporter commented 9 years ago
First steps, please review:
http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=1f1f2cf8396e
09a4cfacb63ce431c03c4631ba35

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=b5032e01a2e0
5369b7975c3db5363fd32dc6d4d2

(still lots to do, but I want to sanity-check the direction where this is 
heading)

Original comment by rdama...@google.com on 25 May 2011 at 7:53

GoogleCodeExporter commented 9 years ago
A few more:
http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=5482acdb2378
d58d2e6b3937f6255277139858a7

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=30ee40fae60c
c303e75fdb6a165a93adbfe20432

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=76fc9827c4a7
65823e8b0199ceb31707e224db60

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=9b75f6a7e71b
052e7434c7acd4f7e9c2337bd0bf

Original comment by rdama...@google.com on 25 May 2011 at 11:16

GoogleCodeExporter commented 9 years ago
Last few, then this is fixed:

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=0711cec461ff
a86ecccb0479088039373d404a65

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=602444428c04
c2f17c2ff7dabccff05ec5479c0b

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=d7c20de2d5c8
24d94060e31265561e159f3a8ac7

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=d184d1088960
9ee8f0c3b4284b130e3370fedb10

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=9316b0fe0734
0a7f3a656b20e608edc0cf500cea

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=68c048602649
11652fdfe1d476d6ce644e75afa3

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=6a219bbf0cc2
d96d5db587c6f7ec02e5c81338d9

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=5aebd6a9c2f1
1281387197ceae69599efbb5674c

(but I won't merge until I try this and verify there are no bugs left)

Original comment by rdama...@google.com on 1 Jun 2011 at 4:48

GoogleCodeExporter commented 9 years ago
just a few eh?

Original comment by sandordo...@google.com on 1 Jun 2011 at 1:43

GoogleCodeExporter commented 9 years ago
Addressing review suggestions and some cleanup:

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=b34b8ecc14c9
0bfeca8f4a73d5aa2898ff7520c2#

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=e914562ddf3f
255b6638115d303308e73dd65963

Found one bug in the service binder which I still need to fix.

Original comment by rdama...@google.com on 1 Jun 2011 at 8:40

GoogleCodeExporter commented 9 years ago
Last few, finally:
http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=da114041a44a
7c4e47ded6dc7dd2109400f60690

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=32c282e37953
727be2e63e55b40e411fc16e9f6c

http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=7ae4884a601c
29c391155cc1240c000a5f6a97bc

Original comment by rdama...@google.com on 22 Jun 2011 at 8:22

GoogleCodeExporter commented 9 years ago
And a fix for some weird behaviour in send to google after the split:
http://code.google.com/r/rdamazio-mytracks-staging2/source/detail?r=ecc119c883f1
d1ae2a4bd3ee99f33ec121908587

Other than this, I'm ready to merge this clone, and any other issues will go 
into their own bugs.

Original comment by rdama...@google.com on 28 Jun 2011 at 5:54

GoogleCodeExporter commented 9 years ago
Thanks for all the reviews. We'll eventually find bugs resulting from this (too 
big change), but the main change is done.

Original comment by rdama...@google.com on 1 Jul 2011 at 5:07