1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-18 20:50:10 +01:00

update: do not set targetSdkVersion if the APK is missing it

699b3e4c69 got it wrong for targetSdkVersion.
Also, one confusing thing is that aapt outputs "sdkVersion: '3'" for
com.politedroid_3.apk but no "sdkVersion:" for no.min.target.sdk_987.apk.
F-Droid never really supported running on android-1 or android-2, so it
seems pointless to debug support for them.
This commit is contained in:
Hans-Christoph Steiner 2018-10-10 12:00:41 +02:00
parent 2a9bc448ee
commit 8b251da79f
8 changed files with 78 additions and 8 deletions

View File

@ -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):

View File

@ -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="

View File

@ -0,0 +1,3 @@
Categories: [Development]
Name: No minSdkVersion or targetSdkVersion
Summary: An APK without any <uses-sdk> block in AndroidManifest.xml

View File

@ -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 <uses-sdk> 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,

View File

@ -95,6 +95,34 @@
<added>2016-03-10</added>
</package>
</application>
<application id="no.min.target.sdk">
<id>no.min.target.sdk</id>
<added>2018-10-10</added>
<lastupdated>2018-10-10</lastupdated>
<name>No minSdkVersion or targetSdkVersion</name>
<summary>An APK without any &lt;uses-sdk&gt; block in AndroidManifest.xml</summary>
<icon>no.min.target.sdk.987.png</icon>
<desc>&lt;p&gt;No description available&lt;/p&gt;</desc>
<license>Unknown</license>
<categories>Development</categories>
<category>Development</category>
<web></web>
<source></source>
<tracker></tracker>
<marketversion></marketversion>
<marketvercode>987</marketvercode>
<package>
<version>1.2-fake</version>
<versioncode>987</versioncode>
<apkname>no.min.target.sdk_987.apk</apkname>
<hash type="sha256">e2e1dc1d550df2b5bc383860139207258645b5540abeccd305ed8b2cb6459d2c</hash>
<size>14102</size>
<sdkver>3</sdkver>
<added>2018-10-10</added>
<sig>b4964fd759edaa54e65bb476d0276880</sig>
<permissions>READ_EXTERNAL_STORAGE,READ_PHONE_STATE,WRITE_EXTERNAL_STORAGE</permissions>
</package>
</application>
<application id="obb.main.oldversion">
<id>obb.main.oldversion</id>
<added>2013-12-31</added>
@ -269,7 +297,6 @@
<hash type="sha256">c809bdff83715fbf919f3840ee09869b038e209378b906e135ee40d3f0e1f075</hash>
<size>18489</size>
<sdkver>3</sdkver>
<targetSdkVersion>3</targetSdkVersion>
<added>2017-06-23</added>
<sig>b4964fd759edaa54e65bb476d0276880</sig>
<permissions>READ_CALENDAR,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,RECEIVE_BOOT_COMPLETED,WRITE_EXTERNAL_STORAGE</permissions>
@ -281,7 +308,6 @@
<hash type="sha256">665d03d61ebc642289fda697f71a59305b0202b16cafc5ffdae91cbe91f0b25d</hash>
<size>17552</size>
<sdkver>3</sdkver>
<targetSdkVersion>3</targetSdkVersion>
<added>2017-06-23</added>
<sig>b4964fd759edaa54e65bb476d0276880</sig>
<permissions>READ_CALENDAR,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,RECEIVE_BOOT_COMPLETED,WRITE_EXTERNAL_STORAGE</permissions>

Binary file not shown.

View File

@ -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

View File

@ -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')