Fixed resuming app from recent tasks after a call ended
This commit is contained in:
parent
38a144725f
commit
8c6758c4b8
3 changed files with 51 additions and 5 deletions
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
package org.linphone.activities.call
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
|
@ -33,6 +34,7 @@ import org.linphone.LinphoneApplication.Companion.corePreferences
|
|||
import org.linphone.R
|
||||
import org.linphone.activities.call.viewmodels.ControlsFadingViewModel
|
||||
import org.linphone.activities.call.viewmodels.SharedCallViewModel
|
||||
import org.linphone.activities.main.MainActivity
|
||||
import org.linphone.compatibility.Compatibility
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.CallActivityBinding
|
||||
|
@ -112,7 +114,15 @@ class CallActivity : ProximitySensorActivity() {
|
|||
|
||||
if (coreContext.core.callsNb == 0) {
|
||||
Log.w("[Call Activity] Resuming but no call found...")
|
||||
if (isTaskRoot) {
|
||||
// When resuming app from recent tasks make sure MainActivity will be launched if there is no call
|
||||
val intent = Intent()
|
||||
intent.setClass(this, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
coreContext.removeCallOverlay()
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.Manifest
|
|||
import android.annotation.TargetApi
|
||||
import android.app.KeyguardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
|
@ -33,6 +34,7 @@ import org.linphone.R
|
|||
import org.linphone.activities.GenericActivity
|
||||
import org.linphone.activities.call.viewmodels.IncomingCallViewModel
|
||||
import org.linphone.activities.call.viewmodels.IncomingCallViewModelFactory
|
||||
import org.linphone.activities.main.MainActivity
|
||||
import org.linphone.compatibility.Compatibility
|
||||
import org.linphone.core.Call
|
||||
import org.linphone.core.tools.Log
|
||||
|
@ -58,7 +60,15 @@ class IncomingCallActivity : GenericActivity() {
|
|||
val incomingCall: Call? = findIncomingCall()
|
||||
if (incomingCall == null) {
|
||||
Log.e("[Incoming Call Activity] Couldn't find call in state Incoming")
|
||||
if (isTaskRoot) {
|
||||
// When resuming app from recent tasks make sure MainActivity will be launched if there is no call
|
||||
val intent = Intent()
|
||||
intent.setClass(this, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -103,9 +113,17 @@ class IncomingCallActivity : GenericActivity() {
|
|||
val incomingCall: Call? = findIncomingCall()
|
||||
if (incomingCall == null) {
|
||||
Log.e("[Incoming Call Activity] Couldn't find call in state Incoming")
|
||||
if (isTaskRoot) {
|
||||
// When resuming app from recent tasks make sure MainActivity will be launched if there is no call
|
||||
val intent = Intent()
|
||||
intent.setClass(this, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Version.API23_MARSHMALLOW_60)
|
||||
private fun checkPermissions() {
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.linphone.activities.call
|
|||
import android.Manifest
|
||||
import android.animation.ValueAnimator
|
||||
import android.annotation.TargetApi
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import androidx.databinding.DataBindingUtil
|
||||
|
@ -33,6 +34,7 @@ import org.linphone.R
|
|||
import org.linphone.activities.call.viewmodels.CallViewModel
|
||||
import org.linphone.activities.call.viewmodels.CallViewModelFactory
|
||||
import org.linphone.activities.call.viewmodels.ControlsViewModel
|
||||
import org.linphone.activities.main.MainActivity
|
||||
import org.linphone.core.Call
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.CallOutgoingActivityBinding
|
||||
|
@ -56,7 +58,15 @@ class OutgoingCallActivity : ProximitySensorActivity() {
|
|||
val outgoingCall: Call? = findOutgoingCall()
|
||||
if (outgoingCall == null) {
|
||||
Log.e("[Outgoing Call Activity] Couldn't find call in state Outgoing")
|
||||
if (isTaskRoot) {
|
||||
// When resuming app from recent tasks make sure MainActivity will be launched if there is no call
|
||||
val intent = Intent()
|
||||
intent.setClass(this, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -122,9 +132,17 @@ class OutgoingCallActivity : ProximitySensorActivity() {
|
|||
val outgoingCall: Call? = findOutgoingCall()
|
||||
if (outgoingCall == null) {
|
||||
Log.e("[Outgoing Call Activity] Couldn't find call in state Outgoing")
|
||||
if (isTaskRoot) {
|
||||
// When resuming app from recent tasks make sure MainActivity will be launched if there is no call
|
||||
val intent = Intent()
|
||||
intent.setClass(this, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Version.API23_MARSHMALLOW_60)
|
||||
private fun checkPermissions() {
|
||||
|
|
Loading…
Reference in a new issue