Skip to content

Fix/fix background coonnectivity - #28

Merged
nur-shuvo merged 2 commits into
mainfrom
fix/fix-background-coonnectivity
Aug 24, 2026
Merged

nur-shuvo merged 2 commits into
mainfrom
fix/fix-background-coonnectivity

Conversation

@Shakibuzzaman3104

Copy link
Copy Markdown
Collaborator

What

Makes Android DevConsole server startup predictable and responsive by binding before timeline hydration, preferring port 8080, and restarting SDK-owned listeners safely. It also moves LAN permission handling into the SDK UI, keeps notifications optional, defaults browser access to open mode with same-origin protection, and keeps no-op release artifacts permission-free.

Verification

  • Relevant unit tests — passing

    ANDROID_HOME=/Users/pathaoltd/Library/Android/sdk ./gradlew \
      :sdk:api:test \
      :sdk:server-api:test \
      :sdk:server-ktor:test \
      :sdk:full:testDebugUnitTest \
      :sdk:ui-compose:testDebugUnitTest \
      :gradle-plugin:test
  • ktlintCheck and detekt — clean

    ./gradlew \
      :sdk:api:ktlintCheck \
      :sdk:server-api:ktlintCheck \
      :sdk:server-ktor:ktlintCheck \
      :sdk:full:ktlintCheck \
      :sdk:ui-compose:ktlintCheck
    
    ./gradlew \
      :sdk:full:detekt \
      :sdk:server-ktor:detekt \
      :sdk:ui-compose:detekt
  • apiCheck — clean

    ./gradlew \
      :sdk:api:apiCheck \
      :sdk:server-api:apiCheck \
      :sdk:server-ktor:apiCheck \
      :sdk:ui-compose:apiCheck
  • Debug/release and protected-variant boundaries verified

    ./gradlew \
      :samples:compose-app:assembleDebug \
      :samples:compose-app:assembleRelease \
      :samples:foundation-app:assembleDebug \
      :samples:foundation-app:assembleRelease \
      :samples:views-java-app:assembleDebug \
      :samples:views-java-app:assembleRelease

    The release builds also ran and passed their protected-artifact verification tasks. APK manifest inspection confirmed that release/no-op builds do not contain DevConsole LAN, Nearby Devices, notification, or foreground-service permissions.

  • git diff --check — clean

Checklist

  • Capture-path code (network/socket/push) never throws into the host app
  • No new sensitive data is captured, logged, or exported without going through RedactionEngine first
  • Docs updated for server lifecycle, permission, security, and port-selection behavior
  • This PR is scoped to improving the Android DevConsole server lifecycle and startup experience

Anything reviewers should look at closely

Please review the asynchronous timeline initialization and buffering path, particularly events captured between socket binding and Room session creation.

Port replacement intentionally applies only to a server owned by the current SDK runtime. If another process owns port 8080, the SDK falls back through ports 8081–8099 rather than attempting to terminate that process.

The LAN permission policy distinguishes NEARBY_WIFI_DEVICES from the newer ACCESS_LOCAL_NETWORK behavior. Notification permission is deliberately optional and is requested only after the server is running.

shakibuzzaman added 2 commits August 24, 2026 16:52
  - prefer port 8080 and fall back when occupied externally
  - restart the SDK-owned server before rebinding
  - bind immediately and hydrate persisted timeline asynchronously
  - request required LAN permissions before server startup
  - keep notification permission optional
  - default browser access to open mode with same-origin protection
  - synchronize notification stop actions with SDK UI state
  - keep no-op release artifacts permission-free
  - add tests and documentation for server lifecycle behavior
# Conflicts:
#	sdk/server-ktor/src/main/resources/devconsole-web/dashboard.js
@nur-shuvo
nur-shuvo merged commit 99c165f into main Aug 24, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DevConsole Server is not being connected, if the user app is kept in the background

2 participants