Skip to content

[Feature][Android] Add full-page orientation policy - #125

Open
Huxpro wants to merge 1 commit into
tiktok:agent/android-resource-fetchersfrom
Huxpro:agent/android-container-orientation
Open

[Feature][Android] Add full-page orientation policy#125
Huxpro wants to merge 1 commit into
tiktok:agent/android-resource-fetchersfrom
Huxpro:agent/android-container-orientation

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a Java-friendly SYSTEM / PORTRAIT / LANDSCAPE orientation policy
  • support an optional global default and a per-container override
  • preserve canonical screen_orientation compatibility and explicit system behavior
  • apply the resolved policy before full-page Activity content creation
  • keep embedded Sparkling views from mutating their host Activity orientation

Stack

Test Plan

  • focused JVM/Robolectric tests: 32 passed, 0 failures/errors
  • :sparkling:assembleDebugAndroidTest
  • scripts/lint.sh kotlin
  • Sandbox real-device instrumentation is being run separately against this exact commit

Device validation complete

The durable SG1 + Lynx Sandbox acceptance matrix is now available in #131. Exact validated commit: 8a2b3ea99eaa342e2f1ebfe716aefbb44f411fbb. On a fresh aries_10 device (Android 10 / API 29), all 9 tests passed, including real first-screen rendering, fixed 320x480, shared density 3.25 across two independent Lynx views, PART_ON_LAYOUT, typed template fetch invocation, orientation, retry recovery, and unsafe configuration rejection. The runner dynamically leases/releases the device and archives logs/screenshots/hashes. Evidence archive on SG1: /tmp/sparkling-android-device-acceptance-8a2b3ea.tar.gz (SHA-256 09acd64b4b63988b61e7f4f2ff11f3f7b4b4770bd3ef74a973db6dda0c9e242c).

Expanded durable device validation

The checked-in SG1 + Lynx Sandbox matrix in #131 now validates exact commit df875a87541d587ab8aa84a86600c0610f9e44c7 with 10/10 PASS on aries_10 (Android 10 / API 29). Added runtime coverage includes: the pre-load listener observing a ready bridge before template fetch; the global per-page fetcher factory; real first-screen rendering for ALL_ON_UI, MOST_ON_TASM, PART_ON_LAYOUT, and safe MULTI_THREADS; and full-page fixed-viewport + MULTI_THREADS rejection before Activity launch or transfer-station save. The runner requires a clean exact HEAD and fails closed unless Sandbox release confirms the leased serial. Evidence: /tmp/sparkling-android-device-acceptance-df875a8; archive SHA-256 712a3b83dbd78eabeae9afc0766b5b191cee0bff10e515967b3ae9f46c4feb98.

Summary of change:
- Add Java-friendly system, portrait, and landscape orientation policies.
- Support an optional global default with a per-container override.
- Preserve canonical scheme compatibility and explicit system behavior.
- Apply the resolved policy before full-page Activity content creation.
- Keep embedded views from mutating their host Activity orientation.
- Document precedence and embedded behavior in English and Chinese.

TEST: JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home ANDROID_HOME=/Users/bytedance/Library/Android/sdk /Users/bytedance/.gradle/wrapper/dists/gradle-8.2-all/6mxqtxovn2faat1idb7p6lxsa/gradle-8.2/bin/gradle :sparkling:testDebugUnitTest --tests com.tiktok.sparkling.SparklingScreenOrientationPolicyTest --tests com.tiktok.sparkling.SparklingScreenOrientationJavaApiTest --tests com.tiktok.sparkling.SparklingActivityTest --tests com.tiktok.sparkling.hybridkit.config.HybridConfigTest --no-daemon
TEST: JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home ANDROID_HOME=/Users/bytedance/Library/Android/sdk /Users/bytedance/.gradle/wrapper/dists/gradle-8.2-all/6mxqtxovn2faat1idb7p6lxsa/gradle-8.2/bin/gradle :sparkling:assembleDebugAndroidTest --no-daemon
TEST: PATH=/tmp/sparkling-ktlint-bin:$PATH scripts/lint.sh kotlin

Co-authored-by: TRAE CLI <noreply@bytedance.com>
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