Skip to content

WmTests: fix natural rotation tests - #1341

Open
CeRRiLLo89 wants to merge 1 commit into
crdroidandroid:16.0from
CeRRiLLo89:fix-wmtests-get-natural-rotation
Open

WmTests: fix natural rotation tests#1341
CeRRiLLo89 wants to merge 1 commit into
crdroidandroid:16.0from
CeRRiLLo89:fix-wmtests-get-natural-rotation

Conversation

@CeRRiLLo89

Copy link
Copy Markdown
Contributor

Summary

  • Call the statically imported getNaturalRotation() method at the three affected test sites instead of referencing it as a value.
  • Make foldableConfigFalse_locksRotation_usesNaturalRotation deterministic by configuring the fake settings provider so the current rotation is not eligible.

Root cause

The test source referenced getNaturalRotation without invoking it, which prevents WmTests from compiling. After correcting those calls, the natural-rotation test could still select USE_CURRENT_ROTATION because the default allowed-rotation mask includes the device's current rotation. Setting ACCELEROMETER_ROTATION_ANGLES to 0 in the fake resolver isolates the natural-rotation branch the test is intended to cover.

This changes test code only; no production behavior is modified.

Validation

  • m -j6 WmTests — passed
  • atest --serial 112eb247 'WmTests:com.android.server.wm.DeviceStateAutoRotateSettingControllerTests#foldableConfigFalse_locksRotation_usesNaturalRotation' — 1 passed, 0 failed
  • atest --serial 112eb247 WmTests:com.android.server.wm.DeviceStateAutoRotateSettingControllerTests — 28 passed, 0 failed

Validation device: Xiaomi Mi 9T Pro / Redmi K20 Pro (raphael), Android 16.

@CeRRiLLo89
CeRRiLLo89 marked this pull request as ready for review August 3, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant