Open shankari opened 7 years ago
The relevant code is
if (BuildConfig.DEBUG) {
Log.d(context, TAG, "number of transitions = "+lastTwoTransitions.length);
if (lastTwoTransitions.length == 0) {
throw new RuntimeException("found no transitions at trip end");
}
if (lastTwoTransitions.length > 2) {
throw new RuntimeException("found too many transitions "
+lastTwoTransitions.length+ " at trip end");
}
if (!lastTwoTransitions[0].getTransition().equals(context.getString(R.string.transition_stopped_moving))) {
throw new RuntimeException("lastTransition is "+lastTwoTransitions[0].getTransition()+" NOT stopped_moving");
}
}
It looks like this can happen iff the following conditions are met:
We only really care about the first transition, so it seems like we can handle this case just fine...
Ran into this again while testing on the android test phone.
03-19 09:46:41.230 31192 31192 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver edu.berkeley.eecs.emission.cordova.transitionnotify.TransitionNotificationReceiver: java.lang.RuntimeException: found no transitions at trip end
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2732)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at android.app.ActivityThread.-wrap14(ActivityThread.java)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: Caused by: java.lang.RuntimeException: found no transitions at trip end
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at edu.berkeley.eecs.emission.cordova.transitionnotify.TransitionNotificationReceiver.getFirstLocation(TransitionNotificationReceiver.java:228)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at edu.berkeley.eecs.emission.cordova.transitionnotify.TransitionNotificationReceiver.getTripStartEndData(TransitionNotificationReceiver.java:216)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at edu.berkeley.eecs.emission.cordova.transitionnotify.TransitionNotificationReceiver.fireGenericTransition(TransitionNotificationReceiver.java:105)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at edu.berkeley.eecs.emission.cordova.transitionnotify.TransitionNotificationReceiver.onReceive(TransitionNotificationReceiver.java:86)
03-19 09:46:41.230 31192 31192 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2725)
Looking at the history, everything was fine until I left DC when I put the phone into airplane mode.
Logs for the crash are at: logcat.log.gz
Looking at the cache, we see no transitions at all.
sqlite> select distinct(key) from usercache;
trip_ended
config/consent
config/sensor_config
background/location
background/motion_activity
background/filtered_location
stats/client_nav_event
background/battery
stats/client_time
stats/client_error
config/sync_config
diary/trips-2017-03-15
diary/trips-2017-03-16
diary/trips-2017-03-17
diary/trips-2017-03-18
common-trips
ok so from the cache, the oldest location point is right around the last trip ended time. So how did the tracking start again without a geofence exit, and indeed without any transitions whatsoever? Mailing myself the logs to check...
1489852413.029||America/New_York|sensor-data|background/location||{"accuracy":432.593,"altitude":0.0,"bearing":0.0,"elapsedRealtimeNanos":3017745698000000,"filter":"time","fmt_time":"Mar 18, 2017 11:53:32 AM","latitude":38.8562041,"longitude":-77.0424406,"sensed_speed":0.0,"ts":1.489852412961E9}
Let's keep this open until we find the root cause.