mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-10-12 03:24:05 +00:00
Update UI helper to not fail on Meta Quest devices (#1516)
This commit is contained in:
@@ -31,14 +31,20 @@ public class UiHelper {
|
|||||||
|
|
||||||
private static void setGameModeStatus(Context context, boolean streaming, boolean interruptible) {
|
private static void setGameModeStatus(Context context, boolean streaming, boolean interruptible) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
try {
|
||||||
GameManager gameManager = context.getSystemService(GameManager.class);
|
GameManager gameManager = context.getSystemService(GameManager.class);
|
||||||
|
if (gameManager == null) {
|
||||||
|
return; // Not supported on this device (e.g., Meta Quest)
|
||||||
|
}
|
||||||
|
|
||||||
if (streaming) {
|
if (streaming) {
|
||||||
gameManager.setGameState(new GameState(false, interruptible ? GameState.MODE_GAMEPLAY_INTERRUPTIBLE : GameState.MODE_GAMEPLAY_UNINTERRUPTIBLE));
|
gameManager.setGameState(new GameState(false, interruptible ? GameState.MODE_GAMEPLAY_INTERRUPTIBLE : GameState.MODE_GAMEPLAY_UNINTERRUPTIBLE));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gameManager.setGameState(new GameState(false, GameState.MODE_NONE));
|
gameManager.setGameState(new GameState(false, GameState.MODE_NONE));
|
||||||
}
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
// Swallow any failure. Some OEM builds ship partial/incompatible GameManager impls.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user