-
Notifications
You must be signed in to change notification settings - Fork 118
Adding pulsing circle to LocationComponent options #172
Adding pulsing circle to LocationComponent options #172
Conversation
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 ( 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. |
@Chaoba Would you be able to have a look at it? |
5808c0f
to
c6e3460
Compare
@langsmith I have changed |
There was a problem hiding this 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.
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinator.java
Outdated
Show resolved
Hide resolved
682a0b5
to
cc91ef1
Compare
34e6599
to
47e961b
Compare
Ok @Chaoba @LukasPaczos , this is good for another round of review 🙇 |
cc @galinelle as FYI about this being another type of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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:
Second is a leak:
https://gist.github.com/LukasPaczos/e588678654fec0896f059903d5cc818c
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/PulseMode.java
Outdated
Show resolved
Hide resolved
.../java/com/mapbox/mapboxsdk/testapp/activity/location/BasicLocationPulsingCircleActivity.java
Outdated
Show resolved
Hide resolved
40767b5
to
0d2ec13
Compare
This is now the only remaining thing in @LukasPaczos' comments above, that hasn't been fixed |
f099ffd
to
5ccf6d2
Compare
@langsmith how is this going? Are you blocked on any particular issue? |
if (locationComponent != null && locationComponent.isLocationComponentActivated()) { | ||
enablePulsing = locationComponent.isLocationComponentEnabled(); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Lines 729 to 731 in e7848ab
if (options.pulseEnabled()) { | |
startPulsingLocationCircle(); | |
} else { |
isEnabled()
is in reference to the overall LocationComponent
:
Lines 742 to 745 in e7848ab
if (isEnabled) { | |
locationAnimatorCoordinator.startLocationComponentCirclePulsing(options); | |
locationLayerController.adjustPulsingCircleLayerVisibility(true); | |
} |
There was a problem hiding this 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.
5ccf6d2
to
02e5dc0
Compare
f2fa043
to
dfd9c63
Compare
I still get the leak on my physical device 🤷 Maybe it's device specific? Will see what happens on an emulated device. |
There was a problem hiding this 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:
Line 138 in 5cee66a
public boolean useSpecializedLocationLayer() { |
and
Line 253 in 5cee66a
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.
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
Outdated
Show resolved
Hide resolved
MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
Show resolved
Hide resolved
…/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>
incompatibility doc entries added ✔️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @langsmith!
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).