feat: full-screen incoming call UI over lock screen
Enable proper full-screen call experience when the phone is locked or the app is in the background: - CallActivity shows over lock screen (setShowWhenLocked/turnScreenOn) - Manifest adds showOnLockScreen and turnScreenOn attributes - Remove setSilent(true) from notification — it was blocking the full-screen intent from triggering (channel silence is enough) - Populate ActiveCallHolder eagerly in initCallController() so the full-screen intent can launch CallActivity even when the Compose UI is paused in the background https://claude.ai/code/session_01Ak5tTkujpjNG1r5ASuPipZ
This commit is contained in:
@@ -213,6 +213,8 @@
|
|||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
|
android:showOnLockScreen="true"
|
||||||
|
android:turnScreenOn="true"
|
||||||
android:theme="@style/Theme.Amethyst"
|
android:theme="@style/Theme.Amethyst"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
-1
@@ -602,7 +602,6 @@ object NotificationUtils {
|
|||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.setTimeoutAfter(60_000)
|
.setTimeoutAfter(60_000)
|
||||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||||
.setSilent(true)
|
|
||||||
.addAction(R.drawable.amethyst, stringRes(applicationContext, R.string.call_reject), rejectPendingIntent)
|
.addAction(R.drawable.amethyst, stringRes(applicationContext, R.string.call_reject), rejectPendingIntent)
|
||||||
.addAction(R.drawable.amethyst, stringRes(applicationContext, R.string.call_accept), acceptPendingIntent)
|
.addAction(R.drawable.amethyst, stringRes(applicationContext, R.string.call_accept), acceptPendingIntent)
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,18 @@ class CallActivity : AppCompatActivity() {
|
|||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
// Show over lock screen and turn screen on for incoming calls
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
setShowWhenLocked(true)
|
||||||
|
setTurnScreenOn(true)
|
||||||
|
} else {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
window.addFlags(
|
||||||
|
android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||||
|
android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val callManager = ActiveCallHolder.callManager
|
val callManager = ActiveCallHolder.callManager
|
||||||
val callController = ActiveCallHolder.callController
|
val callController = ActiveCallHolder.callController
|
||||||
val accountViewModel = ActiveCallHolder.accountViewModel
|
val accountViewModel = ActiveCallHolder.accountViewModel
|
||||||
|
|||||||
+5
@@ -224,6 +224,11 @@ class AccountViewModel(
|
|||||||
callManager.onAnswerReceived = { event -> controller.onCallAnswerReceived(event.sdpAnswer()) }
|
callManager.onAnswerReceived = { event -> controller.onCallAnswerReceived(event.sdpAnswer()) }
|
||||||
callManager.onIceCandidateReceived = { event -> controller.onIceCandidateReceived(event) }
|
callManager.onIceCandidateReceived = { event -> controller.onIceCandidateReceived(event) }
|
||||||
callController = controller
|
callController = controller
|
||||||
|
|
||||||
|
// Populate ActiveCallHolder so CallActivity can launch even when the app
|
||||||
|
// is in the background (e.g. full-screen incoming call intent).
|
||||||
|
com.vitorpamplona.amethyst.ui.call.ActiveCallHolder
|
||||||
|
.set(callManager, controller, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
val eventSync =
|
val eventSync =
|
||||||
|
|||||||
Reference in New Issue
Block a user