mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
use androguard primitives to speed up finding debuggable flag
androguard parses the whole APK before handing the instance back, this uses the primitives to just find the <application android:debuggable=""> value, then stop parsing. #557
This commit is contained in:
parent
a3cecc16a3
commit
11d46072ab
2 changed files with 33 additions and 6 deletions
|
|
@ -131,7 +131,7 @@ class CommonTest(unittest.TestCase):
|
|||
fdroidserver.common._add_java_paths_to_config(pathlist, config)
|
||||
self.assertEqual(config['java_paths']['8'], choice[1:])
|
||||
|
||||
def testIsApkDebuggable(self):
|
||||
def test_is_apk_and_debuggable(self):
|
||||
config = dict()
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
fdroidserver.common.config = config
|
||||
|
|
@ -150,6 +150,13 @@ class CommonTest(unittest.TestCase):
|
|||
debuggable = fdroidserver.common.is_apk_and_debuggable(apkfile)
|
||||
self.assertTrue(debuggable,
|
||||
"debuggable APK state was not properly parsed!")
|
||||
if 'aapt' in config:
|
||||
self.assertTrue(fdroidserver.common.is_apk_and_debuggable_aapt(apkfile),
|
||||
'aapt parsing missed <application android:debuggable="">!')
|
||||
if fdroidserver.common.use_androguard():
|
||||
self.assertTrue(fdroidserver.common.is_apk_and_debuggable_androguard(apkfile),
|
||||
'androguard missed <application android:debuggable="">!')
|
||||
|
||||
# these are set NOT debuggable
|
||||
testfiles = []
|
||||
testfiles.append(os.path.join(self.basedir, 'urzip-release.apk'))
|
||||
|
|
@ -158,6 +165,12 @@ class CommonTest(unittest.TestCase):
|
|||
debuggable = fdroidserver.common.is_apk_and_debuggable(apkfile)
|
||||
self.assertFalse(debuggable,
|
||||
"debuggable APK state was not properly parsed!")
|
||||
if 'aapt' in config:
|
||||
self.assertFalse(fdroidserver.common.is_apk_and_debuggable_aapt(apkfile),
|
||||
'aapt parsing missed <application android:debuggable="">!')
|
||||
if fdroidserver.common.use_androguard():
|
||||
self.assertFalse(fdroidserver.common.is_apk_and_debuggable_androguard(apkfile),
|
||||
'androguard missed <application android:debuggable="">!')
|
||||
|
||||
def test_is_valid_package_name(self):
|
||||
for name in ["cafebabe",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue