[android] Add Android Auto support #3806

Merged
root merged 6 commits from android-auto/init into aa 2022-12-22 11:53:07 +00:00
Member

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:

  • Created separate car product flavor
    I 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 the master 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.
  • All car related code and resources are located in android/flavors/car. As I said before, there will be no impact on release builds and almost no impact on current code base.
  • Refactored app/organicmaps/MapFragment.java
    I moved all common logic for mobile and car into a separate Map.java class and also renamed MapFragment.cpp into Map.cpp
  • I saw comments that there are some problems with Vulkan on Auto but for now it looks ok, I didn't change it to OpenGL.
  • Created base navigation interface and some buttons for auto

I see two main parts you may want to discuss:

  • build.gradle - new flavor "approach"
  • MapFragment.java - refactoring

Main things that should be done next (or not working now) (in this PR on in separate ones):

  • Update GitHub Actions config as product flavor names changed
  • To prohibit opening application on mobile phone when it is run on Android Auto (like in Google Maps)
  • You may see on the video when moving map it sometimes scales. It should be fixed, but I don't know how to do it yet.
  • To add current position on the map. I also don't know how it works yet
  • Implement UI onFling event
  • ...
  • That's all for now but I may add something more later

And here is the video with the demonstration:
https://user-images.githubusercontent.com/10351358/199609542-514e0ce5-a8ae-45f2-a806-780bb79ff903.mp4

See #679

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: * Created separate `car` product flavor I 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 the `master` 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. * All `car` related code and resources are located in `android/flavors/car`. As I said before, there will be no impact on release builds and almost no impact on current code base. * Refactored `app/organicmaps/MapFragment.java` I moved all common logic for mobile and car into a separate `Map.java` class and also renamed `MapFragment.cpp` into `Map.cpp` * I saw comments that there are some problems with Vulkan on Auto but for now it looks ok, I didn't change it to OpenGL. * Created base navigation interface and some buttons for auto I see two main parts you may want to discuss: * `build.gradle` - new flavor "approach" * `MapFragment.java` - refactoring Main things that should be done next (or not working now) (in this PR on in separate ones): * Update GitHub Actions config as product flavor names changed * To prohibit opening application on mobile phone when it is run on Android Auto (like in Google Maps) * You may see on the video when moving map it sometimes scales. It should be fixed, but I don't know how to do it yet. * To add current position on the map. I also don't know how it works yet * Implement UI `onFling` event * ... * That's all for now but I may add something more later And here is the video with the demonstration: https://user-images.githubusercontent.com/10351358/199609542-514e0ce5-a8ae-45f2-a806-780bb79ff903.mp4 See #679
Jean-BaptisteC commented 2022-11-02 22:20:11 +00:00 (Migrated from github.com)
#2994
biodranik commented 2022-11-02 22:22:24 +00:00 (Migrated from github.com)

Дзякуй за дапамогу! Great!

Let's discuss it on a higher level first:

  1. Can you please share a link on how to publish apks with different min APIs on Google Play (and maybe on other stores too)?
  2. How hard is it to check the API level dynamically, and use the same apk with min version 21 to actually work on older devices, and support Android Auto on newer ones? Is it feasible? Does it worth it?
  3. Storing car-related code separately is a good idea, at least for the active development stage. Distributing it may complicate things if we don't drop Android 5.0 and 5.1. So a weighted decision should take pros and cons for all approaches. Increasing min API to 23 when it will be production-ready looks like the easiest solution with less code and support complexity.
  4. Is it technically feasible/possible to have two Vulkan/OpenGL surfaces at the same time, so both AA and smartphone can be used at the same time? What are the issues and complexity there? Can two surfaces be supported in theory? Is it feasible to test and implement on Android (not by you, but for example by someone proficient with OpenGL/Vulkan)?
  5. What UX do you propose if two surfaces are not possible? Are there any ideas cooler than copying Google's behavior?
  6. Does it make sense to split map views for AA and smartphone into separate ones?
  7. Do all AA devices support Vulkan? Should OpenGL be considered there as a fallback?
  8. What is your estimation of how complex it would be to support Automotive OS in the future?
Дзякуй за дапамогу! Great! Let's discuss it on a higher level first: 1. Can you please share a link on how to publish apks with different min APIs on Google Play (and maybe on other stores too)? 2. How _hard_ is it to check the API level dynamically, and use the same apk with min version 21 to actually work on older devices, and support Android Auto on newer ones? Is it feasible? Does it worth it? 3. Storing car-related code separately is a good idea, at least for the active development stage. Distributing it may complicate things if we don't drop Android 5.0 and 5.1. So a weighted decision should take pros and cons for all approaches. Increasing min API to 23 when it will be production-ready looks like the easiest solution with less code and support complexity. 4. Is it technically feasible/possible to have two Vulkan/OpenGL surfaces at the same time, so both AA and smartphone can be used at the same time? What are the issues and complexity there? Can two surfaces be supported in theory? Is it feasible to test and implement on Android (not by you, but for example by someone proficient with OpenGL/Vulkan)? 5. What UX do you propose if two surfaces are not possible? Are there any ideas cooler than copying Google's behavior? 6. Does it make sense to split map views for AA and smartphone into separate ones? 7. Do all AA devices support Vulkan? Should OpenGL be considered there as a fallback? 8. What is your estimation of how complex it would be to support Automotive OS in the future?
Author
Member
  1. Link. Check API level section. Don't know about other stores. But I believe they should support same functionality.
  2. It's not possible. Android Auto uses libs that require minSdk 23.
  3. ...
  4. I think it's possible but it will be really hard to implement. I'm not a graphics engineer actually and not really proficient with it.
  5. There could be a simple UI that supports searching, bookmarks, displaying point info and so on. But theoretically it may not fit Google's restrictions for Android Auto applications The driver must not be distracted. There is also guidance for car apps: link
  6. I think there is no sense. Sometimes it may be useful f.e. when a passenger takes mobile phone and wants to find something on the map but it's a rare case and don't worth the time spent on implementation for this feature
  7. I may be wrong but I think that all calculations and rendering goes on mobile phone and image just transferred to the AA device.
  8. Quite easy I believe. I want to try it later, but I have to configure my windows laptop as there are only x86 Automotive Emulators and nothing for M1 MacBooks 😞
1. [Link](https://developer.android.com/google/play/publishing/multiple-apks). Check API level section. Don't know about other stores. But I believe they should support same functionality. 2. It's not possible. Android Auto uses libs that require minSdk 23. 3. ... 4. I think it's possible but it will be really hard to implement. I'm not a graphics engineer actually and not really proficient with it. 5. There could be a simple UI that supports searching, bookmarks, displaying point info and so on. But theoretically it may not fit Google's restrictions for Android Auto applications `The driver must not be distracted`. There is also guidance for car apps: [link](https://developer.android.com/static/training/cars/Android%20for%20Cars%20App%20Library%20design%20guidelines.pdf) 6. I think there is no sense. Sometimes it may be useful f.e. when a passenger takes mobile phone and wants to find something on the map but it's a rare case and don't worth the time spent on implementation for this feature 7. I may be wrong but I think that all calculations and rendering goes on mobile phone and image just transferred to the AA device. 8. Quite easy I believe. I want to try it later, but I have to configure my windows laptop as there are only x86 Automotive Emulators and nothing for M1 MacBooks 😞
Owner

Hi @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.

  1. Link. Check API level section. Don't know about other stores. But I believe they should support same functionality.
    2. It's not possible. Android Auto uses libs that require minSdk 23.

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.

  1. ...

  2. I think it's possible but it will be really hard to implement. I'm not a graphics engineer actually and not really proficient with it.

@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.

  1. There could be a simple UI that supports searching, bookmarks, displaying point info and so on. But theoretically it may not fit Google's restrictions for Android Auto applications The driver must not be distracted. There is also guidance for car apps: link

Yes, they provide a template we need to follow.

  1. I think there is no sense. Sometimes it may be useful f.e. when a passenger takes mobile phone and wants to find something on the map but it's a rare case and don't worth the time spent on implementation for this feature

  2. I may be wrong but I think that all calculations and rendering goes on mobile phone and image just transferred to the AA device.

Correct. This is just some kind of "screen mirroring" on steroids.

  1. Quite easy I believe. I want to try it later, but I have to configure my windows laptop as there are only x86 Automotive Emulators and nothing for M1 MacBooks 😞

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.

Hi @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. > 1. [Link](https://developer.android.com/google/play/publishing/multiple-apks). Check API level section. Don't know about other stores. But I believe they should support same functionality. > 2. It's not possible. Android Auto uses libs that require minSdk 23. 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. > 3. ... > > 4. I think it's possible but it will be really hard to implement. I'm not a graphics engineer actually and not really proficient with it. @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. > 5. There could be a simple UI that supports searching, bookmarks, displaying point info and so on. But theoretically it may not fit Google's restrictions for Android Auto applications `The driver must not be distracted`. There is also guidance for car apps: [link](https://developer.android.com/static/training/cars/Android%20for%20Cars%20App%20Library%20design%20guidelines.pdf) Yes, they provide a template we need to follow. > 6. I think there is no sense. Sometimes it may be useful f.e. when a passenger takes mobile phone and wants to find something on the map but it's a rare case and don't worth the time spent on implementation for this feature > > 7. I may be wrong but I think that all calculations and rendering goes on mobile phone and image just transferred to the AA device. Correct. This is just some kind of "screen mirroring" on steroids. > 8. Quite easy I believe. I want to try it later, but I have to configure my windows laptop as there are only x86 Automotive Emulators and nothing for M1 MacBooks 😞 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.
Owner

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.

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.
Author
Member

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.

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.

>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. 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.
shankarpriyank commented 2022-11-03 06:57:20 +00:00 (Migrated from github.com)

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.

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.

To prohibit opening application on mobile phone when it is run on Android Auto (like in Google Maps)

@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.

> 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. 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. > To prohibit opening application on mobile phone when it is run on Android Auto (like in Google Maps) @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.
shankarpriyank commented 2022-11-03 07:00:45 +00:00 (Migrated from github.com)

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.

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](https://github.com/android/car-samples), it seems that we can almost completely reuse the code written for AA in Automotive OS.
Author
Member

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.

There is a chance that it's possible: StackOverflow.

> 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. There is a chance that it's possible: [StackOverflow](https://stackoverflow.com/questions/70512093/is-it-possible-to-use-different-dependencies-for-different-api-levels-when-build).
biodranik commented 2022-11-03 10:41:51 +00:00 (Migrated from github.com)

@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

@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
Author
Member

So, Organic Maps works on AAOS 😄

image

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.

So, Organic Maps works on AAOS 😄 <img width="734" alt="image" src="https://user-images.githubusercontent.com/10351358/199704055-c15bb424-c4d7-4f6d-aba6-e181c5804c7d.png"> 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.
Author
Member

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

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
biodranik commented 2022-11-04 06:45:07 +00:00 (Migrated from github.com)

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.

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.
GreenAloe commented 2022-11-04 07:53:44 +00:00 (Migrated from github.com)

@biodranik Do you have statistics how many OM users are under API 21-22?

@biodranik Do you have statistics how many OM users are under API 21-22?
biodranik commented 2022-11-04 09:40:05 +00:00 (Migrated from github.com)

Google Play shows ~2.5k, but there are also Huawei and Fdroid stores.

Google Play shows ~2.5k, but there are also Huawei and Fdroid stores.
GreenAloe commented 2022-11-04 10:07:31 +00:00 (Migrated from github.com)

If OM stops supporting API 21-22, will current users with these versions be able to download maps (at least old)?

If OM stops supporting API 21-22, will current users with these versions be able to download maps (at least old)?
biodranik commented 2022-11-04 12:54:38 +00:00 (Migrated from github.com)

We can keep one old version of maps for some time on some of our servers.

We can keep one old version of maps for some time on some of our servers.
Owner

I will check if is it possible to split API21-22 into a separate bundle on Google Play.

organicmaps/organicmaps#3886

I will check if is it possible to split API21-22 into a separate bundle on Google Play. https://git.omaps.dev/organicmaps/organicmaps/issues/3886
Owner

I will check if is it possible to split API21-22 into a separate bundle on Google Play.

#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.

> I will check if is it possible to split API21-22 into a separate bundle on Google Play. > > #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.
Author
Member

@rtsisyk
I updated PR and also added a location point. It's not working correctly because it requires LocationHelper refactoring.
Screenshot 2022-11-21 at 19 46 12

@rtsisyk I updated PR and also added a location point. It's not working correctly because it requires LocationHelper refactoring. <img width="912" alt="Screenshot 2022-11-21 at 19 46 12" src="https://user-images.githubusercontent.com/10351358/203137657-37f1af10-ac52-4ec5-9417-e1783ff5809a.png">
biodranik commented 2022-11-21 20:27:01 +00:00 (Migrated from github.com)

@AndrewShkrob what kind of LocationHelper refactoring is needed for AA?

@AndrewShkrob what kind of LocationHelper refactoring is needed for AA?
Author
Member

@biodranik
For example, refactoring of UiCallback interface
There 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 Android
Example:

public void onLocationDisabled() 
{
    ... 
    final AppCompatActivity activity = mUiCallback.requireActivity();
    AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.MwmTheme_AlertDialog)
        .setTitle(R.string.enable_location_services)
        .setMessage(R.string.location_is_disabled_long_text)
        .setOnDismissListener(dialog -> mErrorDialog = null)
        .setOnCancelListener(dialog -> setLocationErrorDialogAnnoying(true))
        .setNegativeButton(R.string.close, (dialog, which) -> setLocationErrorDialogAnnoying(true));
    final Intent intent = Utils.makeSystemLocationSettingIntent(activity);
    if (intent != null)
    {
      intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
      intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
      builder.setPositiveButton(R.string.connection_settings, (dialog, which) -> activity.startActivity(intent));
    }
    mErrorDialog = builder.show();
}

I guess such refactoring will be needed for all Helpers that will be used both on Android and AA.

@biodranik For example, refactoring of `UiCallback` interface There 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 Android Example: ```java public void onLocationDisabled() { ... final AppCompatActivity activity = mUiCallback.requireActivity(); AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.MwmTheme_AlertDialog) .setTitle(R.string.enable_location_services) .setMessage(R.string.location_is_disabled_long_text) .setOnDismissListener(dialog -> mErrorDialog = null) .setOnCancelListener(dialog -> setLocationErrorDialogAnnoying(true)) .setNegativeButton(R.string.close, (dialog, which) -> setLocationErrorDialogAnnoying(true)); final Intent intent = Utils.makeSystemLocationSettingIntent(activity); if (intent != null) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); builder.setPositiveButton(R.string.connection_settings, (dialog, which) -> activity.startActivity(intent)); } mErrorDialog = builder.show(); } ``` I guess such refactoring will be needed for all Helpers that will be used both on Android and AA.
biodranik commented 2022-11-21 21:52:58 +00:00 (Migrated from github.com)

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

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
Owner

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. No Activity - no dialogs will be displayed. I don't think that we want to display these dialogs on the car screen.

> 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. No `Activity` - no dialogs will be displayed. I don't think that we want to display these dialogs on the car screen.
Owner

Let me check how to make Activity optional there. It should be possible.

Let me check how to make Activity optional there. It should be possible.
Owner

@AndrewShkrob , please try #3944. It has some bugs, but I will try to fix them.

@AndrewShkrob , please try #3944. It has some bugs, but I will try to fix them.
Author
Member

@AndrewShkrob , please try organicmaps/organicmaps#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.

>@AndrewShkrob , please try https://git.omaps.dev/organicmaps/organicmaps/pulls/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.
Author
Member

@rtsisyk, PTAL

@rtsisyk, PTAL
biodranik commented 2022-11-24 15:08:43 +00:00 (Migrated from github.com)

@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.

@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.
Author
Member

@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:

  • To create two similar PRs for common changes: one for the master and one for the AA branch. It will lead to unrelated histories in the future and a big merge conflict
  • To keep common changes only in the AA branch. It will be harder to keep the branch up to date with the master if there will be updates in changed files but it should be easier to make a final merge

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

@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: * To create two similar PRs for common changes: one for the master and one for the AA branch. It will lead to unrelated histories in the future and a big merge conflict * To keep common changes only in the AA branch. It will be harder to keep the branch up to date with the master if there will be updates in changed files but it should be easier to make a final merge 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
biodranik commented 2022-11-24 20:33:04 +00:00 (Migrated from github.com)

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?

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?
Author
Member

You already described the problem of a separate branch in this case 😄

you ALWAYS rebase it on top of the fresh master and keep it up-to-date, to avoid merge conflicts and simplify support.

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?

You already described the problem of a separate branch in this case 😄 >you <b>ALWAYS</b> rebase it on top of the fresh master and keep it up-to-date, to avoid merge conflicts and simplify support. 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?
biodranik commented 2022-11-24 23:14:50 +00:00 (Migrated from github.com)

Ok, we can postpone the cleanup.

Ok, we can postpone the cleanup.
biodranik commented 2022-11-24 23:18:48 +00:00 (Migrated from github.com)

I've created aa branch, if you want to start with it.

I've created aa branch, if you want to start with it.
Author
Member

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

Added some screens. Maybe it's too much for a single PR but at least there is something to discuss 😄 --- <details> <summary>Main</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204114336-51c33232-3f8f-4590-b1cf-1a7655bdaa6c.png"> </details> --- <details> <summary>Settings</summary> <details><summary>Settings. Main</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204114398-7969279c-ea0e-4353-b483-0eb8ef24e38f.png"> <img width="912" src="https://user-images.githubusercontent.com/10351358/204114404-4afeda73-4e7b-4efe-a1ab-e9c3133d3c0a.png"> Changed font size: <img width="912" src="https://user-images.githubusercontent.com/10351358/204114426-ccb7fa25-6fcf-4e67-bf4f-da77cee6c661.png"> </details> <details><summary>Settings. Driving Options</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204114519-038200b4-279b-4517-9478-ca1d00992c5e.png"> </details> <details><summary>Settings. Help</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204114563-2c60ba68-aeab-496d-92ec-9e99d3506c8e.png"> </details> </details> --- <details><summary>Search with history</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204114583-1f8fb79c-85be-43f9-8dfd-a2c562111d9a.png"> </details> --- <details><summary>Categories</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204114600-9be945c0-55d9-4ba8-a4d0-724beed0885c.png"> </details> --- <details><summary>Bookmarks</summary> <details><summary>Bookmarks. Bookmark Categories</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204364693-cb8ea9a5-0d57-4c7b-ba72-1b413e81ae2f.png"> </details> <details><summary>Bookmarks. Bookmark</summary> <img width="912" src="https://user-images.githubusercontent.com/10351358/204364730-b2598229-61b0-4a36-bc29-ba11f01103b4.png"> </details> </details> ---
Owner

@biodranik For example, refactoring of UiCallback interface There 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 Android Example:

A new version of LocationHelper has been merged into master.

> @biodranik For example, refactoring of `UiCallback` interface There 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 Android Example: > A new version of LocationHelper has been merged into master.
Author
Member

@rtsisyk Could you make a review?

@rtsisyk Could you make a review?
LaoshuBaby (Migrated from github.com) approved these changes 2022-12-07 23:23:11 +00:00
rtsisyk reviewed 2022-12-08 08:44:10 +00:00
rtsisyk left a comment
Owner

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.

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:

git fetch origin -a
git checkout android-auto/init
git rebase origin/master # resolve conflicts
git push origin android-auto/init:android-auto/init --force

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.

Please kindly rebase this PR on the top of the latest master: ``` git fetch origin -a git checkout android-auto/init git rebase origin/master # resolve conflicts git push origin android-auto/init:android-auto/init --force ``` 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)

Does Android Auto work without Google Play Services? This GMS-specific section probably should be in `gms-enabled` flavor: https://github.com/organicmaps/organicmaps/blob/e9056f11fbc2cf3c41850701302bba305cbde95a/android/flavors/gms-enabled/AndroidManifest.xml#L4

Could you please provide any details? I haven't seen this problem on master.

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.

Could you please explain how these magic constants were obtained? It looks mysterious.

What are potential security implications here?

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.

We can follow the same logic as for myPosition button? https://github.com/organicmaps/organicmaps/blob/e9056f11fbc2cf3c41850701302bba305cbde95a/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?

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 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.

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)

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. https://github.com/organicmaps/organicmaps/blob/e9056f11fbc2cf3c41850701302bba305cbde95a/android/src/app/organicmaps/Map.java#L120-L123

I suggest merging this code back to SettingsScreen.java. It is not needed anywhere outside SettingsScreen.java.

I suggest merging this code back to `SettingsScreen.java`. It is not needed anywhere outside `SettingsScreen.java`.

It looks like a hack. Why this invalidation is needed in this place?

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.

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.

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.

Let's merge this refactoring into master via a separate PR.

Let's merge this refactoring into master via a separate PR.
AndrewShkrob reviewed 2022-12-08 17:36:08 +00:00
Author
Member

Я взял эти строчки из файла библиотеки.
В примерах он подключается напрямую, но Android Studio показывает warning
Поэтому решил сделать так

Ссылка на пример

    @NonNull
    @Override
    public HostValidator createHostValidator() {
        if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            return HostValidator.ALLOW_ALL_HOSTS_VALIDATOR;
        } else {
            return new HostValidator.Builder(getApplicationContext())
                    .addAllowedHosts(androidx.car.app.R.array.hosts_allowlist_sample)
                    .build();
        }
    }
Я взял эти строчки из файла библиотеки. В примерах он подключается напрямую, но Android Studio показывает warning Поэтому решил сделать так [Ссылка на пример](https://github.com/android/car-samples/blob/03440d5e974a060d0216b5e02a7fe3c46b7b9469/car_app_library/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationCarAppService.java) ```java @NonNull @Override public HostValidator createHostValidator() { if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { return HostValidator.ALLOW_ALL_HOSTS_VALIDATOR; } else { return new HostValidator.Builder(getApplicationContext()) .addAllowedHosts(androidx.car.app.R.array.hosts_allowlist_sample) .build(); } } ```
AndrewShkrob reviewed 2022-12-08 17:47:59 +00:00
Author
Member

Эта ошибка появляется после подключения androidx.car.app:app:1.3.0-beta01
Хорошего решения я не нагуглил, только такое
Пока предлагаю оставить так
Проблема скорее всего в самой библиотеке для AA, но она еще в бете и к тому моменту, как мы закончим эту фичу может успеть обновиться до релизной версии, и, возможно, проблему исправят
Более раннюю версию androidx.car.app:app:1.3.0-beta01, мне кажется, лучше не использовать, потому что:

  • к концу разработки AA может выйти релизная версия
  • эта поддерживает больше жестов для Surface, да и вообще тут больше фич есть
  • Тот же MapTemplate добавили только в 1.3.0-alpha01

Пока писал этот коммент, заметил, что вчера вышла 1.3.0-rc01. Надо обновить PR, может и проблема уйдет 😄

Эта ошибка появляется после подключения `androidx.car.app:app:1.3.0-beta01` Хорошего решения я не нагуглил, только такое Пока предлагаю оставить так Проблема скорее всего в самой библиотеке для AA, но она еще в бете и к тому моменту, как мы закончим эту фичу может успеть обновиться до релизной версии, и, возможно, проблему исправят Более раннюю версию `androidx.car.app:app:1.3.0-beta01`, мне кажется, лучше не использовать, потому что: * к концу разработки AA может выйти релизная версия * эта поддерживает больше жестов для Surface, да и вообще тут больше фич есть * Тот же MapTemplate добавили только в `1.3.0-alpha01` Пока писал этот коммент, заметил, что вчера вышла `1.3.0-rc01`. Надо обновить PR, может и проблема уйдет 😄
AndrewShkrob reviewed 2022-12-08 17:50:10 +00:00
Author
Member

Код из примера. Объяснений, для чего это сделано, нигде не нашел

Ссылка на пример

Код из примера. Объяснений, для чего это сделано, нигде не нашел [Ссылка на пример](https://github.com/android/car-samples/blob/03440d5e974a060d0216b5e02a7fe3c46b7b9469/car_app_library/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationCarAppService.java)
biodranik (Migrated from github.com) reviewed 2022-12-08 18:15:46 +00:00
biodranik (Migrated from github.com) commented 2022-12-08 18:15:46 +00:00

У нас принято разбираться и писать только тот код, который мы чётко понимаем, для чего и зачем он нужен. И стараемся, чтобы было понятно другим, кто читает код, в т.ч. оставляя комментарии.

У нас принято разбираться и писать только тот код, который мы чётко понимаем, для чего и зачем он нужен. И стараемся, чтобы было понятно другим, кто читает код, в т.ч. оставляя комментарии.
AndrewShkrob reviewed 2022-12-08 18:19:54 +00:00
Author
Member

Тут очень интересно :)

NavigationScreen создает MapTemplate, чтобы отображать карту и данные.
Допустим, мы нажимаем на Категории, у нас открывается CategoriesScreen, который тоже создает MapTemplate, чтобы отображать карту и данные. Проблема в том, что на новом экране не обрабатываются события в SurfaceRenderer. Они просто не приходят к нему.
В документации о таком не написано, в интернете я тоже не нашел решения этой проблемы. Я даже не нашел упоминания этой проблемы. возможно все думают, что так и должно быть.

Даже в GoogleMaps при изменении экрана (например в поиске что-нибудь набрать и перейти на экран выбора маршрута) не двигается карта(хотя я сомневаюсь, что они вообще использовали свою библиотеку, потому что слишком сильно нарушают свои же ограничения по UI. С их библиотекой такой UI сделать просто невозможно).
Я запустил их пример, чтобы проверить, все ли я правильно делаю. Там тоже не работает.
Ссылка на пример
Либо это у меня такой редкий кейс связки телефона и компьютера.

2 ГИС вообще не поддерживает onScroll.

Во всем виноват Action Strip
image

Изначально для каждого нового экрана я создавал новый новый Action Strip. Так не работало.
Если передавать один и тот же объект ActionStrip для всех экранов с картой, то на всех экранах в SurfaceRenderer будут приходить события.
Для этого и была сделана такая абстракция в виде OmController и MapScreen

Не знаю, баг это или фича... Возможно в 1.3.0-rc01 это пофиксили. Надо проверить.

Тут очень интересно :) `NavigationScreen` создает `MapTemplate`, чтобы отображать карту и данные. Допустим, мы нажимаем на `Категории`, у нас открывается `CategoriesScreen`, который тоже создает `MapTemplate`, чтобы отображать карту и данные. Проблема в том, что на новом экране не обрабатываются события в SurfaceRenderer. Они просто не приходят к нему. В документации о таком не написано, в интернете я тоже не нашел решения этой проблемы. Я даже не нашел упоминания этой проблемы. возможно все думают, что так и должно быть. Даже в GoogleMaps при изменении экрана (например в поиске что-нибудь набрать и перейти на экран выбора маршрута) не двигается карта(хотя я сомневаюсь, что они вообще использовали свою библиотеку, потому что слишком сильно нарушают свои же ограничения по UI. С их библиотекой такой UI сделать просто невозможно). Я запустил их пример, чтобы проверить, все ли я правильно делаю. Там тоже не работает. [Ссылка на пример](https://github.com/android/car-samples/blob/03440d5e974a060d0216b5e02a7fe3c46b7b9469/car_app_library/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationCarAppService.java) Либо это у меня такой редкий кейс связки телефона и компьютера. 2 ГИС вообще не поддерживает `onScroll`. Во всем виноват Action Strip <img width="90" alt="image" src="https://user-images.githubusercontent.com/10351358/206532515-0a6accd6-7ad9-4305-bc57-58e22a129712.png"> Изначально для каждого нового экрана я создавал новый новый Action Strip. Так не работало. Если передавать один и тот же объект ActionStrip для всех экранов с картой, то на всех экранах в SurfaceRenderer будут приходить события. Для этого и была сделана такая абстракция в виде `OmController` и `MapScreen` Не знаю, баг это или фича... Возможно в `1.3.0-rc01` это пофиксили. Надо проверить.
AndrewShkrob reviewed 2022-12-08 18:27:11 +00:00
Author
Member

Да, но createSharedPrefsCheckbox, как и createDrivingOptionCheckbox использует иконки чекбоксов. Не хочется каждый раз заново инициализировать иконки. Перемещение их в SettingsScreen приведет к тому, что они будут заново инициализироваться при создании экрана. Плюс есть еще DrivingOptionsScreen, который использует эти же иконки. Надо придумать, где и как их хранить. Это относится не только к чекбоксам, но и к остальным иконкам на других экранах. Пока что решение такое.

Да, но `createSharedPrefsCheckbox`, как и `createDrivingOptionCheckbox` использует иконки чекбоксов. Не хочется каждый раз заново инициализировать иконки. Перемещение их в `SettingsScreen` приведет к тому, что они будут заново инициализироваться при создании экрана. Плюс есть еще `DrivingOptionsScreen`, который использует эти же иконки. Надо придумать, где и как их хранить. Это относится не только к чекбоксам, но и к остальным иконкам на других экранах. Пока что решение такое.
AndrewShkrob reviewed 2022-12-08 18:29:18 +00:00
@ -0,0 +33,4 @@
public Screen onCreateScreen(@NonNull Intent intent)
{
Log.d(TAG, "onCreateScreen()");
if (mInitFailed)
Author
Member

Да. Надо поработать над ErrorScreen. Возможно вообще сделать какой-то общий экран для отображения всех сообщений. Например, ошибка инициализации (как здесь), запрос permisiions и т.д.

Да. Надо поработать над `ErrorScreen`. Возможно вообще сделать какой-то общий экран для отображения всех сообщений. Например, ошибка инициализации (как здесь), запрос permisiions и т.д.
AndrewShkrob reviewed 2022-12-08 18:37:18 +00:00
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Author
Member

Нет. SplashScreen вообще не будет запускаться.
У нас есть заблокированный телефон, на котором карты не открыты. Мы его подключаем к AA. Запустится NavigationSession, в котором и будет вызван init.
Вариант, когда карты открыты одновременно и на телефоне, и на AA невозможен.
По-хорошему да, тут должна быть реализована сложная логика:

  • проверить, запущено ли приложение на телефоне
  • если запущено, то при подключении AA:
    • не инициализировать снова
    • перерисовать карты на экран AA
    • на телефоне показать уведомление, что карты теперь на AA и закрыть приложение
    • либо реализовать какую-нибудь Activity-заглушку с базовыми возможностями

Но это все тема для отдельного PR

Нет. `SplashScreen` вообще не будет запускаться. У нас есть заблокированный телефон, на котором карты не открыты. Мы его подключаем к AA. Запустится `NavigationSession`, в котором и будет вызван `init`. Вариант, когда карты открыты одновременно и на телефоне, и на AA невозможен. По-хорошему да, тут должна быть реализована сложная логика: * проверить, запущено ли приложение на телефоне * если запущено, то при подключении AA: * не инициализировать снова * перерисовать карты на экран AA * на телефоне показать уведомление, что карты теперь на AA и закрыть приложение * либо реализовать какую-нибудь Activity-заглушку с базовыми возможностями Но это все тема для отдельного PR
AndrewShkrob reviewed 2022-12-08 18:43:53 +00:00
Author
Member

Я пробовал, работает так же, как и моя предыдущая реализация еще до этих изменений в LocationHelper
Просто тремя строчками тут не обойтись
Из тех проблем, что я вижу сейчас:

  • Просто отображается синяя точка. Иногда может нарисовать стрелочку, но чаще просто синяя точка
  • Если местоположение отображается, то появляются проблемы с onScale. Всегда скейлится относительно местоположения, а не точки на экране
  • Плюс все равно надо реализовывать кнопку с разными иконками

Я считаю, это лучше сделать в отдельном PR

Я пробовал, работает так же, как и моя предыдущая реализация еще до этих изменений в `LocationHelper` Просто тремя строчками тут не обойтись Из тех проблем, что я вижу сейчас: * Просто отображается синяя точка. Иногда может нарисовать стрелочку, но чаще просто синяя точка * Если местоположение отображается, то появляются проблемы с `onScale`. Всегда скейлится относительно местоположения, а не точки на экране * Плюс все равно надо реализовывать кнопку с разными иконками Я считаю, это лучше сделать в отдельном PR
AndrewShkrob reviewed 2022-12-08 18:46:50 +00:00
Author
Member

Нельзя изменить иконку на созданном объекте:

  • Создание происходит через Builder. На этапе установки обработчика невозможно получить доступ к объекту
  • В объектах нет методов для изменения его состояния. Т.е. какого-нибудь setIcon(...) нет.

Видимо, такая концепция AA. Приходится перерисовывать весь экран.

Нельзя изменить иконку на созданном объекте: * Создание происходит через Builder. На этапе установки обработчика невозможно получить доступ к объекту * В объектах нет методов для изменения его состояния. Т.е. какого-нибудь `setIcon(...)` нет. Видимо, такая концепция AA. Приходится перерисовывать весь экран.
AndrewShkrob reviewed 2022-12-08 19:01:28 +00:00
Author
Member

Да. По-хорошему, как и иконки в UiHelper, надо где-то отдельно хранить, потому что будет часто и много где использоваться.

PS. Обидно вообще-то 😄 image
Да. По-хорошему, как и иконки в `UiHelper`, надо где-то отдельно хранить, потому что будет часто и много где использоваться. <details> <summary>PS. Обидно вообще-то 😄 </summary> <img width="642" alt="image" src="https://user-images.githubusercontent.com/10351358/206543495-691a97b1-2b73-4d59-9f5a-ba742a112e90.png"> </details>
AndrewShkrob reviewed 2022-12-08 19:05:06 +00:00
@ -0,0 +89,4 @@
}
@NonNull
private ItemList createBookmarksList()
Author
Member

Пока я реализовал только отображение. Как и поиск. Полную поддержку можно будет сделать после либо с базовой навигацией. Это нужен отдельный PR.

Пока я реализовал только отображение. Как и поиск. Полную поддержку можно будет сделать после либо с базовой навигацией. Это нужен отдельный PR.
AndrewShkrob reviewed 2022-12-08 19:07:18 +00:00
Author
Member

Не знаю. Скорее всего нет. Надо проверить на телефоне без Google Play сервисов. Но у меня такого нет.

Не знаю. Скорее всего нет. Надо проверить на телефоне без Google Play сервисов. Но у меня такого нет.
AndrewShkrob reviewed 2022-12-08 19:09:48 +00:00
@ -0,0 +41,4 @@
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
Log.d(TAG, "Surface available " + surfaceContainer);
mMap.onSurfaceCreated(
Author
Member

Никак. Мы это обсуждали еще в первых сообщениях этого PR.

@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.

Поддержки одновременной работы на телефоне и на AA не будет.
Подробнее здесь organicmaps/organicmaps#3806

Никак. Мы это обсуждали еще в первых сообщениях этого PR. > @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. Поддержки одновременной работы на телефоне и на AA не будет. Подробнее здесь https://git.omaps.dev/organicmaps/organicmaps/pulls/3806#discussion_r1043697281
Author
Member

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.

@rtsisyk, Я думаю, это будет довольно сложно реализовать. Нельзя одновременно рисовать карты и на телефоне и не AA. organicmaps/organicmaps#3806

> 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. @rtsisyk, Я думаю, это будет довольно сложно реализовать. Нельзя одновременно рисовать карты и на телефоне и не AA. https://git.omaps.dev/organicmaps/organicmaps/pulls/3806#discussion_r1043726955
AndrewShkrob reviewed 2022-12-08 19:44:17 +00:00
Author
Member

В 1.3.0-rc01 не исправили.

В `1.3.0-rc01` не исправили.
AndrewShkrob reviewed 2022-12-08 19:54:23 +00:00
Author
Member

Сейчас проверил на 1.3.0-rc01 и на 1.3.0-beta01. Не воспроизводится.
Возможно, дело было в чем-то другом и я уже не помню.
Хотя в примере от Google проблема все еще есть.
В любом случае, предлагаю пока не убирать это, т.к. это все равно должно быть оптимальнее чем на каждом экране пересоздавать ActionStrip.

Сейчас проверил на `1.3.0-rc01` и на `1.3.0-beta01`. Не воспроизводится. Возможно, дело было в чем-то другом и я уже не помню. Хотя в примере от Google проблема все еще есть. В любом случае, предлагаю пока не убирать это, т.к. это все равно должно быть оптимальнее чем на каждом экране пересоздавать ActionStrip.
biodranik (Migrated from github.com) reviewed 2022-12-08 21:14:42 +00:00
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
biodranik (Migrated from github.com) commented 2022-12-08 21:14:42 +00:00
  1. Как гугл себя ведёт на телефоне при подключении к AA? На айфоне работают карты и там, и там. Удобно выбирать и прокладывать маршрут на телефоне. В режиме навигации на телефоне список дирекшнс.
  2. Всмысле тема для отдельного PR? АА будет сделан на одном PR, после мержа которого будет релиз, и дороги назад не будет. Ломать мастер мержем недоделанного PR мы не будем. Или есть какой-то другой план?
1. Как гугл себя ведёт на телефоне при подключении к AA? На айфоне работают карты и там, и там. Удобно выбирать и прокладывать маршрут на телефоне. В режиме навигации на телефоне список дирекшнс. 2. Всмысле тема для отдельного PR? АА будет сделан на одном PR, после мержа которого будет релиз, и дороги назад не будет. Ломать мастер мержем недоделанного PR мы не будем. Или есть какой-то другой план?
biodranik (Migrated from github.com) reviewed 2022-12-08 21:16:48 +00:00
biodranik (Migrated from github.com) commented 2022-12-08 21:16:48 +00:00
  1. Синяя точка означает, что прилетает только позиция, без компаса/сторон света. Надо разбираться, почему.
  2. Отдельного PR не будет. Или имеется ввиду отдельный PR на ветку AA? Тогда ок.
1. Синяя точка означает, что прилетает только позиция, без компаса/сторон света. Надо разбираться, почему. 2. Отдельного PR не будет. Или имеется ввиду отдельный PR на ветку AA? Тогда ок.
AndrewShkrob reviewed 2022-12-08 21:21:55 +00:00
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Author
Member
  1. Гугл выдает сообщение типа "открыто на Android Auto" и не дает открыть приложение. В теории, конечно, можно сделать, чтобы карты работали и там, и там, но, мне кажется, это будет очень сложно.
  2. А для чего нам тогда отдельная ветка под AA? Хранить все в одном PR на 10+ тысяч строк кода как-то не очень хорошо, наверное
1. Гугл выдает сообщение типа "открыто на Android Auto" и не дает открыть приложение. В теории, конечно, можно сделать, чтобы карты работали и там, и там, но, мне кажется, это будет очень сложно. 2. А для чего нам тогда отдельная ветка под AA? Хранить все в одном PR на 10+ тысяч строк кода как-то не очень хорошо, наверное
biodranik (Migrated from github.com) reviewed 2022-12-08 21:23:02 +00:00
biodranik (Migrated from github.com) commented 2022-12-08 21:23:02 +00:00

Там ещё есть ограничение, насколько часто можно перерисовывать экран.

Там ещё есть ограничение, насколько _часто_ можно перерисовывать экран.
biodranik (Migrated from github.com) reviewed 2022-12-08 21:23:52 +00:00
biodranik (Migrated from github.com) reviewed 2022-12-08 21:25:51 +00:00
@ -0,0 +41,4 @@
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
Log.d(TAG, "Surface available " + surfaceContainer);
mMap.onSurfaceCreated(
biodranik (Migrated from github.com) commented 2022-12-08 21:25:50 +00:00

Нужен удобный UX. Вариант, когда например нужно выбрать сначала маршрут на телефоне, и только потом заработает карта навигатора AA, тоже можно рассмотреть. А вообще, лучше сделать невозможное. По возможности.

Нужен удобный UX. Вариант, когда например нужно выбрать сначала маршрут на телефоне, и только потом заработает карта навигатора AA, тоже можно рассмотреть. А вообще, лучше сделать невозможное. По возможности.
biodranik (Migrated from github.com) reviewed 2022-12-08 21:27:44 +00:00
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
biodranik (Migrated from github.com) commented 2022-12-08 21:27:44 +00:00

Откуда будет 10К строк кода? Мы обсуждали ранее — всё, что можно втянуть в мастер, не ломая его, надо втягивать в мастер, и ребейзить ветку поверх. Не должно быть никаких squash коммитов с мастера, они мешают.

Откуда будет 10К строк кода? Мы обсуждали ранее — всё, что можно втянуть в мастер, не ломая его, надо втягивать в мастер, и ребейзить ветку поверх. Не должно быть никаких squash коммитов с мастера, они мешают.
AndrewShkrob reviewed 2022-12-08 21:28:13 +00:00
Author
Member

Перерисовывать один и тот же экран можно неограниченное количество раз
https://developer.android.com/static/training/cars/Android%20for%20Cars%20App%20Library%20design%20guidelines.pdf
Слайд 11

Перерисовывать один и тот же экран можно неограниченное количество раз https://developer.android.com/static/training/cars/Android%20for%20Cars%20App%20Library%20design%20guidelines.pdf Слайд 11
AndrewShkrob reviewed 2022-12-08 21:31:25 +00:00
Author
Member

Ну и конкретно для MapTemplate:

Template Restrictions In regards to template refreshes, as described in onGetTemplate, this template is considered a refresh of a previous one if:
The template title has not changed, and the number of rows and the title (not counting spans) of each row between the previous and new Panes or ItemLists have not changed.

https://developer.android.com/reference/androidx/car/app/navigation/model/MapTemplate

Ну и конкретно для MapTemplate: > Template Restrictions In regards to template refreshes, as described in [onGetTemplate](https://developer.android.com/reference/androidx/car/app/Screen#onGetTemplate()), this template is considered a refresh of a previous one if: The template title has not changed, and the number of rows and the title (not counting spans) of each row between the previous and new [Pane](https://developer.android.com/reference/androidx/car/app/model/Pane)s or [ItemList](https://developer.android.com/reference/androidx/car/app/model/ItemList)s have not changed. https://developer.android.com/reference/androidx/car/app/navigation/model/MapTemplate
biodranik commented 2022-12-08 21:34:37 +00:00 (Migrated from github.com)

Interesting. I've rebased aa branch, but the PR is not updated and still have 3 commits from the master.

Interesting. I've rebased aa branch, but the PR is not updated and still have 3 commits from the master.
AndrewShkrob reviewed 2022-12-08 21:41:01 +00:00
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
Author
Member

Я прикинул и у меня получилось +/- 10к на весь модуль AA. Если будет меньше, супер.
Я просто сделал пару экранов для настроек и экраны поиска, категорий и закладок без всякой логики, только отрисовка. Уже PR на 1к строк. И это только начало.
Я предполагал, что мы будем делать небольшие PR'ы в ветку aa, и когда фича будет закончена, вмержим ее в мастер. Если это не так, то тогда я не понимаю, зачем нужна отдельная ветка

Я прикинул и у меня получилось +/- 10к на весь модуль AA. Если будет меньше, супер. Я просто сделал пару экранов для настроек и экраны поиска, категорий и закладок без всякой логики, только отрисовка. Уже PR на 1к строк. И это только начало. Я предполагал, что мы будем делать небольшие PR'ы в ветку `aa`, и когда фича будет закончена, вмержим ее в мастер. Если это не так, то тогда я не понимаю, зачем нужна отдельная ветка
AndrewShkrob reviewed 2022-12-08 21:50:53 +00:00
Author
Member

Вот такое объяснение в документации.

    /**
     * Returns the {@link HostValidator} this service will use to accept or reject host connections.
     *
     * <p>By default, the provided {@link HostValidator.Builder} would produce a validator that
     * only accepts connections from hosts holding
     * {@link HostValidator#TEMPLATE_RENDERER_PERMISSION} permission.
     *
     * <p>Application developers are expected to also allow connections from known hosts which
     * don't hold the aforementioned permission (for example, Android Auto and Android
     * Automotive OS hosts below API level 31), by allow-listing the signatures of those hosts.
     *
     * <p>Refer to {@code androidx.car.app.R.array.hosts_allowlist_sample} to obtain a
     * list of package names and signatures that should be allow-listed by default.
     *
     * <p>It is also advised to allow connections from unknown hosts in debug builds to facilitate
     * debugging and testing.
     *
     * <p>Below is an example of this method implementation:
     *
     * <pre>
     * &#64;Override
     * &#64;NonNull
     * public HostValidator createHostValidator() {
     *     if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
     *         return HostValidator.ALLOW_ALL_HOSTS_VALIDATOR;
     *     } else {
     *         return new HostValidator.Builder(context)
     *             .addAllowedHosts(androidx.car.app.R.array.hosts_allowlist_sample)
     *             .build();
     *     }
     * }
     * </pre>
     */
Вот такое объяснение в документации. ```java /** * Returns the {@link HostValidator} this service will use to accept or reject host connections. * * <p>By default, the provided {@link HostValidator.Builder} would produce a validator that * only accepts connections from hosts holding * {@link HostValidator#TEMPLATE_RENDERER_PERMISSION} permission. * * <p>Application developers are expected to also allow connections from known hosts which * don't hold the aforementioned permission (for example, Android Auto and Android * Automotive OS hosts below API level 31), by allow-listing the signatures of those hosts. * * <p>Refer to {@code androidx.car.app.R.array.hosts_allowlist_sample} to obtain a * list of package names and signatures that should be allow-listed by default. * * <p>It is also advised to allow connections from unknown hosts in debug builds to facilitate * debugging and testing. * * <p>Below is an example of this method implementation: * * <pre> * &#64;Override * &#64;NonNull * public HostValidator createHostValidator() { * if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { * return HostValidator.ALLOW_ALL_HOSTS_VALIDATOR; * } else { * return new HostValidator.Builder(context) * .addAllowedHosts(androidx.car.app.R.array.hosts_allowlist_sample) * .build(); * } * } * </pre> */ ```
biodranik (Migrated from github.com) reviewed 2022-12-08 22:01:46 +00:00
biodranik (Migrated from github.com) commented 2022-12-08 22:01:46 +00:00

А нельзя их временно disable? https://www.imobie.com/support/uninstall-google-play-services.htm

А нельзя их временно disable? https://www.imobie.com/support/uninstall-google-play-services.htm
biodranik (Migrated from github.com) reviewed 2022-12-08 22:03:16 +00:00
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();
biodranik (Migrated from github.com) commented 2022-12-08 22:03:15 +00:00

Всё верно. Но каждый PR должен быть достаточно законченным и доделанным, без временных костылей.

Всё верно. Но каждый PR должен быть достаточно законченным и доделанным, без временных костылей.
AndrewShkrob reviewed 2022-12-09 20:47:40 +00:00
Author
Member
https://git.omaps.dev/organicmaps/organicmaps/pulls/4061
AndrewShkrob reviewed 2022-12-09 20:47:44 +00:00
Author
Member
https://git.omaps.dev/organicmaps/organicmaps/pulls/4061
Author
Member

Что-то я все никак не могу эту ветку с мастером подружить 😞

Что-то я все никак не могу эту ветку с мастером подружить 😞
AndrewShkrob reviewed 2022-12-11 02:38:59 +00:00
Author
Member

AA без Google Play Services не работает.
Но тут есть нюанс. Я все это время собирал проект на fdroid. Т.е. сервисы отключены, но на телефоне-то они есть. И все работало.
Что если человек скачал приложение через fdroid, но на телефоне у него есть гугл сервисы? Он не сможет использовать AA?

AA без Google Play Services не работает. Но тут есть нюанс. Я все это время собирал проект на fdroid. Т.е. сервисы отключены, но на телефоне-то они есть. И все работало. Что если человек скачал приложение через fdroid, но на телефоне у него есть гугл сервисы? Он не сможет использовать AA?
biodranik (Migrated from github.com) reviewed 2022-12-11 06:54:58 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 06:54:58 +00:00
  1. Можно ли использовать АА без гугла?
  2. Если нельзя, то надо проверять динамически. Как это лучше всего делать?
1. Можно ли использовать АА без гугла? 2. Если нельзя, то надо проверять динамически. Как это лучше всего делать?
biodranik commented 2022-12-11 06:59:57 +00:00 (Migrated from github.com)

@AndrewShkrob так, надо сделать так:

  1. git checkout aa
  2. git pull
  3. git checkout android-auto/init
  4. git rebase aa
  5. git push
  6. Поревьюить/помержить этот PR

После этого дадим write права на репо

  • Надо будет самостоятельно ребейзить ветку origin/aa относительно мастера (я сейчас это делал сам), разруливая там мерж конфликты , и пушить отребейженную aa сразу сюда
  • Свои правки и PRы либо создавать в своём форке, как раньше, либо сразу кидать ветки сюда, создавая PRы на aa вместо мастера.

Да, слегка неудобно, но позволит двигаться итеративно, не ломая мастер. Ну и накидывать по ходу как можно больше общих изменений в мастер.

@AndrewShkrob так, надо сделать так: 1. git checkout aa 2. git pull 3. git checkout android-auto/init 4. git rebase aa 5. git push 6. Поревьюить/помержить этот PR После этого дадим write права на репо - Надо будет самостоятельно ребейзить ветку origin/aa относительно мастера (я сейчас это делал сам), разруливая там мерж конфликты , и пушить отребейженную aa сразу сюда - Свои правки и PRы либо создавать в своём форке, как раньше, либо сразу кидать ветки сюда, создавая PRы на aa вместо мастера. Да, слегка неудобно, но позволит двигаться итеративно, не ломая мастер. Ну и накидывать по ходу как можно больше общих изменений в мастер.
biodranik (Migrated from github.com) reviewed 2022-12-11 12:12:12 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 12:09:17 +00:00

Почему тут не полный путь?

Почему тут не полный путь?
biodranik (Migrated from github.com) commented 2022-12-11 12:12:07 +00:00

А как ведёт себя FDroid версия OSMand? В ней AA работает?

А как ведёт себя FDroid версия OSMand? В ней AA работает?
biodranik (Migrated from github.com) reviewed 2022-12-11 12:19:23 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 12:19:23 +00:00

androidx.concurrent:concurrent-futures:1.1.0 не помогает? Надо найти способ не тащить guava.

androidx.concurrent:concurrent-futures:1.1.0 не помогает? Надо найти способ не тащить guava.
biodranik (Migrated from github.com) reviewed 2022-12-11 12:25:45 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 12:25:45 +00:00
  1. Так какие приложения перечислены в androidx.car.app.R.array.hosts_allowlist_sample ? Я так понял, для работы с апи <31 нам придётся их перечислить.
  2. Почему бы для отладки не сделать проще: if (BuildConfig.DEBUG) ?
  3. код может быть проще:
if ()
  return ...;
return ...;
1. Так какие приложения перечислены в androidx.car.app.R.array.hosts_allowlist_sample ? Я так понял, для работы с апи <31 нам придётся их перечислить. 2. Почему бы для отладки не сделать проще: if (BuildConfig.DEBUG) ? 3. код может быть проще: ``` if () return ...; return ...; ```
biodranik (Migrated from github.com) reviewed 2022-12-11 12:42:35 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 12:25:58 +00:00

Лишняя строка

Лишняя строка
biodranik (Migrated from github.com) commented 2022-12-11 12:26:27 +00:00

Зачем этот флаг? Можно ли без него?

Зачем этот флаг? Можно ли без него?
biodranik (Migrated from github.com) commented 2022-12-11 12:29:47 +00:00

Разве ActionStrip тяжёлый класс? Держать глобальный ненужный стейт не очень хорошо.

Отдельный вопрос: а можно ли делать АА без либы гугла?

Разве ActionStrip тяжёлый класс? Держать глобальный ненужный стейт не очень хорошо. Отдельный вопрос: а можно ли делать АА без либы гугла?
biodranik (Migrated from github.com) commented 2022-12-11 12:32:28 +00:00

Скобки для однострочников не используем.

Скобки для однострочников не используем.
biodranik (Migrated from github.com) commented 2022-12-11 12:32:47 +00:00

По возможности везде используем final, легче тогда читать код.

По возможности везде используем final, легче тогда читать код.
@ -0,0 +52,4 @@
@Override
public void onVisibleAreaChanged(@NonNull Rect visibleArea)
{
Log.d(TAG, "Visible area changed. stableArea: " + mStableArea + " visibleArea:" + visibleArea);
biodranik (Migrated from github.com) commented 2022-12-11 12:30:48 +00:00

У нас кажется уже были логи без тэгов?

У нас кажется уже были логи без тэгов?
@ -0,0 +77,4 @@
mCarContext.getCarService(AppManager.class).setSurfaceCallback(this);
// TODO: Properly process deep links from other apps on AA.
boolean launchByDeepLink = false;
biodranik (Migrated from github.com) commented 2022-12-11 12:32:07 +00:00

// TODO: Properly process deep links from other apps on AA.

АА вообще позволяет из одних приложений открывать другие? Что будет, если потыкать линки на нашей тестовой странице https://omaps.app/api ?

// TODO: Properly process deep links from other apps on AA. АА вообще позволяет из одних приложений открывать другие? Что будет, если потыкать линки на нашей тестовой странице https://omaps.app/api ?
biodranik (Migrated from github.com) commented 2022-12-11 12:34:26 +00:00
  1. Зачем что-то хранить в памяти, если оно не видно на экране/не используется, и нужно только в каких-то исключительных сценариях?
  2. На сколько большой оверхед от этих иконок, что от него важно прямо сейчас подстраховаться?
1. Зачем что-то хранить в памяти, если оно не видно на экране/не используется, и нужно только в каких-то исключительных сценариях? 2. На сколько большой оверхед от этих иконок, что от него важно прямо сейчас подстраховаться?
biodranik (Migrated from github.com) commented 2022-12-11 12:35:11 +00:00
    builder.setImage(getter.get() ? mCheckboxSelectedIcon : mCheckboxIcon);
```suggestion builder.setImage(getter.get() ? mCheckboxSelectedIcon : mCheckboxIcon); ```
biodranik (Migrated from github.com) commented 2022-12-11 12:36:01 +00:00

Если getter.get() используется больше одного раза, имеет смысл вынести его в final boolean

Если getter.get() используется больше одного раза, имеет смысл вынести его в `final boolean`
biodranik (Migrated from github.com) commented 2022-12-11 12:36:17 +00:00

ditto

ditto
biodranik (Migrated from github.com) commented 2022-12-11 12:36:53 +00:00

ditto

ditto
biodranik (Migrated from github.com) commented 2022-12-11 12:37:08 +00:00

ditto

ditto
@ -0,0 +17,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
biodranik (Migrated from github.com) commented 2022-12-11 12:41:42 +00:00

Почему бы здесь сразу и не инициализировать?

Почему бы здесь сразу и не инициализировать?
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
biodranik (Migrated from github.com) commented 2022-12-11 12:41:23 +00:00

А зачем их хранить?

А зачем их хранить?
@ -0,0 +67,4 @@
private Item createDataVersionInfo()
{
return new Row.Builder()
.setTitle(getCarContext().getString(R.string.data_version, ""))
biodranik (Migrated from github.com) commented 2022-12-11 12:42:28 +00:00

Заголовок пустой?

Заголовок пустой?
AndrewShkrob reviewed 2022-12-11 12:54:58 +00:00
@ -0,0 +17,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
Author
Member

Нужен Context.

Нужен `Context`.
AndrewShkrob reviewed 2022-12-11 13:01:47 +00:00
@ -0,0 +67,4 @@
private Item createDataVersionInfo()
{
return new Row.Builder()
.setTitle(getCarContext().getString(R.string.data_version, ""))
Author
Member

Нет.
В R.string.data_version лежит <string name="data_version">OpenStreetMap data: %s</string>.
Вместо %s подставляется пустая строка.
На экране:
image

Нет. В `R.string.data_version` лежит `<string name="data_version">OpenStreetMap data: %s</string>`. Вместо `%s` подставляется пустая строка. На экране: ![image](https://user-images.githubusercontent.com/10351358/206905103-6748aa10-d338-44f7-b8b6-7d698d4b5df9.png)
AndrewShkrob reviewed 2022-12-11 13:05:10 +00:00
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
Author
Member

Там будут храниться результаты поискового запроса
Логика:

  • Вводим запрос в поиске
  • Получаем результаты
  • Заполняем mResults
  • Перерисовываем экран
  • Отображаем данные из mResults
Там будут храниться результаты поискового запроса Логика: * Вводим запрос в поиске * Получаем результаты * Заполняем `mResults` * Перерисовываем экран * Отображаем данные из `mResults`
AndrewShkrob reviewed 2022-12-11 13:13:26 +00:00
@ -0,0 +77,4 @@
mCarContext.getCarService(AppManager.class).setSurfaceCallback(this);
// TODO: Properly process deep links from other apps on AA.
boolean launchByDeepLink = false;
Author
Member

Позволяет:

  • Голосовой ввод через гугл ассистент
  • Есть приложения по типу поиска парковочных мест, которые могут запустить карту

Касаемо https://omaps.app/api
В AA браузера нет, поэтому с такими ссылками это работать не будет. Можно через телефон их открывать и переадресовывать в AA, но это уже другая история.

Позволяет: * Голосовой ввод через гугл ассистент * Есть приложения по типу поиска парковочных мест, которые могут запустить карту Касаемо https://omaps.app/api В AA браузера нет, поэтому с такими ссылками это работать не будет. Можно через телефон их открывать и переадресовывать в AA, но это уже другая история.
AndrewShkrob reviewed 2022-12-11 13:28:42 +00:00
Author
Member

Поправил.
В application и receiver у нас тоже не полный путь:

    <application
      android:name=".MwmApplication"
    <receiver
      android:name=".background.UpgradeReceiver"
      android:exported="false">
Поправил. В `application` и `receiver` у нас тоже не полный путь: ```xml <application android:name=".MwmApplication" ``` ```xml <receiver android:name=".background.UpgradeReceiver" android:exported="false"> ```
AndrewShkrob reviewed 2022-12-11 13:31:10 +00:00
Author
Member

В будущем, думаю, можно. Сейчас сделал так.
Если очень не нравится, могу удалить эту часть с сообщением об ошибке + ErrorScreen.
Но временные костыли в любом случае неизбежны.

В будущем, думаю, можно. Сейчас сделал так. Если очень не нравится, могу удалить эту часть с сообщением об ошибке + `ErrorScreen`. Но временные костыли в любом случае неизбежны.
AndrewShkrob reviewed 2022-12-11 13:40:04 +00:00
@ -0,0 +52,4 @@
@Override
public void onVisibleAreaChanged(@NonNull Rect visibleArea)
{
Log.d(TAG, "Visible area changed. stableArea: " + mStableArea + " visibleArea:" + visibleArea);
Author
Member

Не понял комментария.
Касаемо логов в onVisibleAreaChanged и onStableAreaChanged:
Это сделано на будущее. Эти изменения придется учитывать, например двигать центр карты в центр visibleArea и т.п. Со всем этим еще надо разбираться. Потом логи можно будет удалить.

Не понял комментария. Касаемо логов в `onVisibleAreaChanged` и `onStableAreaChanged`: Это сделано на будущее. Эти изменения придется учитывать, например двигать центр карты в центр visibleArea и т.п. Со всем этим еще надо разбираться. Потом логи можно будет удалить.
biodranik (Migrated from github.com) reviewed 2022-12-11 13:55:35 +00:00
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
biodranik (Migrated from github.com) commented 2022-12-11 13:55:35 +00:00

А проще передать данные прямо в отрисовку никак нельзя?

А проще передать данные прямо в отрисовку никак нельзя?
biodranik (Migrated from github.com) reviewed 2022-12-11 13:56:32 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 13:56:32 +00:00

Так, стоп. Неполные пути повлияют на app.organicmaps.beta и app.organicmaps.debug ?

Так, стоп. Неполные пути повлияют на app.organicmaps.beta и app.organicmaps.debug ?
AndrewShkrob reviewed 2022-12-11 14:08:38 +00:00
Author
Member

Ок. Перенес это в SettingsScreen и DrivingOptionsScreen

Ок. Перенес это в `SettingsScreen` и `DrivingOptionsScreen`
AndrewShkrob reviewed 2022-12-11 15:12:02 +00:00
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;
Author
Member

Нет. В AA нельзя обновлять данные на экране. Только через перерисовку всего экрана

Нет. В AA нельзя обновлять данные на экране. Только через перерисовку всего экрана
AndrewShkrob reviewed 2022-12-11 15:14:34 +00:00
Author
Member

Удалил этот класс. Сделал так, чтобы ActionStrip на каждом экране создавался новый. Разницы в скорости не заметил. Так даже лучше. В будущем не будет проблем с обновлением иконки на кнопке location.

Удалил этот класс. Сделал так, чтобы ActionStrip на каждом экране создавался новый. Разницы в скорости не заметил. Так даже лучше. В будущем не будет проблем с обновлением иконки на кнопке location.
AndrewShkrob reviewed 2022-12-11 15:18:24 +00:00
Author
Member

Не помогает

Не помогает
AndrewShkrob reviewed 2022-12-11 16:13:43 +00:00
Author
Member

Все не так. Почитал я, как работает HostValidator класс.

  • Он проверяет Host, т.е. магнитолу на которой запускается AA
  • Подключение к хосту разрешается в двух случаях
    • Либо хост указан в списке, который мы передаем
    • Либо хост имеет у себя android.car.permission.TEMPLATE_RENDERER

Поэтому я заменил R.array.car_hosts на androidx.car.app.R.array.hosts_allowlist_sample. Думаю, смысла держать свой список разрешенных хостов нет, а на warning можно закрыть глаза.

Warning:

The resource @array/hosts_allowlist_sample is marked as private in androidx.car.app:app:1.3.0-rc01

Все не так. Почитал я, как работает HostValidator класс. * Он проверяет Host, т.е. магнитолу на которой запускается AA * Подключение к хосту разрешается в двух случаях * Либо хост указан в списке, который мы передаем * Либо хост имеет у себя `android.car.permission.TEMPLATE_RENDERER` Поэтому я заменил `R.array.car_hosts` на `androidx.car.app.R.array.hosts_allowlist_sample`. Думаю, смысла держать свой список разрешенных хостов нет, а на warning можно закрыть глаза. Warning: >The resource @array/hosts_allowlist_sample is marked as private in androidx.car.app:app:1.3.0-rc01
biodranik (Migrated from github.com) reviewed 2022-12-11 21:13:37 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 21:13:37 +00:00

Так что именно в этом файле-то? )

Так что именно в этом файле-то? )
AndrewShkrob reviewed 2022-12-11 21:42:26 +00:00
Author
Member

В androidx.car.app.R.array.hosts_allowlist_sample?
Массив таких строк:
fdb00c43dbde8b51cb312aa81d3b5fa17713adb94b28f598d77f8eb89daceedf,com.google.android.projection.gearhead

Первая часть - цифровая подпись, вторая - имя пакета

* @param packageName host package name (as reported by {@link PackageManager})
* @param digest      SHA256 digest of the DER encoding of the allow-listed host
*                    certificate, formatted as 32 lowercase 2 digits  hexadecimal values
*                    separated by colon (e.g.:"000102030405060708090a0b0c0d0e0f101112131415
*                    161718191a1b1c1d1e1f"). When using
*                    <a href="https://developer.android.com/about/versions/pie/android-9.0#apk-key-rotation">signature
*                    rotation</a>, this digest should correspond to the initial signing
*                    certificate

Только сейчас обратил внимание на это:

Application developers are expected to also allow connections from known hosts which don't hold the aforementioned permission (for example, Android Auto and Android Automotive OS hosts below API level 31), by allow-listing the signatures of those hosts.

Но я не смог найти никакого общего списка хостов или хотя бы какого-то упоминания о том, что люди добавляли в этот список еще что-то. Поэтому, наверное, можно на это не обращать внимания. По крайней мере пока что.

В `androidx.car.app.R.array.hosts_allowlist_sample`? Массив таких строк: `fdb00c43dbde8b51cb312aa81d3b5fa17713adb94b28f598d77f8eb89daceedf,com.google.android.projection.gearhead` Первая часть - цифровая подпись, вторая - имя пакета ```java * @param packageName host package name (as reported by {@link PackageManager}) * @param digest SHA256 digest of the DER encoding of the allow-listed host * certificate, formatted as 32 lowercase 2 digits hexadecimal values * separated by colon (e.g.:"000102030405060708090a0b0c0d0e0f101112131415 * 161718191a1b1c1d1e1f"). When using * <a href="https://developer.android.com/about/versions/pie/android-9.0#apk-key-rotation">signature * rotation</a>, this digest should correspond to the initial signing * certificate ``` Только сейчас обратил внимание на это: >Application developers are expected to also allow connections from known hosts which don't hold the aforementioned permission (for example, Android Auto and Android Automotive OS hosts below API level 31), by allow-listing the signatures of those hosts. Но я не смог найти никакого общего списка хостов или хотя бы какого-то упоминания о том, что люди добавляли в этот список еще что-то. Поэтому, наверное, можно на это не обращать внимания. По крайней мере пока что.
biodranik (Migrated from github.com) reviewed 2022-12-11 22:03:03 +00:00
biodranik (Migrated from github.com) commented 2022-12-11 22:03:03 +00:00
  1. Полный список пакетов в том файле можно выложить сюда или на pastebin?
  2. Т.к. мы хотим поддержку с API 24, то видимо это нас коснётся. Поэтому хотелось бы сразу понимать масштабы проблемы.
1. Полный список пакетов в том файле можно выложить сюда или на pastebin? 2. Т.к. мы хотим поддержку с API 24, то видимо это нас коснётся. Поэтому хотелось бы сразу понимать масштабы проблемы.
AndrewShkrob reviewed 2022-12-11 22:08:23 +00:00
Author
Member
<string-array name="hosts_allowlist_sample" translatable="false">
   <item>fdb00c43dbde8b51cb312aa81d3b5fa17713adb94b28f598d77f8eb89daceedf,
         com.google.android.projection.gearhead</item>
   <item>70811a3eacfd2e83e18da9bfede52df16ce91f2e69a44d21f18ab66991130771,
         com.google.android.projection.gearhead</item>
   <item>1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,
         com.google.android.projection.gearhead</item>
   <item>c241ffbc8e287c4e9a4ad19632ba1b1351ad361d5177b7d7b29859bd2b7fc631,
         com.google.android.apps.automotive.templates.host</item>
   <item>dd66deaf312d8daec7adbe85a218ecc8c64f3b152f9b5998d5b29300c2623f61,
         com.google.android.apps.automotive.templates.host</item>
   <item>50e603d333c6049a37bd751375d08f3bd0abebd33facd30bd17b64b89658b421,
         com.google.android.apps.automotive.templates.host</item>
</string-array>
```xml <string-array name="hosts_allowlist_sample" translatable="false"> <item>fdb00c43dbde8b51cb312aa81d3b5fa17713adb94b28f598d77f8eb89daceedf, com.google.android.projection.gearhead</item> <item>70811a3eacfd2e83e18da9bfede52df16ce91f2e69a44d21f18ab66991130771, com.google.android.projection.gearhead</item> <item>1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00, com.google.android.projection.gearhead</item> <item>c241ffbc8e287c4e9a4ad19632ba1b1351ad361d5177b7d7b29859bd2b7fc631, com.google.android.apps.automotive.templates.host</item> <item>dd66deaf312d8daec7adbe85a218ecc8c64f3b152f9b5998d5b29300c2623f61, com.google.android.apps.automotive.templates.host</item> <item>50e603d333c6049a37bd751375d08f3bd0abebd33facd30bd17b64b89658b421, com.google.android.apps.automotive.templates.host</item> </string-array> ```
AndrewShkrob reviewed 2022-12-11 22:09:37 +00:00
Author
Member

Т.к. мы хотим поддержку с API 24, то видимо это нас коснётся. Поэтому хотелось бы сразу понимать масштабы проблемы.

Тут если что подразумевается API хоста, а не телефона

>Т.к. мы хотим поддержку с API 24, то видимо это нас коснётся. Поэтому хотелось бы сразу понимать масштабы проблемы. Тут если что подразумевается API хоста, а не телефона
Author
Member

@biodranik @rtsisyk Будут ли еще какие-то комментарии? С этим PR'ом пора заканчивать, потому что он превращается в ад. 130 сообщений это слишком. Тут потеряться можно :)

@biodranik @rtsisyk Будут ли еще какие-то комментарии? С этим PR'ом пора заканчивать, потому что он превращается в ад. 130 сообщений это слишком. Тут потеряться можно :)
biodranik commented 2022-12-12 18:41:48 +00:00 (Migrated from github.com)

@rtsisyk посмотри ещё раз, пожалуйста, и можно сквошнуть в aa ветку. Дальше будем двигаться по выше озвученному плану.

@rtsisyk посмотри ещё раз, пожалуйста, и можно сквошнуть в aa ветку. Дальше будем двигаться по выше озвученному плану.
Author
Member

@rtsisyk

@rtsisyk посмотри ещё раз, пожалуйста, и можно сквошнуть в aa ветку. Дальше будем двигаться по выше озвученному плану.

@rtsisyk > @rtsisyk посмотри ещё раз, пожалуйста, и можно сквошнуть в aa ветку. Дальше будем двигаться по выше озвученному плану.
rtsisyk reviewed 2022-12-17 07:11:00 +00:00

Там не важно кто как себя где ведет, важно что прилаги Android Auto в стандартном Android нет и в F-Droid её тоже нет. У меня не хватило сил установить эту прилагу как-то иначе извне. Без этой прилаги Auto не работает.

Конкретно в этом патче мы не добавляем никакие новые проприетарные библиотеки, а, значит, код можно включать во все сборки, включая F-Droid, даже если он там работать по факту не будет.

Там не важно кто как себя где ведет, важно что прилаги Android Auto в стандартном Android нет и в F-Droid её тоже нет. У меня не хватило сил установить эту прилагу как-то иначе извне. Без этой прилаги Auto не работает. Конкретно в этом патче мы не добавляем никакие новые проприетарные библиотеки, а, значит, код можно включать во все сборки, включая F-Droid, даже если он там работать по факту не будет.
rtsisyk reviewed 2022-12-22 08:09:21 +00:00
@ -0,0 +59,4 @@
MwmApplication app = MwmApplication.from(getCarContext());
try
{
app.init();

Здесь всё обсудили в целом уже. F-Droid я посмотрю сам.

Здесь всё обсудили в целом уже. F-Droid я посмотрю сам.
rtsisyk reviewed 2022-12-22 08:09:41 +00:00
@ -0,0 +41,4 @@
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
Log.d(TAG, "Surface available " + surfaceContainer);
mMap.onSurfaceCreated(

Обсудили это в чате.

Обсудили это в чате.
rtsisyk approved these changes 2022-12-22 08:47:50 +00:00

Я попробую разобраться можно ли поднять Android Auto на CalyxOS. Пока это не блокирует ничего.

Я попробую разобраться можно ли поднять Android Auto на CalyxOS. Пока это не блокирует ничего.

Ладно давайте добавим это в TODO лист и посмотрим позже.

Ладно давайте добавим это в 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)

abort 0x0000007e68aaf3c4
__assert2 0x0000007e68aaf788
df::ScaleInto(const ScreenBase &, const m2::Rect<…> &) screen_operations.cpp:128
df::Navigator::SetFromScreen(const ScreenBase &, unsigned int, double) navigator.cpp:28
df::Navigator::SetFromScreen(const ScreenBase &) navigator.cpp:23
df::UserEventStream::ApplyAnimations() user_event_stream.cpp:295
df::UserEventStream::ProcessEvents(bool &, bool &) user_event_stream.cpp:264
df::FrontendRenderer::ProcessEvents(bool &, bool &) frontend_renderer.cpp:2537
df::FrontendRenderer::RenderFrame() frontend_renderer.cpp:1742
df::BaseRenderer::IterateRenderLoopImpl() base_renderer.cpp:64
df::BaseRenderer::IterateRenderLoop() base_renderer.cpp:59
df::FrontendRenderer::Routine::Do() frontend_renderer.cpp:2441
threads::RunRoutine(std::__ndk1::shared_ptr<…>) thread.cpp:24
decltype(std::__ndk1::forward<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>)>(fp)(std::__ndk1::forward<std::__ndk1::shared_ptr<threads::IRoutine> >(fp0))) std::__ndk1::__invoke<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine> >(void (*&&)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine>&&) type_traits:3874
std::__ndk1::__thread_execute<…>(std::__ndk1::tuple<…> &, std::__ndk1::__tuple_indices<…>) thread:273
std::__ndk1::__thread_proxy<…>(void *) thread:284
__pthread_start(void *) 0x0000007e68b12b3c
__start_thread 0x0000007e68ab0c64
У меня при хаотичных нажатиях на +/- крешится вот в этом месте: https://github.com/organicmaps/organicmaps/blob/c9b77a292d26b6249dba9dfb570fba91e9fc371b/drape_frontend/screen_operations.cpp#L128 ``` abort 0x0000007e68aaf3c4 __assert2 0x0000007e68aaf788 df::ScaleInto(const ScreenBase &, const m2::Rect<…> &) screen_operations.cpp:128 df::Navigator::SetFromScreen(const ScreenBase &, unsigned int, double) navigator.cpp:28 df::Navigator::SetFromScreen(const ScreenBase &) navigator.cpp:23 df::UserEventStream::ApplyAnimations() user_event_stream.cpp:295 df::UserEventStream::ProcessEvents(bool &, bool &) user_event_stream.cpp:264 df::FrontendRenderer::ProcessEvents(bool &, bool &) frontend_renderer.cpp:2537 df::FrontendRenderer::RenderFrame() frontend_renderer.cpp:1742 df::BaseRenderer::IterateRenderLoopImpl() base_renderer.cpp:64 df::BaseRenderer::IterateRenderLoop() base_renderer.cpp:59 df::FrontendRenderer::Routine::Do() frontend_renderer.cpp:2441 threads::RunRoutine(std::__ndk1::shared_ptr<…>) thread.cpp:24 decltype(std::__ndk1::forward<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>)>(fp)(std::__ndk1::forward<std::__ndk1::shared_ptr<threads::IRoutine> >(fp0))) std::__ndk1::__invoke<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine> >(void (*&&)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine>&&) type_traits:3874 std::__ndk1::__thread_execute<…>(std::__ndk1::tuple<…> &, std::__ndk1::__tuple_indices<…>) thread:273 std::__ndk1::__thread_proxy<…>(void *) thread:284 __pthread_start(void *) 0x0000007e68b12b3c __start_thread 0x0000007e68ab0c64 ```
@ -0,0 +18,4 @@
import app.organicmaps.R;
public class SurfaceRenderer implements DefaultLifecycleObserver, SurfaceCallback
{

Еще один креш при +/-:

c9b77a292d/drape_frontend/screen_operations.cpp (L124)

abort 0x0000007e68aaf3c4
__assert2 0x0000007e68aaf788
jni::AndroidLogMessage(base::LogLevel, const base::SrcPoint &, const std::__ndk1::basic_string<…> &) logging.cpp:45
$_21::operator()(double) const screen_operations.cpp:124
df::ScaleInto(const ScreenBase &, const m2::Rect<…> &) screen_operations.cpp:131
df::Navigator::SetFromScreen(const ScreenBase &, unsigned int, double) navigator.cpp:28
df::Navigator::SetFromScreen(const ScreenBase &) navigator.cpp:23
df::UserEventStream::SetScreen(const ScreenBase &, bool, const std::__ndk1::function<…> &) user_event_stream.cpp:549
df::UserEventStream::OnMove(ref_ptr<…>) user_event_stream.cpp:378
df::UserEventStream::ProcessEvents(bool &, bool &) user_event_stream.cpp:176
df::FrontendRenderer::ProcessEvents(bool &, bool &) frontend_renderer.cpp:2537
df::FrontendRenderer::RenderFrame() frontend_renderer.cpp:1742
df::BaseRenderer::IterateRenderLoopImpl() base_renderer.cpp:64
df::BaseRenderer::IterateRenderLoop() base_renderer.cpp:59
df::FrontendRenderer::Routine::Do() frontend_renderer.cpp:2441
threads::RunRoutine(std::__ndk1::shared_ptr<…>) thread.cpp:24
decltype(std::__ndk1::forward<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>)>(fp)(std::__ndk1::forward<std::__ndk1::shared_ptr<threads::IRoutine> >(fp0))) std::__ndk1::__invoke<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine> >(void (*&&)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine>&&) type_traits:3874
std::__ndk1::__thread_execute<…>(std::__ndk1::tuple<…> &, std::__ndk1::__tuple_indices<…>) thread:273
std::__ndk1::__thread_proxy<…>(void *) thread:284
__pthread_start(void *) 0x0000007e68b12b3c
__start_thread 0x0000007e68ab0c64
Еще один креш при +/-: https://github.com/organicmaps/organicmaps/blob/c9b77a292d26b6249dba9dfb570fba91e9fc371b/drape_frontend/screen_operations.cpp#L124 ``` abort 0x0000007e68aaf3c4 __assert2 0x0000007e68aaf788 jni::AndroidLogMessage(base::LogLevel, const base::SrcPoint &, const std::__ndk1::basic_string<…> &) logging.cpp:45 $_21::operator()(double) const screen_operations.cpp:124 df::ScaleInto(const ScreenBase &, const m2::Rect<…> &) screen_operations.cpp:131 df::Navigator::SetFromScreen(const ScreenBase &, unsigned int, double) navigator.cpp:28 df::Navigator::SetFromScreen(const ScreenBase &) navigator.cpp:23 df::UserEventStream::SetScreen(const ScreenBase &, bool, const std::__ndk1::function<…> &) user_event_stream.cpp:549 df::UserEventStream::OnMove(ref_ptr<…>) user_event_stream.cpp:378 df::UserEventStream::ProcessEvents(bool &, bool &) user_event_stream.cpp:176 df::FrontendRenderer::ProcessEvents(bool &, bool &) frontend_renderer.cpp:2537 df::FrontendRenderer::RenderFrame() frontend_renderer.cpp:1742 df::BaseRenderer::IterateRenderLoopImpl() base_renderer.cpp:64 df::BaseRenderer::IterateRenderLoop() base_renderer.cpp:59 df::FrontendRenderer::Routine::Do() frontend_renderer.cpp:2441 threads::RunRoutine(std::__ndk1::shared_ptr<…>) thread.cpp:24 decltype(std::__ndk1::forward<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>)>(fp)(std::__ndk1::forward<std::__ndk1::shared_ptr<threads::IRoutine> >(fp0))) std::__ndk1::__invoke<void (*)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine> >(void (*&&)(std::__ndk1::shared_ptr<threads::IRoutine>), std::__ndk1::shared_ptr<threads::IRoutine>&&) type_traits:3874 std::__ndk1::__thread_execute<…>(std::__ndk1::tuple<…> &, std::__ndk1::__tuple_indices<…>) thread:273 std::__ndk1::__thread_proxy<…>(void *) thread:284 __pthread_start(void *) 0x0000007e68b12b3c __start_thread 0x0000007e68ab0c64 ```
@ -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;.

Логов без 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 здесь обойдемся. Комментарий пусть висит.

Давайте пока без deeplink здесь обойдемся. Комментарий пусть висит.
@ -0,0 +126,4 @@
public void onZoomIn()
{
Map.zoomIn();

У меня по клику на +/- карта двигается вверх/вниз вместо zoom in / zoom out.

У меня по клику на +/- карта двигается вверх/вниз вместо zoom in / zoom out.
@ -0,0 +89,4 @@
}
@NonNull
private ItemList createBookmarksList()

OK

OK
@ -0,0 +18,4 @@
public class SearchScreen extends Screen implements SearchTemplate.SearchCallback
{
private final int MAX_RESULTS_SIZE;
private ItemList mResults;

Окей, проблема понятна.

Окей, проблема понятна.
Owner

@rtsisyk

@rtsisyk посмотри ещё раз, пожалуйста, и можно сквошнуть в aa ветку. Дальше будем двигаться по выше озвученному плану.

Принципиальных возражений нет.

> @rtsisyk > > > @rtsisyk посмотри ещё раз, пожалуйста, и можно сквошнуть в aa ветку. Дальше будем двигаться по выше озвученному плану. Принципиальных возражений нет.
Author
Member

@biodranik мержим?

@biodranik мержим?
biodranik commented 2022-12-22 11:52:52 +00:00 (Migrated from github.com)

@AndrewShkrob ok, только слишком много тут замечаний/косяков, надо обязательно их все оттрекать и не забыть исправить. Фиксы в продакшне обойдутся нам гораздо дороже.

@AndrewShkrob ok, только слишком много тут замечаний/косяков, надо обязательно их все оттрекать и не забыть исправить. Фиксы в продакшне обойдутся нам гораздо дороже.
This repo is archived. You cannot comment on pull requests.
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
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: organicmaps/organicmaps-tmp#3806
No description provided.