From 79366845202714af991eea8e2006d2d57fa6dc7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Pluta?= Date: Fri, 5 Apr 2019 23:18:16 +0200 Subject: [PATCH] 10: Update UsesSdkPlugin to check maxSdkVersion definition --- src/main/java/com/bartek/esa/core/plugin/UsesSdkPlugin.java | 4 ++++ src/main/resources/description.properties | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/com/bartek/esa/core/plugin/UsesSdkPlugin.java b/src/main/java/com/bartek/esa/core/plugin/UsesSdkPlugin.java index a8704cb..9ac43e9 100644 --- a/src/main/java/com/bartek/esa/core/plugin/UsesSdkPlugin.java +++ b/src/main/java/com/bartek/esa/core/plugin/UsesSdkPlugin.java @@ -24,6 +24,10 @@ public class UsesSdkPlugin extends AndroidManifestPlugin { if(usesSdkNode.getAttributes().getNamedItem("android:minSdkVersion") == null) { addIssue(Severity.ERROR, ".USES_SDK.NO_MIN_SDK_VERSION", null, null); } + + Optional.ofNullable(usesSdkNode.getAttributes().getNamedItem("android:maxSdkVersion")).ifPresent(maxSdkVersion -> + addIssue(Severity.ERROR, ".USES_SDK.MAX_SDK_VERSION", null, maxSdkVersion.toString()) + ); }, () -> addIssue(Severity.ERROR, ".NO_USES_SDK", null, null)); } } diff --git a/src/main/resources/description.properties b/src/main/resources/description.properties index bce4886..87a867b 100644 --- a/src/main/resources/description.properties +++ b/src/main/resources/description.properties @@ -65,6 +65,12 @@ com.bartek.esa.core.plugin.UsesSdkPlugin.USES_SDK.NO_MIN_SDK_VERSION=There is no In order to use this tool, minimal SDK version should be provided as the attribute of element.\n\ For example: +com.bartek.esa.core.plugin.UsesSdkPlugin.USES_SDK.MAX_SDK_VERSION=Application defines an upper limit for API version.\n\ + The android:maxSdkVersion is defined in AndroidManifest.xml.\n\ + There is no need to limit available platforms for application.\n\ + Furthermore it can cause unexpected application uninstall\n\ + on upgrading Android version (along with API which can exceed defined maximal API version). + com.bartek.esa.core.plugin.CipherInstancePlugin=Not fully-qualified algorithm name provided in Cipher.getInstance() method.\n\ Passing a shortcut instead of fully-qualified algorithm name in Cipher.getInstance() method is not portable across providers\n\ and can impact the system low secure than intended to be.\n\