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

@CeRRiLLo89 CeRRiLLo89 commented Aug 3, 2026

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

Current-base build validation

Current 16.0 base:

71eec03efd654a4d14995b198566df9225015bb1

A clean m -j6 WmTests build with this PR alone is blocked by the independent pre-existing Home-action test-source issue now tracked separately in #1349.

With the #1349 Home-action patch applied temporarily for validation only, m -j6 WmTests completes successfully.

#1349 is independent and is not part of this PR.

Current runtime validation limitation

A fresh runtime execution on the official raphael ROM could not be performed safely.

The locally built WmTests.apk is signed with the AOSP platform test key, while the installed official crDroid framework is signed with the crDroid platform key. The certificates were checked directly and do not match. Installation was rejected with INSTALL_FAILED_VERIFICATION_FAILURE.

Therefore, 0 tests were executed during the current runtime-refresh attempt. Package verification was not bypassed.

Historical runtime validation

Before the current source rebuild, the unchanged patch was executed successfully on raphael:

  • Targeted natural-rotation test: 1 passed, 0 failed.
  • DeviceStateAutoRotateSettingControllerTests: 28 passed, 0 failed.

The stable patch-id remains:

2070a8f13d43430dae6e2258099e22008dab0746

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