This reverts commit 54fcef9887.
Please do not submit unrelated docs and codes in the same commit. I am reverting this commit so that the related files can be submitted in better-organized future commits.
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
# Copyright 2026 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
import sys
|
|
|
|
from adbutils import AdbClient
|
|
from rich.console import Console
|
|
|
|
|
|
def display_device_status(console: Console, adb_client: AdbClient | None = None):
|
|
"""Checks for connected devices and displays the status."""
|
|
console.print("\n[bold]📱 Device Status[/bold]")
|
|
devices = None
|
|
if adb_client is not None:
|
|
devices = adb_client.device_list()
|
|
if devices:
|
|
console.print("✅ [bold green]Android device(s) connected:[/bold green]")
|
|
for device in devices:
|
|
console.print(f" - {device.serial}")
|
|
else:
|
|
console.print("❌ [bold red]No Android device found.[/bold red]")
|
|
command = "emulator -avd <avd_name>"
|
|
if sys.platform not in ["win32", "darwin"]:
|
|
command = f"./{command}"
|
|
console.print(
|
|
f"You can start an emulator using a command like: [bold]'{command}'[/bold]"
|
|
)
|