Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions .auto-claude-security.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"base_commands": [
".",
"[",
"[[",
"ag",
"awk",
"basename",
"bash",
"bc",
"break",
"cat",
"cd",
"chmod",
"clear",
"cmp",
"column",
"comm",
"command",
"continue",
"cp",
"curl",
"cut",
"date",
"df",
"diff",
"dig",
"dirname",
"du",
"echo",
"egrep",
"env",
"eval",
"exec",
"exit",
"expand",
"export",
"expr",
"false",
"fd",
"fgrep",
"file",
"find",
"fmt",
"fold",
"gawk",
"gh",
"git",
"grep",
"gunzip",
"gzip",
"head",
"help",
"host",
"iconv",
"id",
"jobs",
"join",
"jq",
"kill",
"killall",
"less",
"let",
"ln",
"ls",
"lsof",
"man",
"mkdir",
"mktemp",
"more",
"mv",
"nl",
"paste",
"pgrep",
"ping",
"pkill",
"popd",
"printenv",
"printf",
"ps",
"pushd",
"pwd",
"read",
"readlink",
"realpath",
"reset",
"return",
"rev",
"rg",
"rm",
"rmdir",
"sed",
"seq",
"set",
"sh",
"shuf",
"sleep",
"sort",
"source",
"split",
"stat",
"tail",
"tar",
"tee",
"test",
"time",
"timeout",
"touch",
"tr",
"tree",
"true",
"type",
"uname",
"unexpand",
"uniq",
"unset",
"unzip",
"watch",
"wc",
"wget",
"whereis",
"which",
"whoami",
"xargs",
"yes",
"yq",
"zip",
"zsh"
],
"stack_commands": [
"gradle",
"gradlew",
"kotlin",
"kotlinc"
],
"script_commands": [],
"custom_commands": [],
"detected_stack": {
"languages": [
"kotlin"
],
"package_managers": [
"gradle"
],
"frameworks": [],
"databases": [],
"infrastructure": [],
"cloud_providers": [],
"code_quality_tools": [],
"version_managers": []
},
"custom_scripts": {
"npm_scripts": [],
"make_targets": [],
"poetry_scripts": [],
"cargo_aliases": [],
"shell_scripts": []
},
"project_dir": "D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor",
"created_at": "2026-02-07T02:58:57.659663",
"project_hash": "e16dedeca885a75056448cf91f33beba"
}
25 changes: 25 additions & 0 deletions .auto-claude-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"active": true,
"spec": "005-connection-health-monitor",
"state": "building",
"subtasks": {
"completed": 11,
"total": 12,
"in_progress": 1,
"failed": 0
},
"phase": {
"current": "Integration & Testing",
"id": null,
"total": 2
},
"workers": {
"active": 0,
"max": 1
},
"session": {
"number": 14,
"started_at": "2026-02-07T02:58:43.952923"
},
"last_update": "2026-02-07T03:45:20.171135"
}
39 changes: 39 additions & 0 deletions .claude_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"sandbox": {
"enabled": true,
"autoAllowBashIfSandboxed": true
},
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Read(./**)",
"Write(./**)",
"Edit(./**)",
"Glob(./**)",
"Grep(./**)",
"Read(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor/**)",
"Write(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor/**)",
"Edit(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor/**)",
"Glob(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor/**)",
"Grep(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor/**)",
"Read(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor\\.auto-claude\\specs\\005-connection-health-monitor/**)",
"Write(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor\\.auto-claude\\specs\\005-connection-health-monitor/**)",
"Edit(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude\\worktrees\\tasks\\005-connection-health-monitor\\.auto-claude\\specs\\005-connection-health-monitor/**)",
"Read(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude/**)",
"Write(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude/**)",
"Edit(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude/**)",
"Glob(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude/**)",
"Grep(D:\\AI\\Android\\APK\\Android-Apps\\apps\\wirelessadb\\.auto-claude/**)",
"Bash(*)",
"WebFetch(*)",
"WebSearch(*)",
"mcp__context7__resolve-library-id(*)",
"mcp__context7__get-library-docs(*)",
"mcp__graphiti-memory__search_nodes(*)",
"mcp__graphiti-memory__search_facts(*)",
"mcp__graphiti-memory__add_episode(*)",
"mcp__graphiti-memory__get_episodes(*)",
"mcp__graphiti-memory__get_entity_edge(*)"
]
}
}
63 changes: 33 additions & 30 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
# Gradle
.gradle/
build/
!gradle/wrapper/gradle-wrapper.jar

# Android
*.apk
*.aab
*.ap_
*.dex
local.properties

# IDE
.idea/
*.iml
.DS_Store

# Research (local notes, not for repo)
research/

# Signing secrets (NEVER commit!)
*.keystore
*.jks
.env

# Screenshots and temp files
screenshot*.png
temp/
nul
.serena/
# Gradle
.gradle/
build/
!gradle/wrapper/gradle-wrapper.jar

# Android
*.apk
*.aab
*.ap_
*.dex
local.properties

# IDE
.idea/
*.iml
.DS_Store

# Research (local notes, not for repo)
research/

# Signing secrets (NEVER commit!)
*.keystore
*.jks
.env

# Screenshots and temp files
screenshot*.png
temp/
nul
.serena/

# Auto Claude data directory
.auto-claude/
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")

// WorkManager for background tasks
implementation("androidx.work:work-runtime-ktx:2.9.0")

// JSch for SSH tunneling (Warpgate)
implementation("com.jcraft:jsch:0.1.55")

Expand Down
56 changes: 53 additions & 3 deletions app/src/main/java/com/phenix/wirelessadb/AdbService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class AdbService : Service() {

companion object {
private const val CHANNEL_ID = "adb_service_channel"
private const val HEALTH_CHANNEL_ID = "adb_health_channel"
private const val NOTIFICATION_ID = 1001
private const val HEALTH_NOTIFICATION_ID = 1002
const val ACTION_PENDING_AUTH = "com.phenix.wirelessadb.PENDING_AUTH"
const val ACTION_APPROVE_DEVICE = "com.phenix.wirelessadb.APPROVE_DEVICE"
const val ACTION_DENY_DEVICE = "com.phenix.wirelessadb.DENY_DEVICE"
Expand Down Expand Up @@ -73,6 +75,19 @@ class AdbService : Service() {

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
when (intent?.action) {
"com.phenix.wirelessadb.HEALTH_DEGRADATION" -> {
val healthStatus = intent.getStringExtra("health_status") ?: "UNKNOWN"
val degradationDetected = intent.getBooleanExtra("degradation_detected", false)

val details = when {
healthStatus == "FAILED" -> "ADB connection is disabled or unreachable"
healthStatus == "DEGRADED" -> "ADB connection has changed (IP/port/network)"
else -> "Connection health issue detected"
}

showHealthDegradationAlert(healthStatus, details)
return START_NOT_STICKY
Comment on lines +98 to +102

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid starting foreground service without foregrounding

This branch posts a notification and returns without calling startForeground(). Because health alerts are triggered via startForegroundService(...) (see ConnectionHealthManager.triggerHealthNotification), Android O+ will throw ForegroundServiceDidNotStartInTimeException if the service wasn’t already running, causing a crash whenever a health alert fires while ADB service is stopped. Either use startService for this action or call startForeground when handling the health-degradation intent.

Useful? React with 👍 / 👎.

}
ACTION_APPROVE_DEVICE -> {
val clientIp = intent.getStringExtra(EXTRA_CLIENT_IP)
if (clientIp != null) {
Expand Down Expand Up @@ -152,19 +167,54 @@ class AdbService : Service() {

private fun createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
val manager = getSystemService(NotificationManager::class.java)

// Main service channel
val serviceChannel = NotificationChannel(
CHANNEL_ID,
"ADB Service",
NotificationManager.IMPORTANCE_LOW
).apply {
description = "Shows when Wireless ADB is active"
setShowBadge(false)
}
val manager = getSystemService(NotificationManager::class.java)
manager.createNotificationChannel(channel)
manager.createNotificationChannel(serviceChannel)

// Health notification channel
val healthChannel = NotificationChannel(
HEALTH_CHANNEL_ID,
"Connection Health",
NotificationManager.IMPORTANCE_DEFAULT
).apply {
description = "Alerts about ADB connection health issues"
setShowBadge(true)
}
manager.createNotificationChannel(healthChannel)
}
}

fun showHealthDegradationAlert(healthStatus: String, details: String) {
val pendingIntent = PendingIntent.getActivity(
this,
0,
Intent(this, MainActivity::class.java),
PendingIntent.FLAG_IMMUTABLE
)

val notification = NotificationCompat.Builder(this, HEALTH_CHANNEL_ID)
.setContentTitle("ADB Connection Health: $healthStatus")
.setContentText(details)
.setStyle(NotificationCompat.BigTextStyle().bigText(details))
.setSmallIcon(R.drawable.ic_notification)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setAutoCancel(true)
.setContentIntent(pendingIntent)
.build()

val manager = getSystemService(NotificationManager::class.java)
manager.notify(HEALTH_NOTIFICATION_ID, notification)
}

private fun createNotification(
ip: String,
port: Int,
Expand Down
Loading