Prevent call from being stopped when removing app from recent tasks + go back to call activity when clicking launcher icon during a call

This commit is contained in:
Sylvain Berfini 2022-06-09 14:36:42 +02:00
parent 635c8e69c7
commit cbacb97f9d
3 changed files with 15 additions and 1 deletions

View file

@ -25,9 +25,11 @@ Group changes to describe their impact on the project, as follows:
- Improved how contact avatars are generated
- 3-dots menu even for basic chat rooms with more options
- Phone numbers & email addresses are now clickable links in chat messages
- Go to call activity when there is at least one active call and you click on launcher icon
### Fixed
- Multiple file download attempt from the same chat bubble at the same time needed app restart to properly download each file
- Call stopped when removing app from recent tasks
- Generated avatars in dark mode
- Call state in self-managed TelecomManager service if it takes longer to be created than the call to be answered
- Show service notification sooner to prevent crash if Core creation takes too long

View file

@ -261,6 +261,16 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
private fun handleIntentParams(intent: Intent) {
when (intent.action) {
Intent.ACTION_MAIN -> {
val core = coreContext.core
val call = core.currentCall ?: core.calls.firstOrNull()
if (call != null) {
Log.i("[Main Activity] Launcher clicked while there is at least one active call, go to CallActivity")
val callIntent = Intent(this, org.linphone.activities.voip.CallActivity::class.java)
callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
startActivity(callIntent)
}
}
Intent.ACTION_SEND, Intent.ACTION_SENDTO -> {
if (intent.type == "text/plain") {
handleSendText(intent)

View file

@ -66,7 +66,9 @@ class CoreService : CoreService() {
}
override fun onTaskRemoved(rootIntent: Intent?) {
if (!corePreferences.keepServiceAlive) {
if (coreContext.core.callsNb > 0) {
Log.w("[Service] Task removed but there is at least one active call, do not stop the Core!")
} else if (!corePreferences.keepServiceAlive) {
if (coreContext.core.isInBackground) {
Log.i("[Service] Task removed, stopping Core")
coreContext.stop()