Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
val confirmBeforeExit = settingsManager.getInt(getString(R.string.confirm_exit_key), -1)

if (confirmBeforeExit == 1 || (confirmBeforeExit == -1 && isLayout(PHONE))) {
// finish() causes a bug on some TVs where player
// may keep playing after closing the app.
if (isLayout(TV)) exitProcess(0) else finish()
exitProcess(0)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finish() is unreliable, the app used to use exitProcess everywhere but was changed. even on phone ive noticed with finish() it will keep playing after closing sometimes too, but I kinda ignored it because it wasn't all that common. But with the safe mode issue also I figured it may also be a good idea to deal with it. Not sure what would fully be a good solution to fix all the potential issues here without fully killing it then.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I encountered it on phone twice before. Which wasn't much compared to how TVs were and couldn't reliably reproduce it either. Although looking into it more now, maybe finishAffinity() is the proper usage here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe finishAndRemoveTask()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look into this more in depth later.

return
}

Expand All @@ -692,9 +690,8 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
putInt(getString(R.string.confirm_exit_key), 1)
}
}
// finish() causes a bug on some TVs where player
// may keep playing after closing the app.
if (isLayout(TV)) exitProcess(0) else finish()

exitProcess(0)
}

builder.show().setDefaultFocus()
Expand Down