locus-api icon indicating copy to clipboard operation
locus-api copied to clipboard

Nullpointer instead of Error message using getTrack on large tracks

Open Falcosc opened this issue 9 months ago • 5 comments

Track content Provide behaives strange cursor.getString(0): "track" cursor.getBlob(1): null

And I did not get any errors logged from menion.android.locus.pro Can we get any kind of indication if the Content Provider does not like our Tracks?

I imported my 26 hour and 300km long 9500hm MTB marathon. Export over ui works as well. But even 5MB small GPX files cause this content provider issue. I got 2,5MB working with 11.000 points

2025-02-17 21:24:36.334  4483-4483  HWUI                    menion.android.locus.pro             W  Image decoding logging dropped!
2025-02-17 21:24:38.908  4483-4483  EventBus                menion.android.locus.pro             D  No subscribers registered for event class o.zzqv$IconCompatParcelizer
2025-02-17 21:24:38.908  4483-4483  EventBus                menion.android.locus.pro             D  No subscribers registered for event class o.bUI
2025-02-17 21:24:39.083  4483-4483  InsetsController        menion.android.locus.pro             D  hide(ime(), fromIme=false)
2025-02-17 21:24:39.083  4483-4483  ImeTracker              menion.android.locus.pro             I  menion.android.locus.pro:2ccda0ed: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
2025-02-17 21:24:39.277  4483-4483  WindowOnBackDispatcher  menion.android.locus.pro             W  sendCancelIfRunning: isInProgress=false callback=android.view.ViewRootImpl$$ExternalSyntheticLambda13@fec116d
2025-02-17 21:24:39.298  4483-4883  HWUI                    menion.android.locus.pro             D  endAllActiveAnimators on 0x7ec9b8508360 (RippleDrawable) with handle 0x7ec9a8328080
2025-02-17 21:24:41.055  4483-11462 FA                      menion.android.locus.pro             I  Application backgrounded at: timestamp_millis: 1739823879053
2025-02-17 21:24:44.090  4483-4488  droid.locus.pro         menion.android.locus.pro             I  Background concurrent mark compact GC freed 9030KB AllocSpace bytes, 12(2216KB) LOS objects, 14% free, 136MB/160MB, paused 2.124ms,4.822ms total 297.088ms
2025-02-17 21:24:44.099  4483-4490  droid.locus.pro         menion.android.locus.pro             W  ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~oRdPff25RDp-Il16MllNnw==/falcosc.locus.addon.tasker-IAidFHmDRfmSlAkE6iU87Q==/base.apk' with 1 weak references
2025-02-17 21:24:44.537  6226-6226  ActionBasics            falcosc.locus.addon.tasker           E  getTrack(android.app.Application@b0fd515, 5)
                                                                                                    java.lang.NullPointerException: getBlob(...) must not be null
                                                                                                    	at locus.api.android.ActionBasics.getTrack(ActionBasics.kt:820)
                                                                                                    	at locus.api.android.utils.IntentHelper.getTrackFromIntent(IntentHelper.kt:387)
                                                                                                    	at falcosc.locus.addon.tasker.LocusRunTaskerActivity.startTask(LocusRunTaskerActivity.java:212)
                                                                                                    	at falcosc.locus.addon.tasker.LocusRunTaskerActivity.onCreate(LocusRunTaskerActivity.java:85)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:9062)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:9040)
                                                                                                    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531)
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4152)
                                                                                                    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4357)
                                                                                                    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2735)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:109)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8875)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:891)
2025-02-17 21:24:44.565  6226-6226  LocusRunTaskerActivity  falcosc.locus.addon.tasker           D  Map: {INTENT_EXTRA_PACKAGE_NAME_String=menion.android.locus.pro, INTENT_EXTRA_ITEM_ID_Long=5, activityId_String=kz, action=locus.api.android.INTENT_ITEM_TRACK_TOOLS}
2025-02-17 21:24:44.577  6226-6226  Choreographer           falcosc.locus.addon.tasker           I  Skipped 327 frames!  The application may be doing too much work on its main thread.
2025-02-17 21:24:44.595  4483-4483  EventBus                menion.android.locus.pro             D  No subscribers registered for event class o.zzqv$IconCompatParcelizer
2025-02-17 21:24:44.598  4483-4483  EventBus                menion.android.locus.pro             D  No subscribers registered for event class o.bUI
2025-02-17 21:24:44.617  4483-4488  droid.locus.pro         menion.android.locus.pro             I  Background concurrent mark compact GC freed 35MB AllocSpace bytes, 10(16MB) LOS objects, 12% free, 172MB/196MB, paused 1.049ms,4.417ms total 297.622ms
2025-02-17 21:24:44.626  4483-4483  ApplicationObserver     menion.android.locus.pro             W  onEnterForeground()
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:44.649  4483-4483  sN                      menion.android.locus.pro             W  onEvent(o.zzqv$MediaBrowserCompatCustomActionResultReceiver@4befc9e)
2025-02-17 21:24:45.113  6226-6226  TaskerActionFire        falcosc.locus.addon.tasker           I  onReceive: Bundle[{LOCUS_ADDON_ACTION_TYPE=TRACK_POINTS_REQUEST, INTENT_EXTRA_LOCATION_FIELDS=Altitude, Bearing, Id, Lat, Lon, Speed, Time, WaypointIndex, INTENT_EXTRA_COUNT=200, INTENT_EXTRA_OFFSET=0, INTENT_EXTRA_WAYPOINT_FIELDS=Description, Comment, RelativeWorkingDir, Type, GeocacheCode, PoiAlertInclude, Language, AddressStreet, AddressCity, AddressRegion, AddressPostCode, AddressCountry, RIndex, RDistanceF, RTimeI, RSpeedF, RTurnCost, RStreet, RPointAction, RPointPassPlaceNotify, RComputeType, RSimpleRoundabouts, RPlanDefinition, RMaxSpeeds, RWayTypes, RSurfaces, RWarnings, OsmNotesId, OsmNotesClosed, LopointsId, LopointsLabels, LopointsOpeningHours, LopointsTimezone, LopointsGeometry, Lomedia, LopointReviews, INTENT_EXTRA_TRK_POINTS_TYPE=WAYPOINTS_AND_POINTS, INTENT_EXTRA_TRK_SOURCE=LOAD_SHARE}]

same for Locus 4.28

2025-02-17 21:49:57.063  4406-13092 HWUI                    menion.android.locus                 D  endAllActiveAnimators on 0x7ec9b83a68d0 (RippleDrawable) with handle 0x7ec9a8308640
2025-02-17 21:49:57.601  4406-4412  n.android.locus         menion.android.locus                 I  Background concurrent mark compact GC freed 28MB AllocSpace bytes, 37(6188KB) LOS objects, 31% free, 53MB/77MB, paused 2.606ms,4.626ms total 146.393ms
2025-02-17 21:49:57.608  4406-4414  n.android.locus         menion.android.locus                 W  ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~oRdPff25RDp-Il16MllNnw==/falcosc.locus.addon.tasker-IAidFHmDRfmSlAkE6iU87Q==/base.apk' with 1 weak references
2025-02-17 21:49:57.626  6226-6226  ActionBasics            falcosc.locus.addon.tasker           E  getTrack(android.app.Application@b0fd515, 1)
                                                                                                    java.lang.NullPointerException: getBlob(...) must not be null
                                                                                                    	at locus.api.android.ActionBasics.getTrack(ActionBasics.kt:820)
                                                                                                    	at locus.api.android.utils.IntentHelper.getTrackFromIntent(IntentHelper.kt:387)
                                                                                                    	at falcosc.locus.addon.tasker.LocusRunTaskerActivity.startTask(LocusRunTaskerActivity.java:212)
                                                                                                    	at falcosc.locus.addon.tasker.LocusRunTaskerActivity.onCreate(LocusRunTaskerActivity.java:85)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:9062)
                                                                                                    	at android.app.Activity.performCreate(Activity.java:9040)
                                                                                                    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531)
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4152)
                                                                                                    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4357)
                                                                                                    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2735)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:109)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8875)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:891)
2025-02-17 21:49:57.637  6226-6226  LocusRunTaskerActivity  falcosc.locus.addon.tasker           D  Map: {INTENT_EXTRA_PACKAGE_NAME_String=menion.android.locus, INTENT_EXTRA_ITEM_ID_Long=1, activityId_String=zzcsx, action=locus.api.android.INTENT_ITEM_TRACK_TOOLS}
2025-02-17 21:49:57.665  4406-4406  DownloadErrorException  menion.android.locus                 W  onEnterForeground()
2025-02-17 21:49:57.677  4406-4406  zzhbq                   menion.android.locus                 W  onEvent(o.setMapContent$write@7de9c3c)
2025-02-17 21:49:57.677  4406-4406  zzhbq                   menion.android.locus                 W  onEvent(o.setMapContent$write@7de9c3c)
2025-02-17 21:49:57.779  4406-4406  InsetsController        menion.android.locus                 D  hide(ime(), fromIme=false)
2025-02-17 21:49:57.779  4406-4406  ImeTracker              menion.android.locus                 I  menion.android.locus:fbe26447: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
2025-02-17 21:49:58.210  6226-6226  TaskerActionFire        falcosc.locus.addon.tasker           I  onReceive: Bundle[{LOCUS_ADDON_ACTION_TYPE=TRACK_POINTS_REQUEST, INTENT_EXTRA_LOCATION_FIELDS=Altitude, Bearing, Id, Lat, Lon, Speed, Time, WaypointIndex, INTENT_EXTRA_COUNT=200, INTENT_EXTRA_OFFSET=0, INTENT_EXTRA_WAYPOINT_FIELDS=Description, Comment, RelativeWorkingDir, Type, GeocacheCode, PoiAlertInclude, Language, AddressStreet, AddressCity, AddressRegion, AddressPostCode, AddressCountry, RIndex, RDistanceF, RTimeI, RSpeedF, RTurnCost, RStreet, RPointAction, RPointPassPlaceNotify, RComputeType, RSimpleRoundabouts, RPlanDefinition, RMaxSpeeds, RWayTypes, RSurfaces, RWarnings, OsmNotesId, OsmNotesClosed, LopointsId, LopointsLabels, LopointsOpeningHours, LopointsTimezone, LopointsGeometry, Lomedia, LopointReviews, INTENT_EXTRA_TRK_POINTS_TYPE=WAYPOINTS_AND_POINTS, INTENT_EXTRA_TRK_SOURCE=LOAD_SHARE}]

but Locus 4.28 did

DownloadErrorException  menion.android.locus                 W  onEnterForeground()

maybe the reason is stored somewhere.

If not, here is the large file 10553_2018-08-04T12-52-23.000Z.zip

Falcosc avatar Feb 17 '25 21:02 Falcosc

These are Details for a working track: GPX Size 2,5MB Point Count: 11.000 Blob Size: 1,5MB locus.api.objects.geoData.Track size: 2,1MB

Track Blobs over 3mb cause trouble on Locus 3.7 and 4.28

Falcosc avatar Feb 17 '25 21:02 Falcosc

@menion should we catch null pointer meanwhile as known issue or did you already think about a direction of this topic?

Falcosc avatar Feb 27 '25 21:02 Falcosc

Do you like to get a pull request?

Falcosc avatar Mar 10 '25 08:03 Falcosc

Hello Falcos, sorry, I'm quite busy on MyLibrary and the Locus API is a minor problem for now.

Well, bundles used in ContentProviders are usually limited to 1MB, while on modern devices, they are limited to 2MB. So problems here make sense and are hardly solvable with the method used now. Solution is using FileProvider in a similar way like sending tracks to Locus (over a temporary file). Later, sorry.

menion avatar Mar 14 '25 07:03 menion

Oh, is it? I thought ContentProviders are the way to transmit more than 1mb intent limit.

2mb is fine for me, but it's important to know about this instead of getting null :)

What about an exception for tracks larger than technology limit to inform users and mention when this exception is most likely to be expected in method doc?

I guess locus maps catches the limit exception and just returns null into the content provider, at least that's how it feels looking on the cursor content.

Would it help you if I create a pull request to treat null as track too large exception and add a note in the method documentation about when it occurs?

Falcosc avatar Mar 14 '25 09:03 Falcosc