Skip to content

manager: add Wear OS UI support#3434

Open
suqi8 wants to merge 2 commits intotiann:mainfrom
suqi8:pr/wear-ui
Open

manager: add Wear OS UI support#3434
suqi8 wants to merge 2 commits intotiann:mainfrom
suqi8:pr/wear-ui

Conversation

@suqi8
Copy link
Copy Markdown
Contributor

@suqi8 suqi8 commented Apr 28, 2026

This pull request introduces comprehensive support for Wear OS devices, including UI adaptations, navigation, and feature gating based on device capabilities. The changes ensure the app can run on both standard Android and Wear OS devices, providing tailored experiences and restricting unsupported features on Wear OS as needed.

Wear OS support and UI adaptation:

  • Added Wear OS Compose libraries and updated the manifest to declare Wear features and permissions, allowing the app to run on watches and utilize Wear-specific UI components. [1] [2] [3]

UI and navigation enhancements for Wear OS:

  • Introduced a new UiMode.Wear and logic to detect watch devices, defaulting to Wear UI mode on such devices. Provided Wear-specific navigation scaffolding, screens, and protected routes to handle feature availability and display appropriate messages or screens (e.g., install required, safe mode warnings). [1] [2] [3]
  • Updated MainScreen, bottom bar, and color schemes to support Wear UI, ensuring consistent visual integration. [1] [2] [3]

Feature gating and shortcut handling:

  • Added checks to prevent access to kernel-dependent features and shortcuts on Wear OS when not supported, improving stability and user experience. [1] [2]

Settings and configuration:

  • Added a screenShape property to SettingsRepository to distinguish between round and square screens, enabling further UI customization for different Wear devices. [1] [2]

Codebase improvements and refactoring:

  • Refactored imports and composition locals to support Wear-specific theming and resource usage, and to cleanly separate logic for different UI modes. [1] [2] [3] [4]

These changes collectively allow the app to provide a robust and user-friendly experience on both phones and Wear OS devices, with clear separation and protection of features based on device capabilities.

Copilot AI review requested due to automatic review settings April 28, 2026 12:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Wear OS support to the manager app by introducing a dedicated Wear UI mode, Wear-specific Compose screens/navigation, and capability-based gating for kernel-dependent features so the app can run on watches with an adapted experience.

Changes:

  • Introduced UiMode.Wear with device detection + new Wear theme/scaffold and a set of Wear-optimized screens.
  • Added feature gating (e.g., kernel feature availability, safe mode handling) and adjusted shortcut/deeplink flows for Wear.
  • Added settings support for Wear screen shape (round/square) and wired it through repositories/viewmodels.

Reviewed changes

Copilot reviewed 59 out of 59 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
manager/gradle/libs.versions.toml Adds Wear Compose dependency coordinates/versions.
manager/app/src/main/res/values/strings.xml Adds Wear-related UI strings and some shared action labels.
manager/app/src/main/res/values-zh-rCN/strings.xml Adds partial zh-CN translations for new Wear strings.
manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIScreen.kt Routes WebUI event handling for UiMode.Wear.
manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt Adds Wear loading UI branch for WebUI activity.
manager/app/src/main/java/me/weishu/kernelsu/ui/webui/MonetColorsProvider.kt Adds Wear CSS token mapping using Wear Material3 color scheme.
manager/app/src/main/java/me/weishu/kernelsu/ui/wear/WearMainScreen.kt Adds Wear main menu + placeholder/protected screens.
manager/app/src/main/java/me/weishu/kernelsu/ui/wear/WearComponents.kt Introduces reusable Wear UI components and padding helpers.
manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/SettingsViewModel.kt Adds hasKsu, canUseKernelFeatures, and screen shape to settings state; adds setter.
manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/MainActivityViewModel.kt Adds screen shape to main UI state and preferences observation list.
manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/MainActivityUiState.kt Adds screenShape field with defaulting logic.
manager/app/src/main/java/me/weishu/kernelsu/ui/util/ExternalUrl.kt Adds helper for opening external URLs with toast fallback.
manager/app/src/main/java/me/weishu/kernelsu/ui/theme/WearTheme.kt Adds dedicated Wear Material3 theme and color mapping from dynamic scheme.
manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt Routes UiMode.Wear to Wear theme wrapper.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/templateeditor/TemplateEditorWear.kt Adds Wear UI for template editor.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/templateeditor/TemplateEditorScreen.kt Hooks Wear template editor into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/template/TemplateWear.kt Adds Wear UI for templates list.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/template/TemplateScreen.kt Wires Wear template list + navigation behavior.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/superuser/SuperUserWear.kt Adds Wear UI for superuser list and actions.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/superuser/SuperUserScreen.kt Hooks Wear superuser pager into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/sulog/SulogWear.kt Adds Wear UI for SU log browsing/filtering.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/sulog/SulogScreen.kt Hooks Wear SU log screen into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/settings/SettingsWear.kt Adds Wear settings screen including toggles and screen shape.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/settings/SettingsUiState.kt Adds capability flags + screen shape to settings state and actions.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/settings/SettingsScreen.kt Adds Wear settings pager and updates UI mode selection logic.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/modulerepo/ModuleRepoWear.kt Adds Wear module repo list/detail screens including download/install flow.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/modulerepo/ModuleRepoScreen.kt Adds Wear module repo wiring and switches URL opening to openExternalUrl.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/module/ModuleWear.kt Adds Wear module management UI (enable/disable/update/actions).
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/module/ModuleScreen.kt Hooks Wear module pager into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/install/InstallWear.kt Adds Wear install flow UI.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/install/InstallScreen.kt Hooks Wear install screen into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/home/HomeWear.kt Adds Wear home/status UI and navigation actions.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/home/HomeScreen.kt Adjusts home navigation for Wear vs non-Wear and uses openExternalUrl.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/flash/FlashWear.kt Adds Wear flash progress/result UI.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/flash/FlashScreen.kt Hooks Wear flash screen into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/executemoduleaction/ExecuteModuleActionWear.kt Adds Wear execute-module-action UI.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/executemoduleaction/ExecuteModuleActionScreen.kt Hooks Wear execute-module-action screen into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/colorpalette/ColorPaletteWear.kt Adds Wear theme settings note screen.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/colorpalette/ColorPaletteScreen.kt Hooks Wear color palette screen into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/appprofile/AppProfileWear.kt Adds Wear app profile UI.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/appprofile/AppProfileScreen.kt Hooks Wear app profile screen into mode switch.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/about/AboutWear.kt Adds Wear about screen UI.
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/about/AboutScreen.kt Adds Wear about screen wiring and uses openExternalUrl.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/uninstalldialog/UninstallDialog.kt Routes Wear mode to Material uninstall dialog implementation.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/statustag/StatusTag.kt Routes Wear mode to Material status tag implementation.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/rebootlistpopup/RebootListPopup.kt Routes Wear mode to Material reboot list popup implementation.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/ProfileConfig.kt Routes Wear mode to Material profile config implementations.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/markdown/MarkdownContent.kt Adds Wear branch for markdown container/loading styling.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/markdown/GithubMarkdown.kt Adds Wear color mapping for markdown rendering.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/dialog/Dialog.kt Routes Wear mode to Material dialog implementations.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/choosekmidialog/ChooseKmiDialog.kt Routes Wear mode to Material choose-KMI dialog implementation.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/bottombar/BottomBar.kt Routes Wear mode to Material bottom bar / navigation rail implementation.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/AppIconImage.kt Adds Wear branch for placeholder colors.
manager/app/src/main/java/me/weishu/kernelsu/ui/UiMode.kt Adds UiMode.Wear, watch detection, and screen-shape composition local.
manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt Adds Wear scaffold/navigation, protected routes, screen shape wiring, and shortcut gating.
manager/app/src/main/java/me/weishu/kernelsu/data/repository/SettingsRepositoryImpl.kt Persists screenShape with a sensible default from configuration.
manager/app/src/main/java/me/weishu/kernelsu/data/repository/SettingsRepository.kt Adds screenShape to settings repository contract.
manager/app/src/main/AndroidManifest.xml Declares watch feature, Wear standalone metadata, and Wear URI redirect permission.
manager/app/build.gradle.kts Adds Wear Compose dependencies and excludes conflicting Navigation3 UI artifact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/theme/WearTheme.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/screen/about/AboutWear.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/util/ExternalUrl.kt
Copilot AI added a commit to suqi8/KernelSUWear that referenced this pull request Apr 28, 2026
@suqi8 suqi8 marked this pull request as draft April 28, 2026 15:01
@suqi8 suqi8 marked this pull request as ready for review April 28, 2026 15:01
@suqi8 suqi8 requested a review from Copilot April 28, 2026 15:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 60 out of 60 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/util/ExternalUrl.kt Outdated
Comment thread manager/app/src/main/res/values-zh-rCN/strings.xml
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 60 out of 60 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt:597

  • In the "module_webui" shortcut branch, the intent extras ("shortcut_type"/"module_id") aren’t cleared after handling. This can cause the shortcut to be re-processed later if the activity intent is reused (e.g., configuration changes / subsequent intentState updates). Clear the extras here the same way as in the "module_action" branch after starting WebUIActivity.
                val moduleId = intent.getStringExtra("module_id") ?: return@LaunchedEffect
                val webIntent = Intent(context, WebUIActivity::class.java)
                    .setData("kernelsu://webui/$moduleId".toUri())
                context.startActivity(webIntent)
            }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/UiMode.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/UiMode.kt Outdated
Comment thread manager/app/build.gradle.kts Outdated
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.

2 participants