Tried to simplify Quit/Restart process
This commit is contained in:
@ -325,11 +325,6 @@ class BaresipService: Service() {
|
||||
"force" -> {
|
||||
cleanService()
|
||||
isServiceRunning = false
|
||||
if (VERSION.SDK_INT < 33)
|
||||
@Suppress("DEPRECATION")
|
||||
stopForeground(true)
|
||||
else
|
||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||
stopSelf()
|
||||
// exitProcess(0)
|
||||
}
|
||||
@ -543,14 +538,16 @@ class BaresipService: Service() {
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d(TAG, "At Baresip Service onDestroy")
|
||||
Log.d(TAG, "onDestroy at Baresip Service")
|
||||
this.unregisterReceiver(bluetoothReceiver)
|
||||
this.unregisterReceiver(hotSpotReceiver)
|
||||
if (am.isBluetoothScoOn) am.stopBluetoothSco()
|
||||
if (am.isBluetoothScoOn)
|
||||
am.stopBluetoothSco()
|
||||
cleanService()
|
||||
if (isServiceRunning) {
|
||||
if (isServiceRunning)
|
||||
sendBroadcast(Intent("com.tutpro.baresip.Restart"))
|
||||
}
|
||||
else
|
||||
exitProcess(0)
|
||||
}
|
||||
|
||||
@SuppressLint("UnspecifiedImmutableFlag")
|
||||
@ -1097,11 +1094,6 @@ class BaresipService: Service() {
|
||||
quitTimer.cancel()
|
||||
isServiceRunning = false
|
||||
postServiceEvent(ServiceEvent("stopped", arrayListOf(error), System.nanoTime()))
|
||||
if (VERSION.SDK_INT < 33)
|
||||
@Suppress("DEPRECATION")
|
||||
stopForeground(true)
|
||||
else
|
||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||
stopSelf()
|
||||
}
|
||||
|
||||
|
||||
@ -1185,7 +1185,6 @@ class MainActivity : AppCompatActivity() {
|
||||
Log.d(TAG, "Trigger restart")
|
||||
val pm = applicationContext.packageManager
|
||||
val intent = pm.getLaunchIntentForPackage(this.packageName)
|
||||
this.finishAffinity()
|
||||
this.startActivity(intent)
|
||||
exitProcess(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user