Files
drone-controller-v5/AGENTS.md
2026-07-09 10:11:25 +08:00

3.1 KiB

Repository Guidelines

Project Structure & Module Organization

This Android Gradle project has two modules in settings.gradle. sample/ is the app module (com.zklh.dronecontroller) with DJI sample screens, flight/control code, Compose UI, XML layouts, navigation resources, and assets under sample/src/main/. uxsdk/ is a reusable DJI UX library with widgets, map/camera/flight UI, resources, and assets under uxsdk/src/main/. Shared dependencies live in dependencies.gradle; module settings live in each build.gradle. Treat build/, .gradle/, tmp-aar/, and tmp-apk-libs/ as generated artifacts unless required.

Build, Test, and Development Commands

Use the Gradle wrapper from the repository root.

  • .\gradlew.bat :sample:assembleDebug builds the debug APK.
  • .\gradlew.bat :uxsdk:assembleDebug builds the UX SDK library variant.
  • .\gradlew.bat :sample:installDebug installs the app on a connected device or emulator.
  • .\gradlew.bat :sample:testDebugUnitTest runs local JVM tests when present.
  • .\gradlew.bat :sample:connectedDebugAndroidTest runs instrumented Android tests on a device.

Prefer targeted module commands while editing. Run broader builds before handoff when Gradle config, dependencies, shared resources, or module boundaries change.

Coding Style & Naming Conventions

Follow Android Studio defaults for Kotlin and Java: 4-space indentation, same-line braces, and Java 8/Kotlin JVM target 1.8 compatibility. Use PascalCase for classes, camelCase for methods/properties, and existing suffixes such as Fragment, Activity, VM, Widget, and WidgetModel. App resources use lowercase snake case; uxsdk resources must keep the uxsdk_ prefix. Add shared dependency versions to dependencies.gradle.

Testing Guidelines

No dedicated src/test or src/androidTest trees are currently checked in. Add unit tests under module/src/test/java and device/UI tests under module/src/androidTest/java. Prefer unit tests for parsing, mission planning, safety checks, telemetry transforms, and view models; use instrumented tests for SDK, permissions, camera, map, and device-dependent flows. Example names: VirtualStickVMTest, MissionParserInstrumentedTest.

Commit & Pull Request Guidelines

This workspace does not include Git history, so no repository-specific convention can be inferred. Use short, imperative, scoped subjects such as sample: fix virtual stick safety gate or uxsdk: update camera widget labels. PRs should include a summary, affected module(s), verification commands, device/emulator and Android version when relevant, linked issues, and screenshots or recordings for UI changes. Call out changes to DJI SDK keys, signing, permissions, flight behavior, or safety controls.

Security & Configuration Tips

gradle.properties references API keys, map tokens, signing values, Maven URLs, and SDK versions. Keep real secrets local, avoid adding new credentials or keystores, and mask values in logs and reviews. For DJI flight-command changes, document manual test conditions before changing safety-related behavior.