mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
Merge branch 'master' into 'master'
update: handle AndroidManifest XML namespace named other than 'android' See merge request fdroid/fdroidserver!481
This commit is contained in:
commit
4b788b3b09
@ -1242,10 +1242,13 @@ def scan_apk_androguard(apk, apkfile):
|
||||
apk['nativecode'].extend(sorted(list(arch)))
|
||||
|
||||
xml = apkobject.get_android_manifest_xml()
|
||||
xmlns = xml.nsmap.get('android')
|
||||
if not xmlns:
|
||||
xmlns = 'http://schemas.android.com/apk/res/android'
|
||||
|
||||
for item in xml.findall('uses-permission'):
|
||||
name = str(item.attrib['{' + xml.nsmap['android'] + '}name'])
|
||||
maxSdkVersion = item.attrib.get('{' + xml.nsmap['android'] + '}maxSdkVersion')
|
||||
name = str(item.attrib['{' + xmlns + '}name'])
|
||||
maxSdkVersion = item.attrib.get('{' + xmlns + '}maxSdkVersion')
|
||||
maxSdkVersion = int(maxSdkVersion) if maxSdkVersion else None
|
||||
permission = UsesPermission(
|
||||
name,
|
||||
@ -1260,8 +1263,8 @@ def scan_apk_androguard(apk, apkfile):
|
||||
apk['uses-permission'].append(permission)
|
||||
|
||||
for item in xml.findall('uses-permission-sdk-23'):
|
||||
name = str(item.attrib['{' + xml.nsmap['android'] + '}name'])
|
||||
maxSdkVersion = item.attrib.get('{' + xml.nsmap['android'] + '}maxSdkVersion')
|
||||
name = str(item.attrib['{' + xmlns + '}name'])
|
||||
maxSdkVersion = item.attrib.get('{' + xmlns + '}maxSdkVersion')
|
||||
maxSdkVersion = int(maxSdkVersion) if maxSdkVersion else None
|
||||
permission_sdk_23 = UsesPermissionSdk23(
|
||||
name,
|
||||
@ -1270,7 +1273,7 @@ def scan_apk_androguard(apk, apkfile):
|
||||
apk['uses-permission-sdk-23'].append(permission_sdk_23)
|
||||
|
||||
for item in xml.findall('uses-feature'):
|
||||
key = '{' + xml.nsmap['android'] + '}name'
|
||||
key = '{' + xmlns + '}name'
|
||||
if key not in item.attrib:
|
||||
continue
|
||||
feature = str(item.attrib[key])
|
||||
@ -1278,7 +1281,7 @@ def scan_apk_androguard(apk, apkfile):
|
||||
and feature != "android.hardware.screen.landscape":
|
||||
if feature.startswith("android.feature."):
|
||||
feature = feature[16:]
|
||||
required = item.attrib.get('{' + xml.nsmap['android'] + '}required')
|
||||
required = item.attrib.get('{' + xmlns + '}required')
|
||||
if required is None or required == 'true':
|
||||
apk['features'].append(feature)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user