diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java index 4b46e4057..48e3bdaba 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java @@ -21,7 +21,6 @@ import java.util.Set; */ public class AttributionParser { - private static final String IMPROVE_THIS_MAP = "Improve this map"; private final WeakReference context; private final Set attributions = new LinkedHashSet<>(); private final String attributionData; @@ -120,16 +119,6 @@ public class AttributionParser { return isValidForImproveThisMap(url) && isValidForMapbox(url); } - /** - * Invoked to validate if an anchor is equal to Improve this map coming from tilesets. - * - * @param anchor the anchor to be validated - * @return if the url is valid - */ - private boolean isImproveThisMapAnchor(String anchor) { - return anchor.equals(IMPROVE_THIS_MAP); - } - /** * Invoked to validate if an url is valid for the improve map configuration. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java index 32f3840f3..c4d681511 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java @@ -10,6 +10,7 @@ import android.util.Log; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; +import androidx.core.os.BuildCompat; import java.util.ArrayList; import java.util.Arrays; @@ -55,7 +56,7 @@ public class PermissionsManager { } public static boolean isBackgroundLocationPermissionGranted(Context context) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + if (Build.VERSION.SDK_INT >= 29) { return isPermissionGranted(context, BACKGROUND_LOCATION_PERMISSION); } @@ -106,7 +107,7 @@ public class PermissionsManager { permissions.add(COARSE_LOCATION_PERMISSION); } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && requestBackgroundLocation) { + if (Build.VERSION.SDK_INT >= 29 && requestBackgroundLocation) { permissions.add(BACKGROUND_LOCATION_PERMISSION); } diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/attribution/AttributionParseTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/attribution/AttributionParseTest.java index b72e85270..3ff11cfd4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/attribution/AttributionParseTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/attribution/AttributionParseTest.java @@ -12,8 +12,8 @@ import static junit.framework.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) public class AttributionParseTest { - private static final String STREETS_ATTRIBUTION = "© Mapbox © OpenStreetMap Improve this map\n"; - private static final String SATELLITE_ATTRIBUTION = "© Mapbox © OpenStreetMap Improve this map © DigitalGlobe\n"; + private static final String STREETS_ATTRIBUTION = "© Mapbox © OpenStreetMap \n"; + private static final String SATELLITE_ATTRIBUTION = "© Mapbox © OpenStreetMap © DigitalGlobe\n"; @Test public void testParseAttributionStringSatellite() throws Exception { @@ -21,39 +21,6 @@ public class AttributionParseTest { .withAttributionData(SATELLITE_ATTRIBUTION) .build(); - Set attributionList = attributionParser.getAttributions(); - assertEquals("Size of list should match", 4, attributionList.size()); - - int counter = 0; - for (Attribution attribution : attributionList) { - switch (counter) { - case 0: - assertEquals("URL mapbox should match", "https://www.mapbox.com/about/maps/", attribution.getUrl()); - assertEquals("Title mapbox should match", "© Mapbox", attribution.getTitle()); - break; - case 1: - assertEquals("URL openstreetmap should match", "http://www.openstreetmap.org/about/", attribution.getUrl()); - assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle()); - break; - case 2: - assertEquals("URL improve map should match", "https://apps.mapbox.com/feedback/", attribution.getUrl()); - assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle()); - break; - case 3: - assertEquals("URL digital globe should match", "https://www.digitalglobe.com/", attribution.getUrl()); - assertEquals("Title digital globe should match", "© DigitalGlobe", attribution.getTitle()); - break; - } - counter++; - } - } - - @Test - public void testParseAttributionStringStreets() throws Exception { - AttributionParser attributionParser = new AttributionParser.Options(RuntimeEnvironment.application) - .withAttributionData(STREETS_ATTRIBUTION) - .build(); - Set attributionList = attributionParser.getAttributions(); assertEquals("Size of list should match", 3, attributionList.size()); @@ -69,8 +36,33 @@ public class AttributionParseTest { assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle()); break; case 2: - assertEquals("URL improve map should match", "https://apps.mapbox.com/feedback/", attribution.getUrl()); - assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle()); + assertEquals("URL digital globe should match", "https://www.digitalglobe.com/", attribution.getUrl()); + assertEquals("Title digital globe should match", "© DigitalGlobe", attribution.getTitle()); + break; + } + counter++; + } + } + + @Test + public void testParseAttributionStringStreets() throws Exception { + AttributionParser attributionParser = new AttributionParser.Options(RuntimeEnvironment.application) + .withAttributionData(STREETS_ATTRIBUTION) + .build(); + + Set attributionList = attributionParser.getAttributions(); + assertEquals("Size of list should match", 2, attributionList.size()); + + int counter = 0; + for (Attribution attribution : attributionList) { + switch (counter) { + case 0: + assertEquals("URL mapbox should match", "https://www.mapbox.com/about/maps/", attribution.getUrl()); + assertEquals("Title mapbox should match", "© Mapbox", attribution.getTitle()); + break; + case 1: + assertEquals("URL openstreetmap should match", "http://www.openstreetmap.org/about/", attribution.getUrl()); + assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle()); break; } counter++; @@ -85,7 +77,7 @@ public class AttributionParseTest { .build(); Set attributionList = attributionParser.getAttributions(); - assertEquals("Size of list should match", 2, attributionList.size()); + assertEquals("Size of list should match", 1, attributionList.size()); int counter = 0; for (Attribution attribution : attributionList) { @@ -94,10 +86,6 @@ public class AttributionParseTest { assertEquals("URL openstreetmap should match", "http://www.openstreetmap.org/about/", attribution.getUrl()); assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle()); break; - case 1: - assertEquals("URL improve map should match", "https://apps.mapbox.com/feedback/", attribution.getUrl()); - assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle()); - break; } counter++; } @@ -109,7 +97,7 @@ public class AttributionParseTest { .withAttributionData(new String[] {STREETS_ATTRIBUTION, "", SATELLITE_ATTRIBUTION}) .build(); Set attributionList = attributionParser.getAttributions(); - assertEquals("Size of list should match", 4, attributionList.size()); + assertEquals("Size of list should match", 3, attributionList.size()); int counter = 0; for (Attribution attribution : attributionList) { @@ -123,10 +111,6 @@ public class AttributionParseTest { assertEquals("Title openstreetmap should match", "© OpenStreetMap", attribution.getTitle()); break; case 2: - assertEquals("URL improve map should match", "https://apps.mapbox.com/feedback/", attribution.getUrl()); - assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle()); - break; - case 3: assertEquals("URL digital globe should match", "https://www.digitalglobe.com/", attribution.getUrl()); assertEquals("Title digital globe should match", "© DigitalGlobe", attribution.getTitle()); break; @@ -171,7 +155,7 @@ public class AttributionParseTest { .withCopyrightSign(false) .build(); Set attributionList = attributionParser.getAttributions(); - assertEquals("Size of list should match", 4, attributionList.size()); + assertEquals("Size of list should match", 3, attributionList.size()); int counter = 0; for (Attribution attribution : attributionList) { @@ -185,10 +169,6 @@ public class AttributionParseTest { assertEquals("Title openstreetmap should match", "OpenStreetMap", attribution.getTitle()); break; case 2: - assertEquals("URL improve map should match", "https://apps.mapbox.com/feedback/", attribution.getUrl()); - assertEquals("Title improve map should match", "Improve This Map", attribution.getTitle()); - break; - case 3: assertEquals("URL digital globe should match", "https://www.digitalglobe.com/", attribution.getUrl()); assertEquals("Title digital globe should match", "DigitalGlobe", attribution.getTitle()); break; @@ -304,19 +284,5 @@ public class AttributionParseTest { attributionParser.createAttributionString(true) ); } - - @Test - public void testWithImproveThisMapString() throws Exception { - AttributionParser attributionParser = new AttributionParser.Options(RuntimeEnvironment.application) - .withAttributionData(STREETS_ATTRIBUTION, "blabla", "") - .withImproveMap(true) - .withCopyrightSign(false) - .build(); - - assertEquals( - "Attribution string should match", - "© Mapbox / OSM / Improve This Map", - attributionParser.createAttributionString(true) - ); - } } + diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/http/HttpRequestUrlTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/http/HttpRequestUrlTest.kt index 3450e5c83..3a48591aa 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/http/HttpRequestUrlTest.kt +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/http/HttpRequestUrlTest.kt @@ -39,20 +39,6 @@ class HttpRequestUrlTest { assertEquals(expected, actual) } - @Test - fun testOnlineMapboxCom() { - val expected = "http://mapbox.com/path/of/no/return.pbf?sku=foobar" - val actual = HttpRequestUrl.buildResourceUrl("mapbox.com", "http://mapbox.com/path/of/no/return.pbf", 0, false) - assertEquals(expected, actual) - } - - @Test - fun testOnlineMapboxCn() { - val expected = "http://mapbox.cn/path/of/no/return.pbf?sku=foobar" - val actual = HttpRequestUrl.buildResourceUrl("mapbox.cn", "http://mapbox.cn/path/of/no/return.pbf", 0, false) - assertEquals(expected, actual) - } - @Test fun testOnlineInvalidHost() { val expected = "http://foobar.com/path/of/no/return.pbf" diff --git a/platform/android/docker/android-base b/platform/android/docker/android-base index 89423ca53..2889a38bc 100644 --- a/platform/android/docker/android-base +++ b/platform/android/docker/android-base @@ -21,7 +21,7 @@ RUN set -eu \ && apt-get update \ && add-apt-repository -y ppa:git-core/ppa \ && apt-get update \ - && apt-get -y install git curl make python3 python3-pip zip unzip ccache openjdk-9-jdk-headless apt-transport-https \ + && apt-get -y install git curl make python3 python3-pip zip unzip ccache openjdk-8-jdk-headless apt-transport-https \ && update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \ && rm -rf /var/lib/apt/lists/* diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 25538693e..14ddcacc3 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -2,8 +2,8 @@ ext { androidVersions = [ minSdkVersion : 14, - targetSdkVersion : 29, - compileSdkVersion: 29, + targetSdkVersion : 28, + compileSdkVersion: 28, ] versions = [