Skip to content

tferr/Captivity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Captivity for Wear OS

A small standalone utility for Wear OS to toggle the captive_portal_mode system flag on watches with dual architecture like the One Plus watch 3. Works directly on the watch without a phone connection.

Why?

Wear OS's captive portal detection actively disconnects the watch from networks that require a browser-based login (hotel WiFi, gym, etc.). The setting responsible, captive_portal_mode, can be disabled via ADB. However, on devices with a Dual-Engine Architecture (at least on the OnePlus Watch 3), the flag seems to be silently reset every time the watch exits deep sleep.

These watches use a low-power RTOS (Real-Time Operating System) co-processor to handle sleep and sensors. When the main CPU wakes and Wear OS re-initializes, Settings.Global values seem to be restored to factory defaults (captive_portal_mode = 2), as if the watch had rebooted. A one-time ADB fix does not seem to survive this cycle in these devices.

This fixes this issue with two layers of protection:

  • A BroadcastReceiver listening for ACTION_BOOT_COMPLETED applies the fix immediately every time Wear OS re-initializes after deep sleep (in the One Plus watch this matches the "Sleep mode" to "Smart mode" transition)
  • A WorkManager periodic worker runs hourly as a safety net, correcting the flag if it was reset while Wear OS was already running

Both layers skip when Power Save Mode is active. This lets you apply and maintain Wi-Fi connectivity to these networks directly from the watch, without a paired phone or a computer running ADB nearby.

Permissions

This app requires the WRITE_SECURE_SETTINGS permission. Since this is a protected system permission, it must be granted manually via ADB:

adb shell pm grant com.tferr.captivity android.permission.WRITE_SECURE_SETTINGS

How to Build

  1. Clone the repository
  2. Open in Android Studio
  3. Build using ./gradlew assembleRelease
  4. Install and grant permission in one go:
./gradlew assembleRelease
adb pair 192.X.X.X:<connection-port>
adb connect 192.X.X.X:<connection-port>
adb install -r app/build/outputs/apk/release/Captivity-release-1.0.apk
adb shell pm grant com.tferr.captivity android.permission.WRITE_SECURE_SETTINGS

About

Allow Wear OS to connect to captive portal Wi-Fi networks

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages