Skip to content

Implement Android package uninstall with confirmation #35

Description

@SamratB8

Summary

Add support for uninstalling a selected Android package from a selected device or emulator.

The WinUI interface must require explicit user confirmation before executing the uninstall command.

After a successful uninstall, the installed-package list should be refreshed or updated so it no longer displays the removed package.

Background

Package removal is a destructive action.

WinDroid Studio should ensure that the user clearly selected both the target device and package and confirmed the action before any uninstall command is executed.

Dependencies

This issue depends on:

ADB Command

The basic command is:

adb -s <device-serial> uninstall <package-name>

Arguments must be passed separately and safely.

Proposed Service API

Task<AdbCommandResult> UninstallPackageAsync(
    string deviceSerial,
    string packageName,
    CancellationToken cancellationToken = default);

Reuse existing command-result models where practical.

Validation Requirements

Before showing confirmation or running the command:

  • A device must be selected
  • A package must be selected
  • The package identifier must not be empty
  • The device serial must not be empty
  • Unsupported control characters must be rejected
  • ADB must be available

Confirmation Requirements

The confirmation dialog should clearly display:

  • The package identifier
  • The target device name or serial
  • A warning that the package will be removed from that Android target
  • Confirm and Cancel actions

The default focused action should not encourage accidental deletion.

Cancelling the dialog must perform no ADB command.

Service Requirements

The uninstall service should:

  • Use the shared process runner
  • Explicitly target the selected device
  • Pass command arguments safely
  • Run asynchronously
  • Support cancellation
  • Capture standard output
  • Capture standard error
  • Capture exit code
  • Return structured success and failure results

UI Requirements

The Apps interface should:

  • Provide an Uninstall action
  • Disable Uninstall when no package is selected
  • Display the confirmation dialog
  • Display progress while the command runs
  • Prevent repeated uninstall requests
  • Display success or failure in the output panel
  • Remove or refresh the package after success
  • Keep the package visible after failure

Tasks

  • Add an uninstall-package service method
  • Add device and package validation
  • Add safe process argument construction
  • Add cancellation support
  • Add Uninstall action to the Apps interface
  • Add a confirmation dialog
  • Display target device and package in the dialog
  • Add progress state
  • Log success and failure
  • Refresh or update package list after success
  • Add tests for validation and command construction

Error Cases

Handle at least:

  • No device selected
  • No package selected
  • Device disconnects before execution
  • Package is no longer installed
  • ADB is unavailable
  • Uninstall is rejected by Android
  • Command returns a non-zero exit code
  • Operation is cancelled
  • Package list refresh fails after successful uninstall

A successful uninstall should remain reported as successful even if the subsequent refresh fails. The refresh failure should be reported separately.

Out of Scope

This issue does not need to:

  • Keep application data with -k
  • Uninstall packages for a specific Android user
  • Disable system applications
  • Remove protected system packages
  • Batch-uninstall multiple packages
  • Create restore points
  • Back up application data
  • Reinstall packages
  • Add advanced administrator controls

Acceptance Criteria

  • A selected package can be uninstalled from the selected device.
  • No uninstall command runs without explicit confirmation.
  • The confirmation dialog identifies the package and device.
  • Cancelling the dialog performs no action.
  • Device serial and package identifier are passed safely.
  • Success and failure results are visible.
  • The package list updates after a successful uninstall.
  • A failed uninstall does not remove the package from the UI.
  • Repeated actions do not create overlapping uninstall commands.
  • The UI remains responsive while the command runs.
  • Relevant tests pass.
  • 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.apk managementInstalled app listing, launching, uninstalling, and Android package workflows.enhancementNew feature or requesthelp wantedExtra attention is neededphase-2Work planned for the second development phase after the initial foundation is complete.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