Update UI helper to not fail on Meta Quest devices (#1516)

This commit is contained in:
Ivan Vojtko
2026-09-01 01:22:42 -05:00
committed by GitHub
parent b9c5edddef
commit 0711e236c0
@@ -31,14 +31,20 @@ public class UiHelper {
private static void setGameModeStatus(Context context, boolean streaming, boolean interruptible) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
try {
GameManager gameManager = context.getSystemService(GameManager.class);
if (gameManager == null) {
return; // Not supported on this device (e.g., Meta Quest)
}
if (streaming) {
gameManager.setGameState(new GameState(false, interruptible ? GameState.MODE_GAMEPLAY_INTERRUPTIBLE : GameState.MODE_GAMEPLAY_UNINTERRUPTIBLE));
}
else {
} else {
gameManager.setGameState(new GameState(false, GameState.MODE_NONE));
}
} catch (Throwable t) {
// Swallow any failure. Some OEM builds ship partial/incompatible GameManager impls.
}
}
}