No need for ProxyActivity

This commit is contained in:
Juha Heinanen
2022-01-10 15:24:11 +02:00
parent d20f030c0d
commit 524d0bdcba
4 changed files with 10 additions and 48 deletions

View File

@ -61,12 +61,6 @@
<data android:scheme="sip" />
</intent-filter>
</activity>
<activity
android:name=".ProxyActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop"
android:noHistory="true" >
</activity>
<activity
android:name=".AccountsActivity"
android:configChanges="orientation|keyboardHidden|screenSize"

View File

@ -643,14 +643,8 @@ class BaresipService: Service() {
}
}
if (!Utils.isVisible()) {
val intent = if (isMainAlive)
Intent(applicationContext, ProxyActivity::class.java)
else
Intent(applicationContext, MainActivity::class.java)
intent.flags = if (isMainAlive)
Intent.FLAG_ACTIVITY_NEW_TASK
else
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or
val intent = Intent(applicationContext, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or
Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtra("action", "call show")
.putExtra("callp", callp)

View File

@ -731,13 +731,16 @@ class MainActivity : AppCompatActivity() {
// Called when MainActivity already exists at the top of current task
super.onNewIntent(intent)
Utils.setShowWhenLocked(this, true)
Utils.setTurnScreenOn(this, true)
resumeAction = ""
resumeUri = ""
if (intent.action == ACTION_CALL) {
Log.d(TAG, "onNewIntent $ACTION_CALL ${intent.data}")
if (Call.calls().isNotEmpty() || UserAgent.uas().isEmpty()) {
if (Call.calls().isNotEmpty() || UserAgent.uas().isEmpty())
return
}
val uri: Uri? = intent.data
if (uri != null) {
val uriStr = URLDecoder.decode(uri.toString(), "UTF-8")
@ -1105,8 +1108,9 @@ class MainActivity : AppCompatActivity() {
Toast.LENGTH_LONG).show()
}
restoreActivities()
if (Build.VERSION.SDK_INT >= 22 && kgm.isDeviceLocked)
moveTaskToBack(true)
if ((Build.VERSION.SDK_INT >= 22 && kgm.isDeviceLocked) ||
(Build.VERSION.SDK_INT < 22 && kgm.isKeyguardLocked() && kgm.isKeyguardSecure()))
Utils.setShowWhenLocked(this, false)
}
"message", "message show", "message reply" -> {
val peer = params[1]

View File

@ -1,30 +0,0 @@
package com.tutpro.baresip
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class ProxyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Utils.setShowWhenLocked(this, true)
Utils.setTurnScreenOn(this, true)
Log.d(TAG, "ProxyActivity onCreate")
val intent = Intent(applicationContext, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or
Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtras(getIntent())
startActivity(intent)
finish()
}
}