Default the display server to X11 below API 29, where ASurfaceControl does not exist
Description
Gamescope scans out through ASurfaceControl / ASurfaceTransaction, which libandroid only exports from Android 10 (API 29). The app's minSdk is 26, so an Adreno device on Android 8 or 9 was defaulted to gamescope and the native scan-out loader bailed with loadScanoutApi: API < 29, unavailable.
Container.GAMESCOPE_MIN_SDK = 29andContainer.isGamescopeSupported(sdkInt)name the floor in one place.Container.defaultDisplayServer(isAdreno, sdkInt)returnsx11below the floor;ContainerUtils.setContainerDefaultspassesBuild.VERSION.SDK_INT.- Robolectric unit test covers Adreno above/below the floor and non-Adreno.
Existing containers are untouched (their displayServer is persisted). Only the default for new containers and the Settings default change. The display-server picker in the Graphics tab is not gated by this PR, so a user on API < 29 can still choose gamescope by hand.
Recording
N/A: default-value change, verified by unit test.
Type of Change
- Bug fix
- Performance / stability improvement
- Compatibility improvements
- Other (requires prior approval)
Checklist
- If I have access to
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed. - This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
- I have attached a recording of the change.
- I have read and agree to the contribution guidelines in
CONTRIBUTING.md.
Summary by cubic
Fixes Adreno devices on Android 8–9 (API 26–28) defaulting to the gamescope display server, which can't scan out below API 29 because ASurfaceControl doesn't exist.
- Adds
GAMESCOPE_MIN_SDK = 29andisGamescopeSupported(sdkInt)to centralize the API floor. defaultDisplayServer(isAdreno, sdkInt)now returnsx11on Adreno devices below API 29.ContainerUtilspassesBuild.VERSION.SDK_INTinto the default.
Existing containers keep their persisted displayServer; only new-container and Settings defaults change. The Graphics tab picker is not gated, so users below API 29 can still opt into gamescope manually. Adds Robolectric tests covering Adreno above/below the floor and non-Adreno.
Summary by CodeRabbit
- Bug Fixes
- Display server selection now accounts for Android version. Adreno devices running Android 10 (API 29) or newer continue to default to Gamescope; older Adreno devices now default to X11. Non-Adreno devices continue to default to X11.
- This prevents selecting Gamescope on Android versions that do not support it.