Skip to content

Commit 00eac03

Browse files
Added log download-share for onboarding and node - installer. Changed the structure for emulator install. (#680)
* Added an new endpoint to download installer related logs * separated the file for emulator install for mac and windows-linux. Fixed the emulator install bug by capping the latest API to level 36 , level 37 is not reliable still. Also prioritized host machine compatible architecture while downloading system-image, previously it was choosing the highest API regardless the host machine compatible architecture
1 parent 0211e1c commit 00eac03

24 files changed

Lines changed: 2586 additions & 504 deletions

Framework/install_handler/android/adb.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
import asyncio
33
import platform
44
import os
5+
from Framework.install_handler.install_log_config import get_logger
56
from Framework.install_handler.utils import send_response
67
from Framework.install_handler.android.android_sdk import update_android_sdk_path
78

9+
logger = get_logger()
10+
811

912
async def check_status() -> bool:
1013
"""Check if ADB (Android Debug Bridge) is installed."""
11-
print("[installer][android-adb] Checking status...")
14+
logger.info("[installer][android-adb] Checking status...")
1215

1316
try:
1417

@@ -26,7 +29,7 @@ async def check_status() -> bool:
2629
# If command succeeds (returncode = 0), ADB is installed
2730
if result.returncode == 0:
2831
version_output = (result.stdout or result.stderr).strip()
29-
print(f"[installer][android-adb] Already installed")
32+
logger.info("[installer][android-adb] Already installed")
3033
await send_response({
3134
"action": "status",
3235
"data": {
@@ -38,7 +41,7 @@ async def check_status() -> bool:
3841
})
3942
return True
4043
else:
41-
print("[installer][android-adb] Not installed")
44+
logger.info("[installer][android-adb] Not installed")
4245
await send_response({
4346
"action": "status",
4447
"data": {
@@ -50,7 +53,7 @@ async def check_status() -> bool:
5053
})
5154
return False
5255
except Exception as e:
53-
print(f"[installer][android-adb] Error checking status: {e}")
56+
logger.error("[installer][android-adb] Error checking status: %s", e)
5457
await send_response({
5558
"action": "status",
5659
"data": {
@@ -67,15 +70,15 @@ async def check_status() -> bool:
6770

6871
async def install():
6972
"""Install ADB - checks if already installed, otherwise prompts to install Android SDK."""
70-
print("[installer][android-adb] Installing...")
73+
logger.info("[installer][android-adb] Installing...")
7174

7275
# Check if ADB is already installed
7376
if await check_status():
74-
print("[installer][android-adb] ADB is already installed")
77+
logger.info("[installer][android-adb] ADB is already installed")
7578
return
7679

7780
# ADB is not installed, send response to install Android SDK
78-
print("[installer][android-adb] ADB is not installed. Install Android SDK to get ADB.")
81+
logger.info("[installer][android-adb] ADB is not installed. Install Android SDK to get ADB.")
7982
await send_response({
8083
"action": "status",
8184
"data": {
Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,78 @@
1-
async def check_status():
2-
print("[android_emulator] Checking status...")
1+
import platform
32

3+
from Framework.install_handler.install_log_config import get_logger
4+
from . import emulator as emulator_macos
5+
from . import emulator_windows_linux
6+
7+
logger = get_logger()
8+
9+
def _is_darwin() -> bool:
10+
return platform.system().lower() == "darwin"
11+
12+
13+
async def check_emulator_list():
14+
"""
15+
OS router for AndroidEmulator system images services.
16+
- macOS: uses `emulator.py`
17+
- Windows/Linux: uses `emulator_windows_linux.py`
18+
"""
19+
system = platform.system().lower()
20+
if system == "darwin":
21+
logger.debug("[android_emulator] Routing to macOS emulator module")
22+
return await emulator_macos.check_emulator_list()
23+
24+
logger.debug("[android_emulator] Routing to Windows/Linux emulator module")
25+
return await emulator_windows_linux.check_emulator_list()
26+
27+
28+
async def android_emulator_install():
29+
"""
30+
OS router for AndroidEmulator installation.
31+
- macOS: uses `emulator.py`
32+
- Windows/Linux: uses `emulator_windows_linux.py`
33+
"""
34+
system = platform.system().lower()
35+
if system == "darwin":
36+
logger.debug("[android_emulator] Routing to macOS emulator module")
37+
return await emulator_macos.android_emulator_install()
38+
39+
logger.debug("[android_emulator] Routing to Windows/Linux emulator module")
40+
return await emulator_windows_linux.android_emulator_install()
41+
42+
43+
async def create_avd_from_system_image(device_param: str) -> bool:
44+
"""
45+
Create an AVD from a chosen system-image device param.
46+
Routes to the correct platform implementation dynamically.
47+
"""
48+
if _is_darwin():
49+
logger.debug("[android_emulator] Routing create_avd to macOS module")
50+
return await emulator_macos.create_avd_from_system_image(device_param)
51+
logger.debug("[android_emulator] Routing create_avd to Windows/Linux module")
52+
return await emulator_windows_linux.create_avd_from_system_image(device_param)
53+
54+
55+
async def get_filtered_avd_services():
56+
"""
57+
Return filtered AVD services to display on the installer UI.
58+
Routes to the correct platform implementation dynamically.
59+
"""
60+
if _is_darwin():
61+
logger.debug("[android_emulator] Routing get_filtered_avd_services to macOS module")
62+
return await emulator_macos.get_filtered_avd_services()
63+
logger.debug("[android_emulator] Routing get_filtered_avd_services to Windows/Linux module")
64+
return await emulator_windows_linux.get_filtered_avd_services()
65+
66+
67+
async def launch_avd(avd_name: str) -> bool:
68+
"""
69+
Launch an existing AVD.
70+
Routes to the correct platform implementation dynamically.
71+
"""
72+
if _is_darwin():
73+
logger.debug("[android_emulator] Routing launch_avd to macOS module")
74+
return await emulator_macos.launch_avd(avd_name)
75+
logger.debug("[android_emulator] Routing launch_avd to Windows/Linux module")
76+
return await emulator_windows_linux.launch_avd(avd_name)
477

5-
async def install():
6-
print("[android_emulator] Installing...")
778

0 commit comments

Comments
 (0)