summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizaveta <lisa-bella97@mail.ru>2024-04-22 16:50:45 +0300
committerArne Schwabe <arne@rfc2549.org>2024-04-22 16:06:01 +0200
commit4473ad1f1bc49c166fb8ab92ee7a7b91c608135e (patch)
treed46015ae82ced85c84383e1f47db6d9139a03441
parent4ef3bb1f0b027e86e8ef7a62449c0419b0edaae5 (diff)
Fix binding to external authenticator app on Android 14+
External authenticator apps may need to start background activities (for example, to allow users enter a pin code), but starting from Android 14, if the app bound to the service is targeting Android 14 or higher, it no longer allows the app that has the service to start a background activity by default. We need to add flag BIND_ALLOW_ACTIVITY_STARTS to allow the external authenticator app to start background activities.
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/ExtAuthHelper.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/ExtAuthHelper.java b/main/src/main/java/de/blinkt/openvpn/core/ExtAuthHelper.java
index 39151646..0da8abbb 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/ExtAuthHelper.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/ExtAuthHelper.java
@@ -215,8 +215,9 @@ public class ExtAuthHelper {
Intent intent = new Intent(ACTION_CERT_PROVIDER);
intent.setPackage(packagename);
- if (!context.bindService(intent, extAuthServiceConnection, Context.BIND_AUTO_CREATE)) {
- throw new KeyChainException("could not bind to external authticator app: " + packagename);
+ if (!context.bindService(intent, extAuthServiceConnection,
+ Context.BIND_AUTO_CREATE | Context.BIND_ALLOW_ACTIVITY_STARTS)) {
+ throw new KeyChainException("could not bind to external authenticator app: " + packagename);
}
return new ExternalAuthProviderConnection(context, extAuthServiceConnection, q.take());
}