Monkey crashes (#10440)

* [android] - avoid null map from trackballevent

* [android] - fixup animated marker test activity from monkey runs

* [android] - harden NativeMapView OnMapChangeListener

* [android] - harden against destroyed wrapper activity while moving touch pointers

* [android] - harden bulk marker activity for monkey runner

* [android] - harden scale end gesture event for null velocity tracker

* [android] - invalid mapboxMap invocation

* [android] - reset test setup
This commit is contained in:
Tobrun
2017-11-10 16:33:51 +01:00
committed by GitHub
parent 225fba8a0a
commit a47f8245da
5 changed files with 35 additions and 18 deletions

View File

@@ -235,8 +235,10 @@ final class MapGestureDetector {
velocityTracker = null;
break;
case MotionEvent.ACTION_MOVE:
velocityTracker.addMovement(event);
velocityTracker.computeCurrentVelocity(1000);
if (velocityTracker != null) {
velocityTracker.addMovement(event);
velocityTracker.computeCurrentVelocity(1000);
}
break;
}
@@ -551,6 +553,11 @@ final class MapGestureDetector {
// Called when fingers leave screen
@Override
public void onScaleEnd(final ScaleGestureDetector detector) {
if (velocityTracker == null) {
return;
}
if (rotateGestureOccurred || quickZoom) {
reset();
return;

View File

@@ -1082,7 +1082,9 @@ final class NativeMapView {
//
void addOnMapChangedListener(@NonNull MapView.OnMapChangedListener listener) {
mapView.addOnMapChangedListener(listener);
if (mapView != null) {
mapView.addOnMapChangedListener(listener);
}
}
void removeOnMapChangedListener(@NonNull MapView.OnMapChangedListener listener) {

View File

@@ -238,16 +238,18 @@ final class Transform implements MapView.OnMapChangedListener {
}
void setZoom(double zoom, @NonNull PointF focalPoint, long duration) {
mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
public void onMapChanged(int change) {
if (change == MapView.REGION_DID_CHANGE_ANIMATED) {
cameraChangeDispatcher.onCameraIdle();
mapView.removeOnMapChangedListener(this);
if (mapView != null) {
mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
public void onMapChanged(int change) {
if (change == MapView.REGION_DID_CHANGE_ANIMATED) {
cameraChangeDispatcher.onCameraIdle();
mapView.removeOnMapChangedListener(this);
}
}
}
});
mapView.setZoom(zoom, focalPoint, duration);
});
mapView.setZoom(zoom, focalPoint, duration);
}
}
// Direction