Skip to content

Add ADB server start and stop commands #30

Description

@SamratB8

Summary

Add service-layer support for starting and stopping the Android Debug Bridge server.

The implementation should wrap:

adb start-server

and:

adb kill-server

The commands should use the shared process runner and return structured results instead of exposing raw process handling to WinUI.

Background

ADB may be installed correctly while its background server is stopped, unresponsive, or in need of a restart.

Providing basic server controls will help users recover from common ADB connection problems without opening a separate terminal.

Dependencies

This issue depends on:

The service should use the configured or detected ADB path.

Proposed Service API

Possible methods:

Task<AdbCommandResult> StartServerAsync(
    CancellationToken cancellationToken = default);
Task<AdbCommandResult> StopServerAsync(
    CancellationToken cancellationToken = default);
Task<AdbCommandResult> RestartServerAsync(
    CancellationToken cancellationToken = default);

RestartServerAsync is optional but may be implemented by stopping and starting the server in sequence.

Service Requirements

The implementation should:

  • Use the existing process runner
  • Use argument-safe process execution
  • Avoid shell-command string concatenation
  • Run asynchronously
  • Support cancellation
  • Capture standard output
  • Capture standard error
  • Capture the process exit code
  • Return structured success and failure information
  • Handle missing ADB configuration
  • Handle process-start failures
  • Avoid throwing for normal command failures
  • WinUI Requirements

Add simple controls to an appropriate page or panel:

  • Start ADB Server
  • Stop ADB Server
  • Restart ADB Server, if included
  • A visible in-progress state
  • Clear success or failure messages

Commands should be written to the existing output or log panel.

The controls should be disabled while the same operation is already in progress.

Tasks

  • Add start-server service method
  • Add kill-server service method
  • Optionally add restart-server service method
  • Use the configured ADB executable path
  • Return structured command results
  • Add cancellation support
  • Add WinUI controls
  • Display command progress
  • Display success and failure output
  • Add logs for each operation
  • Add tests for command construction where practical
  • Error Cases

Handle at least:

  • ADB path is missing
  • ADB executable no longer exists
  • ADB cannot be started
  • ADB exits with a non-zero code
  • Operation is cancelled
  • Process runner returns no output
  • Stop is requested when the server is not running

Stopping an already stopped server should result in a useful status rather than an application crash.

Out of Scope

This issue does not need to:

  • Install or download ADB
  • Detect Android devices
  • Parse adb devices
  • Restart individual devices
  • Restart Android emulators
  • Manage system services
  • Require administrator privileges
  • Add automatic background health monitoring
  • Automatically restart ADB without user action

Acceptance Criteria

  • The application can run adb start-server.
  • The application can run adb kill-server.
  • A restart action works if it is included.
  • Commands use the shared process runner.
  • Commands do not block the WinUI thread.
  • Missing ADB produces a clear message.
  • Standard output, standard error, and exit code are captured.
  • Results appear in the output or log panel.
  • Repeated button presses do not start overlapping identical operations.
  • Cancellation is handled safely.
  • The full solution builds successfully in Debug and Release configurations.
  • No new compiler warnings are introduced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    adbWork involving Android Debug Bridge integration, device communication, commands, and diagnostics.enhancementNew feature or requesthelp wantedExtra attention is neededphase-1Work planned for the first development phase and initial usable project foundation.winuiWork related to the WinUI 3 desktop interface, windows, controls, styling, and user experience.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions