Conversation
…allback - Created NetworkChangeReceiver extending BroadcastReceiver - Follows BootReceiver pattern for code style consistency - Handles CONNECTIVITY_ACTION and WiFi state change intents - Checks for active WiFi connection using NetworkCapabilities - Includes companion methods for modern NetworkCallback registration - Placeholder for auto-reconnect logic (to be added in subtask-2-2) - Includes comprehensive logging for debugging Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…hangeReceiver - Added coroutine imports (CoroutineScope, Dispatchers, launch) - Check if auto-reconnect is enabled via PrefsManager.isAutoReconnectEnabled() - Get current ADB status to verify it was previously enabled - Re-enable ADB on port using AdbManager.enable() in IO coroutine - Follows BootReceiver pattern for async operations - Only reconnects if ADB was already enabled before network change Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ted networks - Add WifiManager import for SSID detection - Implement getCurrentWifiSsid() to get current WiFi SSID - Check trusted networks before auto-reconnect - Skip auto-reconnect if network is not trusted - Allow all networks if trusted list is empty - Proper error handling and logging throughout Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4431f3611b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <receiver | ||
| android:name=".NetworkChangeReceiver" | ||
| android:enabled="true" | ||
| android:exported="false"> | ||
| <intent-filter> | ||
| <action android:name="android.net.conn.CONNECTIVITY_ACTION" /> | ||
| </intent-filter> |
There was a problem hiding this comment.
Use a manifest CONNECTIVITY_ACTION receiver won’t fire on API 24+
Because the app targets SDK 34, a manifest-declared receiver for android.net.conn.CONNECTIVITY_ACTION will not receive broadcasts on Android 7.0+; those implicit broadcasts are delivered only to context-registered receivers. That means NetworkChangeReceiver won’t be invoked in normal production scenarios, so auto‑reconnect never triggers. Consider switching to ConnectivityManager.registerNetworkCallback (or dynamically registering a receiver) instead of relying on the manifest entry.
Useful? React with 👍 / 👎.
| } | ||
| return START_STICKY | ||
| } | ||
| ACTION_NETWORK_CHANGED -> { | ||
| handleNetworkChange() | ||
| return START_STICKY | ||
| } |
There was a problem hiding this comment.
Starting the service from a broadcast can crash in background
The network-change path calls AdbService.onNetworkChanged from a manifest receiver, which uses context.startService(...). On Android 8.0+, starting a background service from a broadcast receiver throws IllegalStateException unless it’s a foreground service; additionally, the ACTION_NETWORK_CHANGED branch never calls startForeground, so a newly started service can’t promote itself within the 5‑second window. If the service isn’t already running (e.g., killed while ADB remains enabled), the auto‑reconnect flow will crash instead of updating the notification.
Useful? React with 👍 / 👎.
Automatically re-enable wireless ADB when the device connects to a new WiFi network or when the network changes. Maintains connection continuity across network transitions.