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
@neobuddy89
neobuddy89 force-pushed the 16.0 branch 3 times, most recently from bf065ba to 708e793 Compare August 8, 2026 16:31
@CeRRiLLo89
CeRRiLLo89 force-pushed the fix-wmtests-get-natural-rotation branch from db8bac1 to 6708631 Compare August 12, 2026 08:37
@CeRRiLLo89

Copy link
Copy Markdown
Contributor Author

Updated after the recent 16.0 history rewrite.

The branch has been rebuilt directly on the current 16.0 base (15593548c424fbcc4d44b2d07160dbc530ee428d).

Current PR head:
67086319cee9049d7ecdc5f52963a55121397386

The PR is now clean again:

  • 1 commit
  • 1 changed file
  • 6 additions / 3 deletions
  • no unrelated changes

The stable patch-id is identical to the previously validated commit, so the actual source change is unchanged.

Ready for review.

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