mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-27 02:07:10 +02:00
Revert "[android] Fix crash on start any games for many handhelds (Ayaneo, Retroid etc) (#3647)"
This commit is contained in:
parent
5653d99dc7
commit
685d9d0bf9
1 changed files with 7 additions and 39 deletions
|
|
@ -15,7 +15,6 @@ import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.graphics.drawable.Icon
|
import android.graphics.drawable.Icon
|
||||||
|
|
@ -101,7 +100,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
||||||
private var romSwapGeneration = 0
|
private var romSwapGeneration = 0
|
||||||
private var hasEmulationSession = processHasEmulationSession
|
private var hasEmulationSession = processHasEmulationSession
|
||||||
private val romSwapStopTimeoutRunnable = Runnable { onRomSwapStopTimeout() }
|
private val romSwapStopTimeoutRunnable = Runnable { onRomSwapStopTimeout() }
|
||||||
private val pictureInPictureFailureActions: MutableSet<String> = mutableSetOf()
|
|
||||||
|
|
||||||
private fun onRomSwapStopTimeout() {
|
private fun onRomSwapStopTimeout() {
|
||||||
if (!isWaitingForRomSwapStop) {
|
if (!isWaitingForRomSwapStop) {
|
||||||
|
|
@ -270,18 +268,12 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUserLeaveHint() {
|
override fun onUserLeaveHint() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||||
!isPictureInPictureSupported() ||
|
if (BooleanSetting.PICTURE_IN_PICTURE.getBoolean() && !isInPictureInPictureMode) {
|
||||||
!BooleanSetting.PICTURE_IN_PICTURE.getBoolean() ||
|
val pictureInPictureParamsBuilder = PictureInPictureParams.Builder()
|
||||||
isInPictureInPictureMode
|
.getPictureInPictureActionsBuilder().getPictureInPictureAspectBuilder()
|
||||||
) {
|
enterPictureInPictureMode(pictureInPictureParamsBuilder.build())
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val pictureInPictureParamsBuilder = PictureInPictureParams.Builder()
|
|
||||||
.getPictureInPictureActionsBuilder().getPictureInPictureAspectBuilder()
|
|
||||||
runPictureInPictureAction("enter picture-in-picture mode") {
|
|
||||||
enterPictureInPictureMode(pictureInPictureParamsBuilder.build())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -661,29 +653,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
||||||
return this.apply { setActions(pictureInPictureActions) }
|
return this.apply { setActions(pictureInPictureActions) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isPictureInPictureSupported() =
|
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
|
||||||
packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)
|
|
||||||
|
|
||||||
private fun runPictureInPictureAction(actionName: String, action: () -> Unit) {
|
|
||||||
try {
|
|
||||||
action()
|
|
||||||
} catch (e: IllegalStateException) {
|
|
||||||
if (pictureInPictureFailureActions.add(actionName)) {
|
|
||||||
Log.warning("[PiP] Failed to $actionName: ${e.message}")
|
|
||||||
}
|
|
||||||
} catch (e: UnsupportedOperationException) {
|
|
||||||
if (pictureInPictureFailureActions.add(actionName)) {
|
|
||||||
Log.warning("[PiP] Failed to $actionName: ${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun buildPictureInPictureParams() {
|
fun buildPictureInPictureParams() {
|
||||||
if (!isPictureInPictureSupported()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pictureInPictureParamsBuilder = PictureInPictureParams.Builder()
|
val pictureInPictureParamsBuilder = PictureInPictureParams.Builder()
|
||||||
.getPictureInPictureActionsBuilder().getPictureInPictureAspectBuilder()
|
.getPictureInPictureActionsBuilder().getPictureInPictureAspectBuilder()
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
|
@ -693,9 +663,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
||||||
BooleanSetting.PICTURE_IN_PICTURE.getBoolean() && isEmulationActive
|
BooleanSetting.PICTURE_IN_PICTURE.getBoolean() && isEmulationActive
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
runPictureInPictureAction("set picture-in-picture params") {
|
setPictureInPictureParams(pictureInPictureParamsBuilder.build())
|
||||||
setPictureInPictureParams(pictureInPictureParamsBuilder.build())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun displayMultiplayerDialog() {
|
fun displayMultiplayerDialog() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue