Wake device before launching Android apps - #12322
Open
jonathanpeppers wants to merge 2 commits into
Open
Conversation
Wake sleeping devices and dismiss non-secure keyguards before starting deployed applications, keeping preparation and launch in one adb shell invocation. Add --no-wake-device as an escape hatch through the existing _AndroidRunExtraArgs passthrough and cover both command modes in device integration tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Microsoft.Android.Run to proactively wake an Android device and dismiss a non-secure keyguard before launching an app activity, with an opt-out flag (--no-wake-device) and a device integration test validating both behaviors.
Changes:
- Added
--no-wake-deviceoption toMicrosoft.Android.Runto skip wake/keyguard dismissal. - Updated the activity-start adb invocation to include wake + keyguard dismissal when enabled.
- Extended device integration coverage to assert the adb command-line behavior with and without wakeup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Microsoft.Android.Run/Program.cs | Adds wake/keyguard behavior to the adb shell … am start … launch path and introduces --no-wake-device. |
| tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs | Adds parameterized test coverage asserting wake vs. non-wake dotnet run behavior via verbose output. |
Treat wakeup and keyguard dismissal as best effort so unsupported or secure-device behavior cannot prevent am start from running or control its exit status. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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
Microsoft.Android.Runstarts an activityadb shellinvocation--no-wake-device, available to MSBuild callers through$(_AndroidRunExtraArgs), as an escape hatchFixes #11064.
Testing
Xamarin.Android.slnand configured the local Android workloaddotnet new androidtemplatedotnet-local.cmd runon a sleeping, locked physical device--no-wake-deviceomits both device-preparation commands