diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry')
5 files changed, 16 insertions, 359 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapClickEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapClickEvent.java deleted file mode 100644 index c9f7f42ed2..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapClickEvent.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; - -/** - * Event that represents users' gestures on map, for the details of gestures, - * please refer to {@link com.mapbox.mapboxsdk.constants.TelemetryConstants} - */ -@SuppressLint("ParcelCreator") -class MapClickEvent extends MapBaseEvent { - private static final String EVENT_NAME = "map.click"; - private final String gesture; - private final String cellularNetworkType; - private final String carrier; - private final String orientation; - private final double lat; - private final double lng; - private final double zoom; - private final int batteryLevel; - private final boolean pluggedIn; - private final boolean wifi; - - MapClickEvent(PhoneState phoneState, MapState mapState) { - super(phoneState); - this.gesture = mapState.getGesture(); - this.lat = mapState.getLatitude(); - this.lng = mapState.getLongitude(); - this.zoom = mapState.getZoom(); - this.batteryLevel = phoneState.getBatteryLevel(); - this.pluggedIn = phoneState.isPluggedIn(); - this.cellularNetworkType = phoneState.getCellularNetworkType(); - this.orientation = phoneState.getOrientation(); - this.carrier = phoneState.getCarrier(); - this.wifi = phoneState.isWifi(); - } - - @Override - String getEventName() { - return EVENT_NAME; - } - - String getGesture() { - return gesture; - } - - String getCellularNetworkType() { - return cellularNetworkType; - } - - String getCarrier() { - return carrier; - } - - String getOrientation() { - return orientation; - } - - double getLat() { - return lat; - } - - double getLng() { - return lng; - } - - double getZoom() { - return zoom; - } - - int getBatteryLevel() { - return batteryLevel; - } - - boolean isPluggedIn() { - return pluggedIn; - } - - boolean isWifi() { - return wifi; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - MapClickEvent that = (MapClickEvent) o; - - if (Double.compare(that.lat, lat) != 0) { - return false; - } - if (Double.compare(that.lng, lng) != 0) { - return false; - } - if (Double.compare(that.zoom, zoom) != 0) { - return false; - } - if (batteryLevel != that.batteryLevel) { - return false; - } - if (pluggedIn != that.pluggedIn) { - return false; - } - if (wifi != that.wifi) { - return false; - } - if (gesture != null ? !gesture.equals(that.gesture) : that.gesture != null) { - return false; - } - if (cellularNetworkType != null ? !cellularNetworkType.equals(that.cellularNetworkType) : - that.cellularNetworkType != null) { - return false; - } - if (carrier != null ? !carrier.equals(that.carrier) : that.carrier != null) { - return false; - } - return orientation != null ? orientation.equals(that.orientation) : that.orientation == null; - } - - @Override - public int hashCode() { - int result; - long temp; - result = gesture != null ? gesture.hashCode() : 0; - result = 31 * result + (cellularNetworkType != null ? cellularNetworkType.hashCode() : 0); - result = 31 * result + (carrier != null ? carrier.hashCode() : 0); - result = 31 * result + (orientation != null ? orientation.hashCode() : 0); - temp = Double.doubleToLongBits(lat); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(lng); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(zoom); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + batteryLevel; - result = 31 * result + (pluggedIn ? 1 : 0); - result = 31 * result + (wifi ? 1 : 0); - return result; - } - - @Override - public String toString() { - return "MapClickEvent{" - + ", gesture='" + gesture + '\'' - + ", cellularNetworkType='" + cellularNetworkType + '\'' - + ", carrier='" + carrier + '\'' - + ", orientation='" + orientation + '\'' - + ", lat=" + lat - + ", lng=" + lng - + ", zoom=" + zoom - + ", batteryLevel=" + batteryLevel - + ", pluggedIn=" + pluggedIn - + ", wifi=" + wifi - + '}'; - } - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapDragendEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapDragendEvent.java deleted file mode 100644 index 9556a9a524..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapDragendEvent.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; - -/** - * When user drag map should send this event. - */ -@SuppressLint("ParcelCreator") -class MapDragendEvent extends MapBaseEvent { - private static final String EVENT_NAME = "map.dragend"; - private final String orientation; - private final String carrier; - private final String cellularNetworkType; - private final int batteryLevel; - private final double lat; - private final double lng; - private final double zoom; - private final boolean pluggedIn; - private final boolean wifi; - - MapDragendEvent(PhoneState phoneState, MapState mapState) { - super(phoneState); - this.lat = mapState.getLatitude(); - this.lng = mapState.getLongitude(); - this.zoom = mapState.getZoom(); - this.batteryLevel = phoneState.getBatteryLevel(); - this.pluggedIn = phoneState.isPluggedIn(); - this.cellularNetworkType = phoneState.getCellularNetworkType(); - this.wifi = phoneState.isWifi(); - this.orientation = phoneState.getOrientation(); - this.carrier = phoneState.getCarrier(); - } - - @Override - String getEventName() { - return EVENT_NAME; - } - - String getOrientation() { - return orientation; - } - - String getCarrier() { - return carrier; - } - - String getCellularNetworkType() { - return cellularNetworkType; - } - - int getBatteryLevel() { - return batteryLevel; - } - - double getLat() { - return lat; - } - - double getLng() { - return lng; - } - - double getZoom() { - return zoom; - } - - boolean isPluggedIn() { - return pluggedIn; - } - - boolean isWifi() { - return wifi; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - MapDragendEvent that = (MapDragendEvent) o; - - if (batteryLevel != that.batteryLevel) { - return false; - } - if (Double.compare(that.lat, lat) != 0) { - return false; - } - if (Double.compare(that.lng, lng) != 0) { - return false; - } - if (Double.compare(that.zoom, zoom) != 0) { - return false; - } - if (pluggedIn != that.pluggedIn) { - return false; - } - if (wifi != that.wifi) { - return false; - } - if (orientation != null ? !orientation.equals(that.orientation) : that.orientation != null) { - return false; - } - if (carrier != null ? !carrier.equals(that.carrier) : that.carrier != null) { - return false; - } - return cellularNetworkType != null ? cellularNetworkType.equals(that.cellularNetworkType) : - that.cellularNetworkType == null; - } - - @Override - public int hashCode() { - int result; - long temp; - result = orientation != null ? orientation.hashCode() : 0; - result = 31 * result + (carrier != null ? carrier.hashCode() : 0); - result = 31 * result + (cellularNetworkType != null ? cellularNetworkType.hashCode() : 0); - result = 31 * result + batteryLevel; - temp = Double.doubleToLongBits(lat); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(lng); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(zoom); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + (pluggedIn ? 1 : 0); - result = 31 * result + (wifi ? 1 : 0); - return result; - } - - @Override - public String toString() { - return "MapDragendEvent{" - + ", orientation='" + orientation + '\'' - + ", carrier='" + carrier + '\'' - + ", cellularNetworkType='" + cellularNetworkType + '\'' - + ", batteryLevel=" + batteryLevel - + ", lat=" + lat - + ", lng=" + lng - + ", zoom=" + zoom - + ", pluggedIn=" + pluggedIn - + ", wifi=" + wifi - + '}'; - } -}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java index 88e41943fa..14b5c6231f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java @@ -49,17 +49,9 @@ class MapEventFactory { return offlineEvent; } - static MapClickEvent buildMapClickEvent(@NonNull PhoneState phoneState, @NonNull MapState mapState) { - return new MapClickEvent(phoneState, mapState); - } - - static MapDragendEvent buildMapDragendEvent(@NonNull PhoneState phoneState, @NonNull MapState mapState) { - return new MapDragendEvent(phoneState, mapState); - } - static PerformanceEvent buildPerformanceEvent(@NonNull PhoneState phoneState, @NonNull String sessionId, @NonNull Bundle data) { return new PerformanceEvent(phoneState, sessionId, data); } -} +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapState.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapState.java deleted file mode 100644 index ab75ffa994..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapState.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.support.annotation.FloatRange; - -import com.mapbox.mapboxsdk.constants.MapboxConstants; - -public class MapState { - private double latitude; - private double longitude; - private double zoom; - private String gesture; - - MapState(double latitude, double longitude, @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - this.latitude = latitude; - this.longitude = longitude; - this.zoom = zoom; - } - - String getGesture() { - return gesture; - } - - void setGesture(String gesture) { - this.gesture = gesture; - } - - double getLatitude() { - return latitude; - } - - double getLongitude() { - return longitude; - } - - double getZoom() { - return zoom; - } -} - diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java index 2b1dace932..af2e0ad749 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java @@ -55,18 +55,20 @@ public class TelemetryImpl implements TelemetryDefinition { * @param latitude the latitude value of the gesture focal point * @param longitude the longitude value of the gesture focal point * @param zoom current zoom of the map + * @deprecated since 7.5.0, this event is no longer supported */ + @Deprecated @Override public void onGestureInteraction(String eventType, double latitude, double longitude, @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - MapState state = new MapState(latitude, longitude, zoom); - state.setGesture(eventType); - telemetry.push(MapEventFactory.buildMapClickEvent(new PhoneState(appContext), state)); + //no-op } /** * Set the end-user selected state to participate or opt-out in telemetry collection. + * + * @param enabledTelemetry true if enabled, false otherwise */ @Override public void setUserTelemetryRequestState(boolean enabledTelemetry) { @@ -100,6 +102,11 @@ public class TelemetryImpl implements TelemetryDefinition { return telemetry.updateSessionIdRotationInterval(new SessionInterval(interval)); } + /** + * Register an offline region creation event. + * + * @param offlineDefinition the offline region definition + */ @Override public void onCreateOfflineRegion(@NonNull OfflineRegionDefinition offlineDefinition) { telemetry.push(MapEventFactory.buildOfflineDownloadStartEvent(new PhoneState(appContext), @@ -110,6 +117,11 @@ public class TelemetryImpl implements TelemetryDefinition { ); } + /** + * Register a performance event + * + * @param data performance event data + */ @Override public void onPerformanceEvent(Bundle data) { if (data == null) { |