[android] Add Android Auto support #3806
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
3 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#3806
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "android-auto/init"
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?
Decided to try myself in Android Auto.
I checked
android_auto
branch and want to thank @shankarpriyank for the work. I had a good hint at start 😀What was done:
car
product flavorI know about the
minSdkVersion
restriction for Android Auto. That is why I think separate flavor is a good solution. There will be no problems during releases as no code and resources will be added to the release apk. It could be easily merged to themaster
branch and this would be a good place to start for a lot of people who wanted to contribute for android auto (I saw many messages in related issues).I also found that there is a possibility (at least at play store) for publishing separate apks for different APIs. So, I think there will be no problems in future to publish apk for API 21 without Android Auto and apk for API 23+ with Android Auto.
car
related code and resources are located inandroid/flavors/car
. As I said before, there will be no impact on release builds and almost no impact on current code base.app/organicmaps/MapFragment.java
I moved all common logic for mobile and car into a separate
Map.java
class and also renamedMapFragment.cpp
intoMap.cpp
I see two main parts you may want to discuss:
build.gradle
- new flavor "approach"MapFragment.java
- refactoringMain things that should be done next (or not working now) (in this PR on in separate ones):
onFling
eventAnd here is the video with the demonstration:
https://user-images.githubusercontent.com/10351358/199609542-514e0ce5-a8ae-45f2-a806-780bb79ff903.mp4
See #679
#2994
Дзякуй за дапамогу! Great!
Let's discuss it on a higher level first:
The driver must not be distracted
. There is also guidance for car apps: linkHi @AndrewShkrob , thanks for reviving this project. @shankarpriyank did research on how to render map in auto, but we didn't have enough time to start working on UI.
I don't believe that that separate APK will fly, because we upload bundles (.aab) to Google Play, not APKs. Probably we can try to upload two different bundles for < 23 and 23+, but nobody checked this approached.
@biodranik, please don't overcomplicate things. Yes, it is technically possible in theory. Duplicating in OpenGL/Vulkan should be relatively easy, but the primary challenge on this road will be different screen sizes/resolutions in Auto and on the device. Basically, it will require the full duplication of rendering logic. As far as I can see, entire Google Inc. and Yandex were unable to implement this feature in their Android Auto implementations so far. Let's get Auto screen working first with disabled rendering in the main app.
Yes, they provide a template we need to follow.
Correct. This is just some kind of "screen mirroring" on steroids.
Folks, Automotive OS != Android Auto. They are two completely orthogonal things. Automotive OS is a full-featured Android flavor that can be flashed as firmware to cars. No real cars available on the market as far as I know. Android Auto is a just simplest screen-sharing like technology to share information from mobile phone to existing entertainment systems, like Car Play does.
@AndrewShkrob, you need Android Auto Headless Unit, not Automotive Emulator. Android Headless Unit is a separate binary that emulates the protocol of Android Auto. Please install version 2.0 which is only available in Android Studio Beta. Just install Studio Beta, install Android Auto Headless Unit 2.0 from SDK Tools menu and then drop Studio Beta and switch bank use regular stable Android Studio version. The binary will be installed to
~/Library/Android/sdk//extras/google/auto/desktop-head-unit
. M1/Arm is natively supported.I summon @shankarpriyank to the thread.
I recommend pushing all preliminary refactorings that don't hurt the main app into master iteratively via separate PRs without accumulating on the branch. Android Auto part I will review and provide feedback. API 21-23 we need to find a solution.
Seems that you didn't get my point.
I already implemented AA support and yes, I used Android Auto Headless Unit. But the question was about Automotive. There are already some emulators: Volvo XC 40, Polestar 2, and maybe Google's default one but they all support only x86 platform. I believe that it is quite easy to implement at least the same functionality I did at this PR because AA and AAOS use the same API with some differences like
CarAppActivity
for AAOS.If this is possible, I guess it would be the best way to ship this feature. Apart from all the other approaches discussed, I think we can also ship this feature using Dynamic Delivery, in that way the minSdk of the app will be 21, until the user wants to use Android Auto, and then it's minSdk will be bumped to 23.
@rtsisyk and I spent quite some time, trying to avoid this, we did not completely achieve it, I remember there was just one more corner case to look into. What I see here is that if we don't allow the app to open on mobile phone while AA is active, there will be a need to add a lot more ux for routing and other stuff in the AA module, which again might take quite some effort.
But if we allow the app to be open, and just play around with by turning the rendering on/off and by providing a placeholder in the mobile while rendering is turned off, we can take advantage of the many other features like favorites and routing etc.
Once AA is completely done, I also believe that supporting Automotive OS, won't be much of a hassle. If we have a look at this, it seems that we can almost completely reuse the code written for AA in Automotive OS.
There is a chance that it's possible: StackOverflow.
@AndrewShkrob Regarding M1 Android Auto support, I think it should work with Android Studio Canary release: https://github.com/google/android-emulator-m1-preview/issues/74#issuecomment-1252583987
So, Organic Maps works on AAOS 😄
Basically no, it crashes. Some rendering problems.
(Oh no, it's my fail. On master branch it works perfectly)
Fixed. Now it also works in this PR.
Update
I investigated Dynamic Feature Delivery mecanism and that's exactly what do we need. Even in AAOS docs it is used as an example. https://developer.android.com/guide/playcore/feature-delivery
AA and AAOS features will be stored in separate modules with different minSdk versions (23 for AA and 29 for AAOS). These modules can be easily added to .aar and depending on android version on mobile phone user will get just common application or the one with AA support
But I don't know if this feature works with other stores.
And this feature may require project structure refactoring. To move all base functionality into a separate module. Because it's not possible to include whole android project as a dependency for an internal module. Or to use some hacks to do this
Let's proceed first with independent refactorings in the master branch. Then we can decide if dropping API 21 and 22 is a better option. Dynamic feature delivery can be complex to implement and support, we need to carefully evaluate it first. And it won't work in other stores. Using a version without AA is not a good idea.
@biodranik Do you have statistics how many OM users are under API 21-22?
Google Play shows ~2.5k, but there are also Huawei and Fdroid stores.
If OM stops supporting API 21-22, will current users with these versions be able to download maps (at least old)?
We can keep one old version of maps for some time on some of our servers.
I will check if is it possible to split API21-22 into a separate bundle on Google Play.
organicmaps/organicmaps#3886
Google told me that two separate bundles with different APIs are not possible. We will have to drop API21-22 if we want Auto.
@rtsisyk

I updated PR and also added a location point. It's not working correctly because it requires LocationHelper refactoring.
@AndrewShkrob what kind of LocationHelper refactoring is needed for AA?
@biodranik
For example, refactoring of
UiCallback
interfaceThere is
AppCompatActivity requireActivity();
method.But there are no activities in Android Auto, so it's not possible to implement this callback now
We should also move all UI-related code from the
LocationHelper
class as it will have different implementations for AA and AndroidExample:
I guess such refactoring will be needed for all Helpers that will be used both on Android and AA.
Thanks for the details. LocationHelper definitely should be refactored. Not only keeping AA in mind but also the track recorder, the ability to get a location in the background service while the app is not active at all.
Let's discuss and properly design that refactoring to take all these scenarios into an account.
CC @rtsisyk
Activity
is need to display permission dialogs. NoActivity
- no dialogs will be displayed. I don't think that we want to display these dialogs on the car screen.Let me check how to make Activity optional there. It should be possible.
@AndrewShkrob , please try #3944. It has some bugs, but I will try to fix them.
I don't think it's a good idea to spend time on it now. A lot of things in the current AA code not working properly and fixing all of them will require much more time and much more lines of code. Let's finish with this PR first for other people who wanted to contribute to AA support can start.
@rtsisyk, PTAL
@AndrewShkrob what's the goal with this PR now? We can't merge it until AA will be ready for production release. It should be gradually improved while separating and merging as many non-breaking changes into the master branch as possible.
@biodranik
This is an initial commit for AA branch.
Personally, I don't like the idea of a separate branch due to a lot of common changes required to merge both in master and AA branches.
I see only two approaches and both of them are not really convenient:
That's why I created #3892. It will be much easier to create just a build flag that will enable AA during development and disable it during release builds. All changes will be in master, so no conflicts and no redundant PRs in future
I think you misunderstood me. Let's sync again. The idea is to keep a clean AA branch as if we already dropped API 21-22 (so the first commit on that branch should be Increase min API to 23, and it should have a proper cleanup of all unnecessary API 21-22 remaining).
Then there are other commits containing all necessary changes for AA. If it is possible to merge some of them into the master branch without breaking it, to reduce the list of changes on the AA branch, then it's great. It will simplify the review and branch maintenance until AA will be finished. After merging some AA code into the master, you rebase your AA branch on top of the fresh master. Well, you always rebase it on top of the fresh master and keep it up-to-date, to avoid merge conflicts and simplify support.
Do you think this approach is worse than your proposal? What are the pros and cons?
You already described the problem of a separate branch in this case 😄
Ok, I understand. Let's say I agree with you. What's the problem with making this PR an initial commit? The idea of keeping the AA branch clean of old API? That's weird. The cleanup part can be done later. Even right before the merge to the master. I think it's a waste of time for now.
So, why not create a branch from this PR?
Ok, we can postpone the cleanup.
I've created aa branch, if you want to start with it.
Added some screens. Maybe it's too much for a single PR but at least there is something to discuss 😄
Main
Settings
Settings. Main
Changed font size:

Settings. Driving Options
Settings. Help
Search with history
Categories
Bookmarks
Bookmarks. Bookmark Categories
Bookmarks. Bookmark
A new version of LocationHelper has been merged into master.
@rtsisyk Could you make a review?
Great work! I really appreciate it. Thank you for adding bookmarks and categories screens. I can see that all new screens are relatively easy to add, but they still require more time and efforts to get fully working.
My proposal here is to focus on very simple use-case: User searches destination point on a phone, clicks "Route To", navigation starts on Auto. This approach can get us to a working production version faster.
Please kindly rebase this PR on the top of the latest master:
There is no need to add
Squashed commit
at all. Just rebase. The current PR is confusing because it contains changes from PRs and it is really hard to review, especially via GitHub UI.Does Android Auto work without Google Play Services? This GMS-specific section probably should be in
gms-enabled
flavor:e9056f11fb/android/flavors/gms-enabled/AndroidManifest.xml (L4)
Could you please provide any details? I haven't seen this problem on master.
Could you please explain how these magic constants were obtained? It looks mysterious.
What are potential security implications here?
We can follow the same logic as for myPosition button?
e9056f11fb/android/src/app/organicmaps/MwmActivity.java (L650-L654)
LocationHelper works without Activity, but will not display error dialogs and permission resolution screens. This operation should be performed on the phone.
@ -0,0 +33,4 @@
public Screen onCreateScreen(@NonNull Intent intent)
{
Log.d(TAG, "onCreateScreen()");
if (mInitFailed)
Do you plan to show any error messages on car screen in the future?
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
I thought that MwmApplication should be already initialized by SplashScreen. Why do we need to initialize it second time? Please help me to understand the lifecycle.
I didn't get idea of this abstraction. Is it needed at all? Maybe I don't see the full picture here.
@ -0,0 +41,4 @@
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
Log.d(TAG, "Surface available " + surfaceContainer);
mMap.onSurfaceCreated(
Could you please explain how both mobile and car work at the same time? On my phone I still see the map, but with different DPI. I don't really understand how is it possible.
e9056f11fb/android/src/app/organicmaps/Map.java (L120-L123)
I suggest merging this code back to
SettingsScreen.java
. It is not needed anywhere outsideSettingsScreen.java
.It looks like a hack. Why this invalidation is needed in this place?
nit: save the service in a temporary variable, just to improve readability of the code.
@ -0,0 +89,4 @@
}
@NonNull
private ItemList createBookmarksList()
I have this screen working, but taping on a bookmark button does nothing. Is it just not finished yet? I don't see where buttons are connected to any callbacks.
Let's merge this refactoring into master via a separate PR.
Let's merge this refactoring into master via a separate PR.
Я взял эти строчки из файла библиотеки.
В примерах он подключается напрямую, но Android Studio показывает warning
Поэтому решил сделать так
Ссылка на пример
Эта ошибка появляется после подключения
androidx.car.app:app:1.3.0-beta01
Хорошего решения я не нагуглил, только такое
Пока предлагаю оставить так
Проблема скорее всего в самой библиотеке для AA, но она еще в бете и к тому моменту, как мы закончим эту фичу может успеть обновиться до релизной версии, и, возможно, проблему исправят
Более раннюю версию
androidx.car.app:app:1.3.0-beta01
, мне кажется, лучше не использовать, потому что:1.3.0-alpha01
Пока писал этот коммент, заметил, что вчера вышла
1.3.0-rc01
. Надо обновить PR, может и проблема уйдет 😄Код из примера. Объяснений, для чего это сделано, нигде не нашел
Ссылка на пример
У нас принято разбираться и писать только тот код, который мы чётко понимаем, для чего и зачем он нужен. И стараемся, чтобы было понятно другим, кто читает код, в т.ч. оставляя комментарии.
Тут очень интересно :)
NavigationScreen
создаетMapTemplate
, чтобы отображать карту и данные.Допустим, мы нажимаем на
Категории
, у нас открываетсяCategoriesScreen
, который тоже создаетMapTemplate
, чтобы отображать карту и данные. Проблема в том, что на новом экране не обрабатываются события в SurfaceRenderer. Они просто не приходят к нему.В документации о таком не написано, в интернете я тоже не нашел решения этой проблемы. Я даже не нашел упоминания этой проблемы. возможно все думают, что так и должно быть.
Даже в GoogleMaps при изменении экрана (например в поиске что-нибудь набрать и перейти на экран выбора маршрута) не двигается карта(хотя я сомневаюсь, что они вообще использовали свою библиотеку, потому что слишком сильно нарушают свои же ограничения по UI. С их библиотекой такой UI сделать просто невозможно).
Я запустил их пример, чтобы проверить, все ли я правильно делаю. Там тоже не работает.
Ссылка на пример
Либо это у меня такой редкий кейс связки телефона и компьютера.
2 ГИС вообще не поддерживает
onScroll
.Во всем виноват Action Strip

Изначально для каждого нового экрана я создавал новый новый Action Strip. Так не работало.
Если передавать один и тот же объект ActionStrip для всех экранов с картой, то на всех экранах в SurfaceRenderer будут приходить события.
Для этого и была сделана такая абстракция в виде
OmController
иMapScreen
Не знаю, баг это или фича... Возможно в
1.3.0-rc01
это пофиксили. Надо проверить.Да, но
createSharedPrefsCheckbox
, как иcreateDrivingOptionCheckbox
использует иконки чекбоксов. Не хочется каждый раз заново инициализировать иконки. Перемещение их вSettingsScreen
приведет к тому, что они будут заново инициализироваться при создании экрана. Плюс есть ещеDrivingOptionsScreen
, который использует эти же иконки. Надо придумать, где и как их хранить. Это относится не только к чекбоксам, но и к остальным иконкам на других экранах. Пока что решение такое.@ -0,0 +33,4 @@
public Screen onCreateScreen(@NonNull Intent intent)
{
Log.d(TAG, "onCreateScreen()");
if (mInitFailed)
Да. Надо поработать над
ErrorScreen
. Возможно вообще сделать какой-то общий экран для отображения всех сообщений. Например, ошибка инициализации (как здесь), запрос permisiions и т.д.@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Нет.
SplashScreen
вообще не будет запускаться.У нас есть заблокированный телефон, на котором карты не открыты. Мы его подключаем к AA. Запустится
NavigationSession
, в котором и будет вызванinit
.Вариант, когда карты открыты одновременно и на телефоне, и на AA невозможен.
По-хорошему да, тут должна быть реализована сложная логика:
Но это все тема для отдельного PR
Я пробовал, работает так же, как и моя предыдущая реализация еще до этих изменений в
LocationHelper
Просто тремя строчками тут не обойтись
Из тех проблем, что я вижу сейчас:
onScale
. Всегда скейлится относительно местоположения, а не точки на экранеЯ считаю, это лучше сделать в отдельном PR
Нельзя изменить иконку на созданном объекте:
setIcon(...)
нет.Видимо, такая концепция AA. Приходится перерисовывать весь экран.
Да. По-хорошему, как и иконки в
UiHelper
, надо где-то отдельно хранить, потому что будет часто и много где использоваться.PS. Обидно вообще-то 😄
@ -0,0 +89,4 @@
}
@NonNull
private ItemList createBookmarksList()
Пока я реализовал только отображение. Как и поиск. Полную поддержку можно будет сделать после либо с базовой навигацией. Это нужен отдельный PR.
Не знаю. Скорее всего нет. Надо проверить на телефоне без Google Play сервисов. Но у меня такого нет.
@ -0,0 +41,4 @@
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
Log.d(TAG, "Surface available " + surfaceContainer);
mMap.onSurfaceCreated(
Никак. Мы это обсуждали еще в первых сообщениях этого PR.
Поддержки одновременной работы на телефоне и на AA не будет.
Подробнее здесь organicmaps/organicmaps#3806
@rtsisyk, Я думаю, это будет довольно сложно реализовать. Нельзя одновременно рисовать карты и на телефоне и не AA. organicmaps/organicmaps#3806
В
1.3.0-rc01
не исправили.Сейчас проверил на
1.3.0-rc01
и на1.3.0-beta01
. Не воспроизводится.Возможно, дело было в чем-то другом и я уже не помню.
Хотя в примере от Google проблема все еще есть.
В любом случае, предлагаю пока не убирать это, т.к. это все равно должно быть оптимальнее чем на каждом экране пересоздавать ActionStrip.
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Там ещё есть ограничение, насколько часто можно перерисовывать экран.
https://onetwobytes.wordpress.com/2021/11/09/nit-code-review/
@ -0,0 +41,4 @@
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
Log.d(TAG, "Surface available " + surfaceContainer);
mMap.onSurfaceCreated(
Нужен удобный UX. Вариант, когда например нужно выбрать сначала маршрут на телефоне, и только потом заработает карта навигатора AA, тоже можно рассмотреть. А вообще, лучше сделать невозможное. По возможности.
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Откуда будет 10К строк кода? Мы обсуждали ранее — всё, что можно втянуть в мастер, не ломая его, надо втягивать в мастер, и ребейзить ветку поверх. Не должно быть никаких squash коммитов с мастера, они мешают.
Перерисовывать один и тот же экран можно неограниченное количество раз
https://developer.android.com/static/training/cars/Android%20for%20Cars%20App%20Library%20design%20guidelines.pdf
Слайд 11
Ну и конкретно для MapTemplate:
https://developer.android.com/reference/androidx/car/app/navigation/model/MapTemplate
Interesting. I've rebased aa branch, but the PR is not updated and still have 3 commits from the master.
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Я прикинул и у меня получилось +/- 10к на весь модуль AA. Если будет меньше, супер.
Я просто сделал пару экранов для настроек и экраны поиска, категорий и закладок без всякой логики, только отрисовка. Уже PR на 1к строк. И это только начало.
Я предполагал, что мы будем делать небольшие PR'ы в ветку
aa
, и когда фича будет закончена, вмержим ее в мастер. Если это не так, то тогда я не понимаю, зачем нужна отдельная веткаВот такое объяснение в документации.
А нельзя их временно disable? https://www.imobie.com/support/uninstall-google-play-services.htm
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Всё верно. Но каждый PR должен быть достаточно законченным и доделанным, без временных костылей.
organicmaps/organicmaps#4061
organicmaps/organicmaps#4061
Что-то я все никак не могу эту ветку с мастером подружить 😞
AA без Google Play Services не работает.
Но тут есть нюанс. Я все это время собирал проект на fdroid. Т.е. сервисы отключены, но на телефоне-то они есть. И все работало.
Что если человек скачал приложение через fdroid, но на телефоне у него есть гугл сервисы? Он не сможет использовать AA?
@AndrewShkrob так, надо сделать так:
После этого дадим write права на репо
Да, слегка неудобно, но позволит двигаться итеративно, не ломая мастер. Ну и накидывать по ходу как можно больше общих изменений в мастер.
Почему тут не полный путь?
А как ведёт себя FDroid версия OSMand? В ней AA работает?
androidx.concurrent:concurrent-futures:1.1.0 не помогает? Надо найти способ не тащить guava.
Лишняя строка
Зачем этот флаг? Можно ли без него?
Разве ActionStrip тяжёлый класс? Держать глобальный ненужный стейт не очень хорошо.
Отдельный вопрос: а можно ли делать АА без либы гугла?
Скобки для однострочников не используем.
По возможности везде используем final, легче тогда читать код.
@ -0,0 +52,4 @@
@Override
public void onVisibleAreaChanged(@NonNull Rect visibleArea)
{
Log.d(TAG, "Visible area changed. stableArea: " + mStableArea + " visibleArea:" + visibleArea);
У нас кажется уже были логи без тэгов?
@ -0,0 +77,4 @@
mCarContext.getCarService(AppManager.class).setSurfaceCallback(this);
// TODO: Properly process deep links from other apps on AA.
boolean launchByDeepLink = false;
// TODO: Properly process deep links from other apps on AA.
АА вообще позволяет из одних приложений открывать другие? Что будет, если потыкать линки на нашей тестовой странице https://omaps.app/api ?
Если getter.get() используется больше одного раза, имеет смысл вынести его в
final boolean
ditto
ditto
ditto
@ -0,0 +17,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
Почему бы здесь сразу и не инициализировать?
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
А зачем их хранить?
@ -0,0 +67,4 @@
private Item createDataVersionInfo()
{
return new Row.Builder()
.setTitle(getCarContext().getString(R.string.data_version, ""))
Заголовок пустой?
@ -0,0 +17,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
Нужен
Context
.@ -0,0 +67,4 @@
private Item createDataVersionInfo()
{
return new Row.Builder()
.setTitle(getCarContext().getString(R.string.data_version, ""))
Нет.

В
R.string.data_version
лежит<string name="data_version">OpenStreetMap data: %s</string>
.Вместо
%s
подставляется пустая строка.На экране:
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
Там будут храниться результаты поискового запроса
Логика:
mResults
mResults
@ -0,0 +77,4 @@
mCarContext.getCarService(AppManager.class).setSurfaceCallback(this);
// TODO: Properly process deep links from other apps on AA.
boolean launchByDeepLink = false;
Позволяет:
Касаемо https://omaps.app/api
В AA браузера нет, поэтому с такими ссылками это работать не будет. Можно через телефон их открывать и переадресовывать в AA, но это уже другая история.
Поправил.
В
application
иreceiver
у нас тоже не полный путь:В будущем, думаю, можно. Сейчас сделал так.
Если очень не нравится, могу удалить эту часть с сообщением об ошибке +
ErrorScreen
.Но временные костыли в любом случае неизбежны.
@ -0,0 +52,4 @@
@Override
public void onVisibleAreaChanged(@NonNull Rect visibleArea)
{
Log.d(TAG, "Visible area changed. stableArea: " + mStableArea + " visibleArea:" + visibleArea);
Не понял комментария.
Касаемо логов в
onVisibleAreaChanged
иonStableAreaChanged
:Это сделано на будущее. Эти изменения придется учитывать, например двигать центр карты в центр visibleArea и т.п. Со всем этим еще надо разбираться. Потом логи можно будет удалить.
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
А проще передать данные прямо в отрисовку никак нельзя?
Так, стоп. Неполные пути повлияют на app.organicmaps.beta и app.organicmaps.debug ?
Ок. Перенес это в
SettingsScreen
иDrivingOptionsScreen
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
Нет. В AA нельзя обновлять данные на экране. Только через перерисовку всего экрана
Удалил этот класс. Сделал так, чтобы ActionStrip на каждом экране создавался новый. Разницы в скорости не заметил. Так даже лучше. В будущем не будет проблем с обновлением иконки на кнопке location.
Не помогает
Все не так. Почитал я, как работает HostValidator класс.
android.car.permission.TEMPLATE_RENDERER
Поэтому я заменил
R.array.car_hosts
наandroidx.car.app.R.array.hosts_allowlist_sample
. Думаю, смысла держать свой список разрешенных хостов нет, а на warning можно закрыть глаза.Warning:
Так что именно в этом файле-то? )
В
androidx.car.app.R.array.hosts_allowlist_sample
?Массив таких строк:
fdb00c43dbde8b51cb312aa81d3b5fa17713adb94b28f598d77f8eb89daceedf,com.google.android.projection.gearhead
Первая часть - цифровая подпись, вторая - имя пакета
Только сейчас обратил внимание на это:
Но я не смог найти никакого общего списка хостов или хотя бы какого-то упоминания о том, что люди добавляли в этот список еще что-то. Поэтому, наверное, можно на это не обращать внимания. По крайней мере пока что.
Тут если что подразумевается API хоста, а не телефона
@biodranik @rtsisyk Будут ли еще какие-то комментарии? С этим PR'ом пора заканчивать, потому что он превращается в ад. 130 сообщений это слишком. Тут потеряться можно :)
@rtsisyk посмотри ещё раз, пожалуйста, и можно сквошнуть в aa ветку. Дальше будем двигаться по выше озвученному плану.
@rtsisyk
Там не важно кто как себя где ведет, важно что прилаги Android Auto в стандартном Android нет и в F-Droid её тоже нет. У меня не хватило сил установить эту прилагу как-то иначе извне. Без этой прилаги Auto не работает.
Конкретно в этом патче мы не добавляем никакие новые проприетарные библиотеки, а, значит, код можно включать во все сборки, включая F-Droid, даже если он там работать по факту не будет.
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Здесь всё обсудили в целом уже. F-Droid я посмотрю сам.
@ -0,0 +41,4 @@
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
Log.d(TAG, "Surface available " + surfaceContainer);
mMap.onSurfaceCreated(
Обсудили это в чате.
Я попробую разобраться можно ли поднять Android Auto на CalyxOS. Пока это не блокирует ничего.
Ладно давайте добавим это в TODO лист и посмотрим позже.
@ -0,0 +17,4 @@
import app.organicmaps.Map;
import app.organicmaps.R;
public class SurfaceRenderer implements DefaultLifecycleObserver, SurfaceCallback
У меня при хаотичных нажатиях на +/- крешится вот в этом месте:
c9b77a292d/drape_frontend/screen_operations.cpp (L128)
@ -0,0 +18,4 @@
import app.organicmaps.R;
public class SurfaceRenderer implements DefaultLifecycleObserver, SurfaceCallback
{
Еще один креш при +/-:
c9b77a292d/drape_frontend/screen_operations.cpp (L124)
@ -0,0 +52,4 @@
@Override
public void onVisibleAreaChanged(@NonNull Rect visibleArea)
{
Log.d(TAG, "Visible area changed. stableArea: " + mStableArea + " visibleArea:" + visibleArea);
Логов без TAG у нас нет. Но сейчас лучше использовать
Logger.d(TAG,
изimport app.organicmaps.util.log.Logger;
.@ -0,0 +77,4 @@
mCarContext.getCarService(AppManager.class).setSurfaceCallback(this);
// TODO: Properly process deep links from other apps on AA.
boolean launchByDeepLink = false;
Давайте пока без deeplink здесь обойдемся. Комментарий пусть висит.
@ -0,0 +126,4 @@
public void onZoomIn()
{
Map.zoomIn();
У меня по клику на +/- карта двигается вверх/вниз вместо zoom in / zoom out.
@ -0,0 +89,4 @@
}
@NonNull
private ItemList createBookmarksList()
OK
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
Окей, проблема понятна.
Принципиальных возражений нет.
@biodranik мержим?
@AndrewShkrob ok, только слишком много тут замечаний/косяков, надо обязательно их все оттрекать и не забыть исправить. Фиксы в продакшне обойдутся нам гораздо дороже.