mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-26 19:37:01 +02:00
Revert "[android] Fix crash on start any games for many handhelds (Ayaneo, Retroid etc) (#3647)"
This commit is contained in:
parent
dd79368c3e
commit
84150336c2
1 changed files with 7 additions and 39 deletions
|
|
@ -15,7 +15,6 @@ import android.content.BroadcastReceiver
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.Icon
|
||||
|
|
@ -101,7 +100,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
|||
private var romSwapGeneration = 0
|
||||
private var hasEmulationSession = processHasEmulationSession
|
||||
private val romSwapStopTimeoutRunnable = Runnable { onRomSwapStopTimeout() }
|
||||
private val pictureInPictureFailureActions: MutableSet<String> = mutableSetOf()
|
||||
|
||||
private fun onRomSwapStopTimeout() {
|
||||
if (!isWaitingForRomSwapStop) {
|
||||
|
|
@ -268,18 +266,12 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
|||
}
|
||||
|
||||
override fun onUserLeaveHint() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ||
|
||||
!isPictureInPictureSupported() ||
|
||||
!BooleanSetting.PICTURE_IN_PICTURE.getBoolean() ||
|
||||
isInPictureInPictureMode
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
val pictureInPictureParamsBuilder = PictureInPictureParams.Builder()
|
||||
.getPictureInPictureActionsBuilder().getPictureInPictureAspectBuilder()
|
||||
runPictureInPictureAction("enter picture-in-picture mode") {
|
||||
enterPictureInPictureMode(pictureInPictureParamsBuilder.build())
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
if (BooleanSetting.PICTURE_IN_PICTURE.getBoolean() && !isInPictureInPictureMode) {
|
||||
val pictureInPictureParamsBuilder = PictureInPictureParams.Builder()
|
||||
.getPictureInPictureActionsBuilder().getPictureInPictureAspectBuilder()
|
||||
enterPictureInPictureMode(pictureInPictureParamsBuilder.build())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -659,29 +651,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
|||
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() {
|
||||
if (!isPictureInPictureSupported()) {
|
||||
return
|
||||
}
|
||||
|
||||
val pictureInPictureParamsBuilder = PictureInPictureParams.Builder()
|
||||
.getPictureInPictureActionsBuilder().getPictureInPictureAspectBuilder()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
|
|
@ -691,9 +661,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener, InputManager
|
|||
BooleanSetting.PICTURE_IN_PICTURE.getBoolean() && isEmulationActive
|
||||
)
|
||||
}
|
||||
runPictureInPictureAction("set picture-in-picture params") {
|
||||
setPictureInPictureParams(pictureInPictureParamsBuilder.build())
|
||||
}
|
||||
setPictureInPictureParams(pictureInPictureParamsBuilder.build())
|
||||
}
|
||||
|
||||
fun displayMultiplayerDialog() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue