Map SurfaceFlinger display mode ids to Display.Mode ids
Noticed while trying to switch Cuttlefish to HWComposer3 with ag/16624862. By default, Cuttlefish has a single display with a single config: `RanchuHwc: config: id: 0 w:720 h:1280 dpi-x:320 dpi-y:320 ...` In `LocalDeviceDisplay::updateDisplayModesLocked()`, the display config ids which come from HWComposer via SurfaceFlinger are mapped to DisplayRecord's Display.Mode's `mModeId` which are globally unique ids created from the atomic integer `DisplayAdapter.NEXT_DISPLAY_MODE_ID` (which defaults to 1). However, the preferred display config id (`mSystemPreferredModeId`) was not being mapped. This would lead to boot failures such as: ` AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: android.anim AndroidRuntime: java.lang.IllegalStateException: Unable to locate mode 0 ` with ag/16774826 because `mDefaultModeId` was being set to `mSystemPreferredModeId` which was the unmapped `0` from HWComposer. (Perhaps the need for this change suggests there should be strongly typed integers to represent the different id spaces, `SurfaceFlingerModeId` vs `DisplayAdapaterModeId` or something) Bug: b/193240715 Test: lunch cf_x86_64_phone-userdebug && cherry-pick ag/16624862 && m && cvd start Change-Id: I8fc0fca6816e037196f51d256430fad480f3b0ff
Loading
Please register or sign in to comment