Skip to content

Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.

fix(android): a PC can't run a call-forwarding or USSD code without the phone's user

Bee8f25b57fbfb2
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.kt b/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.kt
index b6f6b13..0e598fc 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.kt
@@ -418,8 +418,11 @@ internal class PhoneCalls(
if (trimmed.isEmpty()) return false
lastDialed = trimmed to System.currentTimeMillis()
val uri = Uri.fromParts("tel", trimmed, null)
+ // A code with * or # (call forwarding, USSD) runs the moment it's
+ // dialled: it only goes into the dialer, for the phone's user to press.
+ val code = trimmed.any { it == '*' || it == '#' }
return runCatching {
- if (granted(context, Manifest.permission.CALL_PHONE)) {
+ if (!code && granted(context, Manifest.permission.CALL_PHONE)) {
val tm = context.getSystemService(TelecomManager::class.java)
if (tm != null) {
try {