Use LaunchActivity in HaControlsPanel#6870
Open
TimoPtr wants to merge 3 commits into
Open
Conversation
50 tasks
Contributor
There was a problem hiding this comment.
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
showWhenLockedparameter toLaunchActivity.newInstance()and apply it duringonCreate - Update
HaControlsPanelActivityto launchLaunchActivity(with deep link +showWhenLocked = true) whenWIPFeature.USE_FRONTEND_V2is enabled - Add Robolectric tests covering the new
showWhenLockedbehavior inLaunchActivity
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)) | ||
| } |
Member
Author
There was a problem hiding this comment.
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)) | ||
| } |
Member
Author
There was a problem hiding this comment.
This is currently matching the current behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
setShowWhenLockedflag. Today it is behind the WIPFeature.Checklist