hmos-multidevice-natural-orientation

Fix HarmonyOS orientation behavior with setPreferredOrientation and rotation semantics.

31|6|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill hmos-multidevice-natural-orientation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hmos-multidevice-natural-orientation
Source: https://github.com/openharmonyinsight/openharmony-skills/tree/main/skills/harmonyos-ai-agent-skill/references/hmos-multidevice-natural-orientation
Command: npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill hmos-multidevice-natural-orientation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves inconsistent orientation behavior on HarmonyOS multi-device scenarios by correctly separating screen rotation, display orientation, window orientation, and natural orientation, then applying the right rotation strategy with lifecycle-safe updates.

Core Features & Use Cases

  • Natural orientation & rotation semantics: Establishes the correct mapping between natural portrait/landscape states and the meaning of rotation values, including special handling for tri-fold G-state.
  • Window-safe orientation control: Applies rotation changes only via the main window using setPreferredOrientation(), with clear boundaries for where it must not be used.
  • Multi-device adaptation & bug repair: Provides scene-based guidance for multi-form-factor adaptations and for common direction bugs (Tabs/Swiper lock issues, foldable forced portrait, split/suspended window failures, video full-screen restore issues).

Use Case: Your app’s video page and short-video feed intermittently end up in the wrong portrait/landscape mode on tablets and foldables; you need a unified strategy that handles rotation semantics and restores orientation correctly after page transitions and full-screen exit.

Quick Start

Use hmos-multidevice-natural-orientation to produce a REQ/DEV/FIX/VAL plan for your target page, ensuring correct natural orientation mapping, setPreferredOrientation usage boundaries, and a device coverage verification matrix.

Frequently Asked Questions about hmos-multidevice-natural-orientation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my HarmonyOS app show the wrong orientation on foldable and tablet devices?

Incorrect orientation on HarmonyOS foldables and tablets typically stems from conflating screen rotation, display orientation, window orientation, and natural orientation semantics. Separating these concepts and applying lifecycle-safe rotation strategies resolves the inconsistency.

How do I fix video full-screen rotation restore issues in HarmonyOS?

To fix video full-screen restore issues, apply window-level setPreferredOrientation control with clear usage boundaries, and implement lifecycle-safe save/restore logic to ensure correct portrait/landscape recovery after page transitions and full-screen exit.

What causes the Tabs and Swiper orientation lock bug on HarmonyOS multi-device screens?

The Tabs and Swiper orientation lock bug occurs when rotation changes bypass the main window or misuse breakpoint and fold state detection. Structured REQ/DEV/FIX/VAL outputs with correct window-level orientation control repair these direction bugs.

Does HarmonyOS setPreferredOrientation work with tri-fold screen G-state rotation?

Yes, setPreferredOrientation supports tri-fold G-state scenarios by establishing correct mapping between natural portrait/landscape states and rotation values. It must be applied only via the main window with defined boundaries for where it must not be used.

How do I implement a one-to-many orientation strategy for HarmonyOS foldable devices?

Implement a one-to-many orientation strategy by using correct breakpoint and fold state detection combined with natural orientation mapping. Generate a REQ/DEV/FIX/VAL plan covering multi-form-factor adaptations and a device coverage verification matrix.

What are the limitations of using setPreferredOrientation for HarmonyOS window size changes?

Limitations arise when setPreferredOrientation is applied outside the main window or without lifecycle-safe save/restore logic. Split and suspended window failures occur if rotation state is not properly managed across page transitions and window size changes.