diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 98eadfbe..ff44eeb9 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -1090,8 +1090,6 @@ def scan_apk(apk_file): if 'minSdkVersion' not in apk: logging.warning("No SDK version information found in {0}".format(apk_file)) apk['minSdkVersion'] = 3 # aapt defaults to 3 as the min - if 'targetSdkVersion' not in apk: - apk['targetSdkVersion'] = apk['minSdkVersion'] # Check for known vulnerabilities if has_known_vulnerability(apk_file): diff --git a/tests/config.py b/tests/config.py index 16917a64..6ee05902 100644 --- a/tests/config.py +++ b/tests/config.py @@ -17,6 +17,8 @@ archive_description = """ The repository of older versions of applications from the main demo repository. """ +make_current_version_link = False + repo_keyalias = "sova" keystore = "keystore.jks" keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=" diff --git a/tests/metadata/no.min.target.sdk.yml b/tests/metadata/no.min.target.sdk.yml new file mode 100644 index 00000000..4a7cdb43 --- /dev/null +++ b/tests/metadata/no.min.target.sdk.yml @@ -0,0 +1,3 @@ +Categories: [Development] +Name: No minSdkVersion or targetSdkVersion +Summary: An APK without any block in AndroidManifest.xml diff --git a/tests/repo/index-v1.json b/tests/repo/index-v1.json index 90c6f0c6..d0b41ec4 100644 --- a/tests/repo/index-v1.json +++ b/tests/repo/index-v1.json @@ -72,6 +72,19 @@ "packageName": "fake.ota.update", "lastUpdated": 1457568000000 }, + { + "categories": [ + "Development" + ], + "suggestedVersionCode": "987", + "license": "Unknown", + "name": "No minSdkVersion or targetSdkVersion", + "summary": "An APK without any block in AndroidManifest.xml", + "added": 1539129600000, + "icon": "no.min.target.sdk.987.png", + "packageName": "no.min.target.sdk", + "lastUpdated": 1539129600000 + }, { "bitcoin": "1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk", "categories": [ @@ -248,7 +261,6 @@ "sig": "b4964fd759edaa54e65bb476d0276880", "signer": "32a23624c201b949f085996ba5ed53d40f703aca4989476949cae891022e0ed6", "size": 18489, - "targetSdkVersion": "3", "uses-permission": [ [ "android.permission.READ_CALENDAR", @@ -290,7 +302,6 @@ "sig": "b4964fd759edaa54e65bb476d0276880", "signer": "32a23624c201b949f085996ba5ed53d40f703aca4989476949cae891022e0ed6", "size": 17552, - "targetSdkVersion": "3", "uses-permission": [ [ "android.permission.READ_CALENDAR", @@ -400,6 +411,35 @@ "versionName": "0.1" } ], + "no.min.target.sdk": [ + { + "added": 1539129600000, + "apkName": "no.min.target.sdk_987.apk", + "hash": "e2e1dc1d550df2b5bc383860139207258645b5540abeccd305ed8b2cb6459d2c", + "hashType": "sha256", + "minSdkVersion": 3, + "packageName": "no.min.target.sdk", + "sig": "b4964fd759edaa54e65bb476d0276880", + "signer": "32a23624c201b949f085996ba5ed53d40f703aca4989476949cae891022e0ed6", + "size": 14102, + "uses-permission": [ + [ + "android.permission.WRITE_EXTERNAL_STORAGE", + null + ], + [ + "android.permission.READ_PHONE_STATE", + null + ], + [ + "android.permission.READ_EXTERNAL_STORAGE", + null + ] + ], + "versionCode": 987, + "versionName": "1.2-fake" + } + ], "obb.main.oldversion": [ { "added": 1388448000000, diff --git a/tests/repo/index.xml b/tests/repo/index.xml index 69c6cd89..b82fd661 100644 --- a/tests/repo/index.xml +++ b/tests/repo/index.xml @@ -95,6 +95,34 @@ 2016-03-10 + + no.min.target.sdk + 2018-10-10 + 2018-10-10 + No minSdkVersion or targetSdkVersion + An APK without any <uses-sdk> block in AndroidManifest.xml + no.min.target.sdk.987.png + <p>No description available</p> + Unknown + Development + Development + + + + + 987 + + 1.2-fake + 987 + no.min.target.sdk_987.apk + e2e1dc1d550df2b5bc383860139207258645b5540abeccd305ed8b2cb6459d2c + 14102 + 3 + 2018-10-10 + b4964fd759edaa54e65bb476d0276880 + READ_EXTERNAL_STORAGE,READ_PHONE_STATE,WRITE_EXTERNAL_STORAGE + + obb.main.oldversion 2013-12-31 @@ -269,7 +297,6 @@ c809bdff83715fbf919f3840ee09869b038e209378b906e135ee40d3f0e1f075 18489 3 - 3 2017-06-23 b4964fd759edaa54e65bb476d0276880 READ_CALENDAR,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,RECEIVE_BOOT_COMPLETED,WRITE_EXTERNAL_STORAGE @@ -281,7 +308,6 @@ 665d03d61ebc642289fda697f71a59305b0202b16cafc5ffdae91cbe91f0b25d 17552 3 - 3 2017-06-23 b4964fd759edaa54e65bb476d0276880 READ_CALENDAR,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,RECEIVE_BOOT_COMPLETED,WRITE_EXTERNAL_STORAGE diff --git a/tests/repo/no.min.target.sdk_987.apk b/tests/repo/no.min.target.sdk_987.apk new file mode 100644 index 00000000..27f8de12 Binary files /dev/null and b/tests/repo/no.min.target.sdk_987.apk differ diff --git a/tests/stats/known_apks.txt b/tests/stats/known_apks.txt index 6e14faff..0fa1f1b6 100644 --- a/tests/stats/known_apks.txt +++ b/tests/stats/known_apks.txt @@ -4,6 +4,7 @@ com.politedroid_5.apk com.politedroid 2017-06-23 com.politedroid_6.apk com.politedroid 2017-06-23 duplicate.permisssions_9999999.apk duplicate.permisssions 2017-12-22 fake.ota.update_1234.zip fake.ota.update 2016-03-10 +no.min.target.sdk_987.apk no.min.target.sdk 2018-10-10 obb.main.oldversion_1444412523.apk obb.main.oldversion 2013-12-31 obb.main.twoversions_1101613.apk obb.main.twoversions 2015-10-12 obb.main.twoversions_1101615.apk obb.main.twoversions 2016-01-01 diff --git a/tests/update.TestCase b/tests/update.TestCase index f13d1820..84600bfe 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -259,9 +259,9 @@ class UpdateTest(unittest.TestCase): self.assertEqual(apk['packageName'], 'com.politedroid') self.assertEqual(apk['versionCode'], 3) self.assertEqual(apk['minSdkVersion'], '3') - self.assertEqual(apk['targetSdkVersion'], '3') + self.assertIsNone(apk.get('targetSdkVersion')) self.assertFalse('maxSdkVersion' in apk) - apk = apks[6] + apk = apks[7] self.assertEqual(apk['packageName'], 'obb.main.oldversion') self.assertEqual(apk['versionCode'], 1444412523) self.assertEqual(apk['minSdkVersion'], '4')