Changes regarding incoming call notification & activity
This commit is contained in:
parent
465e41ae79
commit
e61ee2981e
3 changed files with 19 additions and 5 deletions
|
@ -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" />
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue