[android] Fixes of the track recorder #9174
No reviewers
Labels
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#9174
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "rt-android-recent-track-preserve"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
TrackRecorder.nativeSetEnabled() calls ConnectToGpsTracker()
which calls m_drapeEngine->ClearGpsTrackPoints().
only if location can't be accured in 30 seconds.
Closes #9146
Thanks!
Should a toast/warning be displayed if startTrackRecording failed to start? How is it handled now?
The current implementation is clunky:
Instead of
this may look clearer:
The current body of
startTrackRecording()
checks permissions and battery optimization, and returns/fails silently if conditions are not satisfied. Either the failed return should be handled, or these checks should be done outside of the startTrackRecording() to ask user/let user know about these failure cases.@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
There is one issue
If user do not turns off battery saver or turns it on later and clears the app from recent apps then restarts the app again then startTrackRecording(false) will be called which will return false because battery saver is on and then this condition will turn off the native part and then restart it again which will remove all the tracks.
same situation happens if we rotate the map.
Steps to regenerate -
1 - Turn on battery saver
2 - Now turn on Recent Track feature and do not turn off the battery saver (just click not now)
3 - Close the app and clear it from recent apps or simply rotate your phone to landscape orientation
4 - The tracks will get cleaned in both the cases since native will be disabled and re enabled again.
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
What do you think about making battery saver dialog non-blocking? It will make the logic significantly simpler..
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
I thought about it twice - we have a red alert in the notification bar if the location doesn't work. I think that it will be fine to show to start the recording and then show the dialog about power saving in non-blocking mode.
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
With a red alert the dialog may not be necessary at all (if alert properly explains the issue and maybe even opens the battery/app system settings?)
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
But that notification may become red due to many reasons other than
battery saver issue such as if location fix is not there because user entered in tunnel or indoor (temporarily).
If suppose battery saver is turned off and still notification became red due to some location errors.
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
Can notification properly handle different cases? Then it would perfectly solve these issues.
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
Yess, notification will switch to red as soon as location updates to track recorder will be blocked for 30 seconds.
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
Yess, that will also solve the issue of track deletion.
I have just one more concern, since there are two non blocking dialogs simultaneously one after other (post notifications and battery saver). Wouldn't they interfere each other? Like killing the first dialog and showing second one without even taking user input?
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
@kavikhalique , I have reworked the PR. PTAL.
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
In this particular place, please call TrackRecorder.saveTrack() after rebasing on the new API.
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
@kavikhalique do you see any issues with a test case you described?
@ -284,3 +276,4 @@
}
processIntent();
migrateOAuthCredentials();
No, it works properly now. I am trying to cover all the cases where it could fail then i will test it too. Will provide feedback in some time.
Here is one issue. Since both are non blocking notifications both are called simultaneously due to which the battery saver permission do not stays and gets removed by post notification permission request. I have tested it in android 14 device.
Steps to regenerate
1- Use android 13 or above phone
2- Remove notification permission for OM and also turn on battery saver
3- Start the trace path feature in OM.
4- for a second dialog to disable power saver will appear and then it will be removed and post notification permission dialog will appear.
Another not much important concern is about asking post notification permission again and again on every start of track recorder. Since the UX logic for battery saver is to ask only once then it would be better to design this in same manner as well. Although android do not let the app ask post notification permission again and again if once it has been denied by user but i am proposing it for OM's UX : )
Confirmed. I think that the right solution would be implementing a stateful step-by-step wizard to request all prerequisites: 1. Fine location 2. POST_NOTIFICATION 3. Battery saver off, both for the track recording and navigation. This is a complex topic that would be better addressed separately. I will file a ticket. I am searching for a workaround to move forward here.
@kavikhalique , PR has been reworked to show the dialog on 30 second timeout.
@kavikhalique , I've moved the timeout handling logic out of TrackRecordingService into LocationHelper to re-use from MwmActivity.
@kavikhalique , the dialog is now only shown in case if location timed out.
Re-used [current_location_unknown_error_title]
tags = android,ios
en = Current location is unknown.
This idea seems good to me but do location updates stop when app runs in foreground? As you mentioned earlier location updates stops only when app goes in background. If that is the case then dialog will never be shown.
This removal will arise a case in which runnable will be removed from empty handler.
steps
1 - on start runnable will be added in handler
2 - if location update stops it will trigger notifyLocationUpdateTimeout() which will remove runnable.
3 - Now again location gets fixed and it updates then runnable will be removed which do not exists in handler.
in case 3 notifyLocationChanged() re-adds the handler
I enabled "For the most accurate navigation, we recommend disabling power saving mode in phone's battery settings" dialog only for the new track recorder to avoid potential regressions in navigation and other places. Let's pilot it in the track recorder and enable globally for the next release.
CC: @kavikhalique