Changes regarding incoming call notification & activity

This commit is contained in:
Sylvain Berfini 2022-03-08 13:20:42 +01:00
parent 465e41ae79
commit e61ee2981e
3 changed files with 19 additions and 5 deletions

View file

@ -121,7 +121,7 @@
android:windowSoftInputMode="adjustResize"/> android:windowSoftInputMode="adjustResize"/>
<activity android:name=".activities.voip.CallActivity" <activity android:name=".activities.voip.CallActivity"
android:launchMode="singleTop" android:launchMode="singleTask"
android:resizeableActivity="true" android:resizeableActivity="true"
android:supportsPictureInPicture="true" /> android:supportsPictureInPicture="true" />

View file

@ -86,8 +86,11 @@ class CallActivity : ProximitySensorActivity() {
callsViewModel.noMoreCallEvent.observe( callsViewModel.noMoreCallEvent.observe(
this this
) { ) {
it.consume { it.consume { noMoreCall ->
finish() if (noMoreCall) {
Log.i("[Call Activity] No more call event fired, finishing activity")
finish()
}
} }
} }

View file

@ -443,6 +443,17 @@ class NotificationsManager(private val context: Context) {
return return
} }
try {
val showLockScreenNotification = android.provider.Settings.Secure.getInt(
context.contentResolver,
"lock_screen_show_notifications",
0
)
Log.i("[Notifications Manager] Are notifications allowed on lock screen? ${showLockScreenNotification != 0} ($showLockScreenNotification)")
} catch (e: Exception) {
Log.e("[Notifications Manager] Failed to get android.provider.Settings.Secure.getInt(lock_screen_show_notifications): $e")
}
val notifiable = getNotifiableForCall(call) val notifiable = getNotifiableForCall(call)
if (notifiable.notificationId == currentForegroundServiceNotificationId) { if (notifiable.notificationId == currentForegroundServiceNotificationId) {
Log.e("[Notifications Manager] There is already a Service foreground notification for an incoming call, cancelling it") Log.e("[Notifications Manager] There is already a Service foreground notification for an incoming call, cancelling it")
@ -450,8 +461,8 @@ class NotificationsManager(private val context: Context) {
currentForegroundServiceNotificationId = 0 currentForegroundServiceNotificationId = 0
} }
val incomingCallNotificationIntent = Intent(context, org.linphone.activities.voip.CallActivity::class.java) val incomingCallNotificationIntent = Intent(context, CallActivity::class.java)
incomingCallNotificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) incomingCallNotificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_USER_ACTION)
val pendingIntent = PendingIntent.getActivity( val pendingIntent = PendingIntent.getActivity(
context, context,
0, 0,