-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.go
More file actions
93 lines (80 loc) · 2.46 KB
/
app.go
File metadata and controls
93 lines (80 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package main
import (
"context"
"sync"
)
// DeviceMode represents whether a device is in ADB or Fastboot mode
type DeviceMode string
const (
DeviceModeUnknown DeviceMode = "unknown"
DeviceModeADB DeviceMode = "adb"
DeviceModeFastboot DeviceMode = "fastboot"
)
// Device represents a connected ADB device
type Device struct {
Serial string `json:"serial"`
Status string `json:"status"`
}
// DeviceInfo holds detailed information about a connected device
type DeviceInfo struct {
Model string `json:"model"`
AndroidVersion string `json:"androidVersion"`
BuildNumber string `json:"buildNumber"`
BatteryLevel string `json:"batteryLevel"`
Serial string `json:"serial"`
IPAddress string `json:"ipAddress"`
RootStatus string `json:"rootStatus"`
Codename string `json:"codename"`
RamTotal string `json:"ramTotal"`
StorageInfo string `json:"storageInfo"`
Brand string `json:"brand"`
DeviceName string `json:"deviceName"`
SecurityPatch string `json:"securityPatch"`
Uptime string `json:"uptime"`
BootloaderStatus string `json:"bootloaderStatus"`
ScreenResolution string `json:"screenResolution"`
BasebandVersion string `json:"basebandVersion"`
KernelVersion string `json:"kernelVersion"`
CPUArch string `json:"cpuArch"`
}
// FileEntry represents a file or directory on the device
type FileEntry struct {
Name string `json:"name"`
Type string `json:"type"`
Size string `json:"size"`
Permissions string `json:"permissions"`
Date string `json:"date"`
Time string `json:"time"`
}
// PackageInfo represents an installed app package
type PackageInfo struct {
PackageName string `json:"packageName"`
IsEnabled bool `json:"isEnabled"`
}
// AdbConfig holds user-configurable ADB settings
type AdbConfig struct {
AdbPath string `json:"adbPath"`
FastbootPath string `json:"fastbootPath"`
}
// App is the main application struct
type App struct {
ctx context.Context
config AdbConfig
// binary path cache
binaryCache map[string]string
cacheMutex sync.RWMutex
// cancellation for long-running ops
currentCancel context.CancelFunc
opMutex sync.Mutex
}
// NewApp creates a new App instance
func NewApp() *App {
return &App{
binaryCache: make(map[string]string),
config: AdbConfig{},
}
}
// Startup is called when the app starts
func (a *App) Startup(ctx context.Context) {
a.ctx = ctx
}