Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Adding pulsing circle to LocationComponent options #172

Merged
merged 22 commits into from
Apr 30, 2020

Conversation

langsmith
Copy link
Contributor

This pr adds a pulsing option to the Maps SDK's LocationComponent. It is a follow up to mapbox/mapbox-gl-native#13942, which was closed because of our transition away from a mono-repo (more info about that at mapbox/mapbox-gl-native#15971).

62000504-8a60fc80-b08d-11e9-93ad-cee77e130c0e

62000562-a2854b80-b08e-11e9-8d52-39c88f4fd28b

62000544-39053d00-b08e-11e9-9a0b-a268b79ad8d2

@langsmith langsmith added the 🚧 WIP issue or pull request is a work in progress label Feb 12, 2020
@langsmith
Copy link
Contributor Author

There's a crash that I'm experiencing when running this pr's test app examples. The examples work for a while (10-40 seconds), but then there's a 💥 . I believe it's related to the Android system being overloaded when the pulsing duration (. pulsingCircleDuration()) is a low number, meaning the animator runs really rapidly.

Some sort of limit or fix needs to be figured out. I'll try to reproduce again on my device and provide more info soon.

cc @Chaoba @zugaldia @malwoodsantoro @jkevincrowley

@zugaldia
Copy link
Member

There's a crash that I'm experiencing when running this pr's test app examples.

@Chaoba Would you be able to have a look at it?

@langsmith langsmith force-pushed the ls-adding-pulsing-locationcomponent-circle branch from 5808c0f to c6e3460 Compare March 10, 2020 21:59
@Chaoba
Copy link
Contributor

Chaoba commented Mar 11, 2020

@langsmith I have changed SECOND_LOCATION_CIRCLE_PULSE_DURATION_MS to 80 ms and run the test app for a while, not found the crash issue. So, maybe it's something else cause the crash.

@zugaldia zugaldia requested a review from Chaoba March 11, 2020 17:08
Copy link
Contributor

@Chaoba Chaoba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Others look good to me.

@langsmith langsmith force-pushed the ls-adding-pulsing-locationcomponent-circle branch 3 times, most recently from 682a0b5 to cc91ef1 Compare March 27, 2020 06:10
@langsmith langsmith self-assigned this Mar 29, 2020
@langsmith langsmith added the feature 🍏 New feature or request label Mar 29, 2020
@langsmith langsmith force-pushed the ls-adding-pulsing-locationcomponent-circle branch 2 times, most recently from 34e6599 to 47e961b Compare March 30, 2020 05:56
@langsmith langsmith marked this pull request as ready for review March 30, 2020 06:29
@langsmith
Copy link
Contributor Author

Ok @Chaoba @LukasPaczos , this is good for another round of review 🙇

@langsmith langsmith removed the 🚧 WIP issue or pull request is a work in progress label Mar 30, 2020
@langsmith
Copy link
Contributor Author

cc @galinelle as FYI about this being another type of LocationComponent type of styling

Copy link
Contributor

@Chaoba Chaoba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome @langsmith 👏

Before we merge I have a couple of comments and issues that I found.

First is, that when we change any of the pulsing options, even if the component is disabled, the animation is started:
ezgif com-optimize (16)

Second is a leak:
https://gist.github.com/LukasPaczos/e588678654fec0896f059903d5cc818c

@langsmith langsmith force-pushed the ls-adding-pulsing-locationcomponent-circle branch 2 times, most recently from 40767b5 to 0d2ec13 Compare April 1, 2020 03:28
@langsmith
Copy link
Contributor Author

Second is a leak:
https://gist.github.com/LukasPaczos/e588678654fec0896f059903d5cc818c

This is now the only remaining thing in @LukasPaczos' comments above, that hasn't been fixed

@chloekraw chloekraw added this to the release-water milestone Apr 6, 2020
@langsmith langsmith force-pushed the ls-adding-pulsing-locationcomponent-circle branch from f099ffd to 5ccf6d2 Compare April 7, 2020 00:32
@chloekraw
Copy link
Contributor

@langsmith how is this going? Are you blocked on any particular issue?

Comment on lines 145 to 147
if (locationComponent != null && locationComponent.isLocationComponentActivated()) {
enablePulsing = locationComponent.isLocationComponentEnabled();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't try to implement a client-side solution for:

when we change any of the pulsing options, even if the component is disabled, the animation is started

Instead, the LocationComponent#startPulsingLocationCircle should verify the conditions when the style is applied and avoid showing the layer if the component is disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just made a new commit e7848ab

We shouldn't try to implement a client-side solution

Refactored and removed that part from the CustomizedLocationPulsingCircleActivity e7848ab#diff-7dcce2d0485478de700d188fc32f455aL144-L147

Instead, the LocationComponent#startPulsingLocationCircle should verify the conditions when the style is applied and avoid showing the layer if the component is disabled.

Whenever startPulsingLocationCircle() is run within LocationComponent.java, options.pulseEnabled() is first checked

if (options.pulseEnabled()) {
startPulsingLocationCircle();
} else {

isEnabled() is in reference to the overall LocationComponent:

if (isEnabled) {
locationAnimatorCoordinator.startLocationComponentCirclePulsing(options);
locationLayerController.adjustPulsingCircleLayerVisibility(true);
}

Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not able to reproduce the leak anymore. Have you been able to narrow it down and fix it? It might also be directly connected to the solution for https://github.com/mapbox/mapbox-gl-native-android/pull/172/files#r413040504.

When the above is address, we'll need to work on rebasing this on top of the master. Let me know if you need any help with that.

@langsmith langsmith force-pushed the ls-adding-pulsing-locationcomponent-circle branch from 5ccf6d2 to 02e5dc0 Compare April 22, 2020 23:46
@langsmith langsmith force-pushed the ls-adding-pulsing-locationcomponent-circle branch from f2fa043 to dfd9c63 Compare April 23, 2020 01:43
@langsmith
Copy link
Contributor Author

I'm not able to reproduce the leak anymore

I still get the leak on my physical device 🤷 Maybe it's device specific? Will see what happens on an emulated device.

Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add incompatibility doc entry to:


and
public Builder useSpecializedLocationLayer(boolean useSpecializedLocationLayer) {

I've spent a fair amount of time trying to track down the leak. The newly added animator seems to be canceled correctly, I'm unable to spot any issues.

The reproduction of the leak has been completely flaky for me, sometimes I've been able to reproduce it many time in the row, then it stopped being reproducible and I had to reinstall the app. And the cycle repeats. I've never been able to reproduce with the debugger attached. Any ideas @mapbox/maps-android?

I've also found an unrelated performance issue - https://github.com/mapbox/mapbox-gl-native/issues/16439.

Langston Smith and others added 6 commits April 27, 2020 06:47
…/LocationComponentOptions.java

Co-Authored-By: Łukasz Paczos <lukasz.paczos@mapbox.com>
…/LocationComponent.java

Co-Authored-By: Łukasz Paczos <lukasz.paczos@mapbox.com>
…/LocationComponentOptions.java

Co-Authored-By: Łukasz Paczos <lukasz.paczos@mapbox.com>
…/LocationComponentOptions.java

Co-Authored-By: Łukasz Paczos <lukasz.paczos@mapbox.com>
…/LocationComponentOptions.java

Co-Authored-By: Łukasz Paczos <lukasz.paczos@mapbox.com>
@langsmith
Copy link
Contributor Author

incompatibility doc entries added ✔️

Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @langsmith!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature 🍏 New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants