Android: bind the IOpenPgpService2 service; declare <queries> in manifest.
The v1 action (org.openintents.openpgp.IOpenPgpService) resolves in Keychain 6.0.4 but its binder does not implement the IOpenPgpService2 AIDL descriptor that OpenPgpApi calls through, so every call died with SecurityException: Binder invocation to an incorrect interface. Bind the IOpenPgpService2 service first (v1 and the very old api.OpenPgpService actions remain as fallbacks). Android 11+ package visibility also hid Keychain's services entirely: resolveService/bindService found nothing from the app even with MANAGE_EXTERNAL_STORAGE granted, so the build now injects a <queries> element (package + intent) into the decoded manifest.
This commit is contained in:
+14
-1
@@ -74,8 +74,21 @@ if perm not in t:
|
||||
t = t.replace(" <application", " " + perm + "\n <application", 1)
|
||||
if perm not in t:
|
||||
sys.exit("ERROR: failed to inject MANAGE_EXTERNAL_STORAGE")
|
||||
# Android 11+ package visibility: without <queries> the app cannot even
|
||||
# resolve (let alone bind) Keychain's OpenPGP service.
|
||||
queries = """ <queries>
|
||||
<package android:name="org.sufficientlysecure.keychain"/>
|
||||
<intent>
|
||||
<action android:name="org.openintents.openpgp.IOpenPgpService2"/>
|
||||
</intent>
|
||||
</queries>
|
||||
"""
|
||||
if "<queries>" not in t:
|
||||
t = t.replace(" <application", queries + " <application", 1)
|
||||
if "<queries>" not in t:
|
||||
sys.exit("ERROR: failed to inject <queries>")
|
||||
p.write_text(t)
|
||||
print("manifest: MANAGE_EXTERNAL_STORAGE present")
|
||||
print("manifest: MANAGE_EXTERNAL_STORAGE + <queries> present")
|
||||
PYEOF
|
||||
|
||||
echo "=== apktool rebuild ==="
|
||||
|
||||
Reference in New Issue
Block a user