Skip to content

Use LaunchActivity in HaControlsPanel#6870

Open
TimoPtr wants to merge 3 commits into
mainfrom
feature/show_in_lock
Open

Use LaunchActivity in HaControlsPanel#6870
TimoPtr wants to merge 3 commits into
mainfrom
feature/show_in_lock

Conversation

@TimoPtr
Copy link
Copy Markdown
Member

@TimoPtr TimoPtr commented May 20, 2026

Summary

In order to be able to use the FrontendScreen in the lock screen when using a dashboard has ControlPanel we need the LaunchActivity to set the setShowWhenLocked flag. Today it is behind the WIPFeature.

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines.
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered.
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

Copilot AI review requested due to automatic review settings May 20, 2026 09:02
@TimoPtr TimoPtr requested a review from jpelgrom May 20, 2026 09:02
@TimoPtr TimoPtr added the WebViewActivity replacement Ongoing work to replace the WebViewActivity in favor of a well tested compose screen using nav. label May 20, 2026
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

This PR enables LaunchActivity to optionally render over the lock screen (via setShowWhenLocked) so the device controls panel can launch the new Compose-based frontend (FrontendScreen) while the device is locked.

Changes:

  • Add an optional showWhenLocked parameter to LaunchActivity.newInstance() and apply it during onCreate
  • Update HaControlsPanelActivity to launch LaunchActivity (with deep link + showWhenLocked = true) when WIPFeature.USE_FRONTEND_V2 is enabled
  • Add Robolectric tests covering the new showWhenLocked behavior in LaunchActivity

Reviewed changes

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

File Description
app/src/main/kotlin/io/homeassistant/companion/android/launch/LaunchActivity.kt Introduces showWhenLocked intent extra handling for lock-screen display
app/src/main/kotlin/io/homeassistant/companion/android/controls/HaControlsPanelActivity.kt Switches controls panel launch target to LaunchActivity for Frontend v2 and enables lock-screen display
app/src/test/kotlin/io/homeassistant/companion/android/launch/LaunchActivityTest.kt Adds tests validating showWhenLocked behavior

Comment on lines +139 to +143
// Must run before super.onCreate so the window flag is set before the platform decides
// whether to draw over the keyguard. Only applied when the caller opts in explicitly.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && intent.hasExtra(EXTRA_SHOW_WHEN_LOCKED)) {
setShowWhenLocked(intent.getBooleanExtra(EXTRA_SHOW_WHEN_LOCKED, false))
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jpelgrom what do you think?

Copy link
Copy Markdown
Member Author

@TimoPtr TimoPtr May 20, 2026

Choose a reason for hiding this comment

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

I've applied the logic and used an alias and check the component name within the Intent. I hope it's enough.

Comment on lines +141 to +143
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && intent.hasExtra(EXTRA_SHOW_WHEN_LOCKED)) {
setShowWhenLocked(intent.getBooleanExtra(EXTRA_SHOW_WHEN_LOCKED, false))
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is currently matching the current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed WebViewActivity replacement Ongoing work to replace the WebViewActivity in favor of a well tested compose screen using nav.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants