mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
fix(release): rename the dual-screen and typing task affinities for variant APKs (#1767)
This commit is contained in:
1 parent
9f7f6d821d
commit
15b00fc23c
2 files changed
+30
-1
No files matched your search
@@ -29,7 +29,7 @@ else
|
||||
"$P=$pkg" "$P.androidx-startup=$pkg.androidx-startup" "$P.logs=$pkg.logs" \
|
||||
"$P.pairingguide=$pkg.pairingguide" "$P.pin=$pkg.pin" \
|
||||
"$P.documents=$pkg.documents" "$P.home=$pkg.home" "$P.agent=$pkg.agent" \
|
||||
"$P.vr_recovery=$pkg.vr_recovery" \
|
||||
"$P.vr_recovery=$pkg.vr_recovery" "$P.dualscreen=$pkg.dualscreen" "$P.typing=$pkg.typing" \
|
||||
"$P.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION=$pkg.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
|
||||
fi
|
||||
got=$("$BUILD_TOOLS/aapt" dump badging "$work/renamed.apk" | sed -n "s/^package: name='\([^']*\)'.*/\1/p")
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
PACKAGE = 'com.droiddeck.launcher'
|
||||
|
||||
|
||||
class SignApkRenamesTest(unittest.TestCase):
|
||||
def test_variants_rename_every_authority_and_task_named_after_the_package(self):
|
||||
# sign-apk.sh renames a fixed list of names for the pubg/antutu/ludashi variants and fails the
|
||||
# main build on any authority or task affinity it leaves on the base package; PR builds do not sign.
|
||||
manifest = (ROOT / 'app/src/main/AndroidManifest.xml').read_text()
|
||||
names = set()
|
||||
for attribute in ('authorities', 'taskAffinity'):
|
||||
for value in re.findall(r'android:%s="([^"]*)"' % attribute, manifest):
|
||||
self.assertNotIn(';', value, 'sign-apk.sh renames whole values, so give each authority its own provider')
|
||||
name = value.strip().replace('${applicationId}', PACKAGE)
|
||||
if name.startswith(PACKAGE + '.'):
|
||||
names.add(name[len(PACKAGE):])
|
||||
self.assertIn('.agent', names)
|
||||
script = (ROOT / 'tools/release/sign-apk.sh').read_text()
|
||||
renamed = set(re.findall(r'"\$P(\.[A-Za-z0-9_.-]+)=\$pkg\1"', script))
|
||||
self.assertEqual(set(), names - renamed, 'add these to the axml_rename call in tools/release/sign-apk.sh')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user