[android] Simplify location code #2087
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
3 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#2087
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "rt-android-location-refactor"
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?
Signed-off-by: Roman Tsisyk roman@tsisyk.com
Notes for reviewers
Please take a look at BaseLocationProvider.java, AndroidNativeLocationProvider.java and GoogleFusedLocationProvider.java top to bottom.
Надо тестить, включая fdroid сборку.
Коряво.
Приятнее, когда в конце предложений стоят точки.
Нам критически важно видеть в логах, какие есть провайдеры.
@ -14,3 +12,1 @@
private boolean mActive;
@NonNull
LocationFixChecker getLocationFixChecker()
static protected final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.LOCATION);
nit: You can leave static logger instance in Base class.
nit: Rename getDiff with LocationUtils.getTimeDiff, because it also may be getLengthDiff, getSpeedDiff ...
@ -101,0 +132,4 @@
return newLocation.getAccuracy() < lastAccuracy;
}
You added this function as a replacement of LocationFixChecker, but where is it called from?
You added this function as a replacement of LocationFixChecker, but where is it called from?
В логах пишет
Request Android native provider 'xxx' to get locations at this interval = 5000 ms
для каждого активного провайдера.organicmaps/organicmaps#2087/files
Это общая проблема паттерна с static enum. По этой же методологии сделаны почти все 10 с чем то хелперов. Можем попробовать отдельно переделать их все, но патч будет очень большой.
@ -101,0 +132,4 @@
return newLocation.getAccuracy() < lastAccuracy;
}
Not a replacement, just moved the same code from LocaitonFixChecker to LocationUtils. Both
isAccuracySatisfied
andisLocationBetterThanLast
functions are called fromLocationHelper.onLocationChanged()
.organicmaps/organicmaps#2087/files
Нам нужен список всех доступных на устройстве провайдеров. Он сейчас печатается, если отправлять логи из аппы?
Please see a comment regarding isAccuracySatisfied() above.
@ -14,3 +12,1 @@
private boolean mActive;
@NonNull
LocationFixChecker getLocationFixChecker()
static protected final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.LOCATION);
Done.
Done.
Мы подписываемся на все доступные.
nit: По моему этот startInternal() лог obsolete. Или добавить важное вниз, после if (!PermissionsUtils.isLocationGranted(mContext)), в лог mLogger.i(TAG, "start(): interval = " + mInterval);
@ -101,0 +132,4 @@
return newLocation.getAccuracy() < lastAccuracy;
}
Ok, увидел.
Объединил с логгированием визу.
В заголовке логов, как раньше, пишется список всех доступных на устройстве провайдеров?