Skip to content

halaprix/leakwatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

LeakWatch

A battery-frugal monitor for Huawei watches and HMS phones.

Watches the watcher. Samples batteryInfo on a Huawei smartwatch, ships it over HMS Wear Engine to a Huawei phone, and draws the drain curve. Designed so the monitor itself costs less than 0.5%/24h.

License Status Platform HMS PRs Welcome Conventional Commits


✨ Why LeakWatch?

AccuBattery, BatteryGuru, BetterBatteryStats β€” none of them ship on HMS-only Huawei phones because there is no GMS, no Play Store, no Firebase. The market gap is real, and a battery monitor that itself drains the battery is a joke. LeakWatch is built on three principles:

  1. Frugal by default. Hard-mode sampling, batched flush, listener-driven (not polled).
  2. HMS-native. No GMS, no Firebase. HMS Wear Engine, HMS Analytics, HMS Crash.
  3. Open, on Huawei's terms. Apache-2.0, lives on the AppGallery when it's ready.

The name is a double meaning: leak (battery leak) + watch (the wrist thing).


πŸ“Š Platform Support

Component Status Notes
Huawei Watch 5 / GT 5 Pro (HarmonyOS NEXT) βœ… Target ArkTS, @ohos.batteryInfo
Huawei Watch GT 4 / Watch 4 (HarmonyOS 4) 🟑 Planned AOSP-compat layer; verify batteryInfo parity
Huawei phone with HMS (no GMS) βœ… Target Kotlin + Compose + HMS Core
Huawei phone with GMS (e.g. P30 global) ❌ Out of scope Use AccuBattery instead
Non-Huawei Android ❌ Out of scope HMS is the whole point
iOS ❌ Out of scope No HMS path

πŸ—οΈ Architecture (Preview)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    Wear Engine P2P     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Huawei Watch    β”‚ ─────────────────────▢ β”‚  Huawei Phone    β”‚
β”‚  (ArkTS)         β”‚   batched every 10min  β”‚  (Kotlin)        β”‚
β”‚                  β”‚                        β”‚                  β”‚
β”‚  BatteryMonitor  β”‚                        β”‚  WearEngine      β”‚
β”‚  + RDB history   β”‚                        β”‚  Receiver        β”‚
β”‚  + Service Ext.  β”‚                        β”‚  + Room          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β”‚  + Compose chart β”‚
                                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Watch side samples batterySOC, chargingStatus, batteryTemperature, voltage every 120s (not 60s) and flushes batches every 10min over HMS Wear Engine P2P once the watch sender is verified on device.
  • Phone side persists, aggregates daily, and draws the drain curve with a Compose Canvas chart.
  • No foreground service on the watch. Service Extension + work scheduling only.
  • Total target drain: < 0.5%/24h on the watch; measured device evidence is still pending in docs/BATTERY_BUDGET.md.

Full architecture: docs/ARCHITECTURE.md.


🚧 Status

Alpha (v0.4.0). Watch battery monitor, phone analytics, and the phone-side HMS receiver are in place; real watch→phone E2E remains pending device verification. Next milestones:

  • v0.1.0-alpha β€” Watch-side BatteryMonitor sampling loop (ArkTS) + RDB
  • v0.2.0-alpha β€” Phone-side Wear Engine receiver + Room persistence
  • v0.3.0-alpha β€” Compose chart, daily aggregation, drain rate
  • v0.4.0-alpha β€” HMS Wear Engine phone receiver implementation (v0.4.0-alpha.1 tagged; watch sender/device E2E pending)
  • v0.5.0-alpha β€” Privacy policy + AppGallery submission
  • v1.0.0 β€” First public release

See CHANGELOG.md for what landed when.


πŸ› οΈ Tech Stack

Layer Choice Why
Watch (ArkTS) @ohos.batteryInfo + RelationalStore First-party, no permissions, API 6+
Watch ↔ Phone HMS Wear Engine 5.0.1.300 P2P, idiomatic, exposes wearable battery
Phone (Kotlin) 2.0 + Jetpack Compose Material 3 Modern, Marian-familiar
Phone storage Room 2.6.1 Reliable, KSP-friendly
Phone charts Compose Canvas Buildable lightweight chart; Vico may return later on a pinned version
HMS analytics HMS Analytics 6.13 + HMS Crash Replaces Firebase
Build (watch) Hvigor 5.1.0+ DevEco Studio standard
Build (phone) Gradle 8.7 + AGP 8.5 Standard Android toolchain

🏁 Getting Started

⚠️ Alpha code exists. The watch/ and phone/ modules build through CI structure/Android gates, but real device E2E still requires AGC Wear Engine setup and watch-side verification.

Prerequisites

  • DevEco Studio 5.1.0+ (HarmonyOS NEXT) β€” for the watch module
  • Android Studio Koala+ with HMS Toolkit plugin β€” for the phone module
  • JDK 17+, Node.js 20+ (for tooling)
  • A Huawei Developer account β€” to apply for HMS Wear Engine Kit in AppGallery Connect

Local setup

git clone https://github.com/halaprix/leakwatch
cd leakwatch
# Phone module: open phone/ in Android Studio or run Gradle with JDK 17.
# Watch module: open watch/ in DevEco Studio.
# Real P2P requires AGC Wear Engine approval and local, uncommitted config.

Contributing

We welcome issues, PRs, and watch reports. Read CONTRIBUTING.md first β€” Conventional Commits are mandatory and one-commit-per-fix is the rule.


🀝 Code of Conduct

This project follows the Contributor Covenant v2.1. Be excellent to each other.


πŸ” Security & Privacy

See SECURITY.md for the security policy and docs/PRIVACY.md for the AppGallery privacy-policy skeleton. LeakWatch does not collect personal data, does not phone home beyond HMS Analytics, and does not store anything outside the device unless you opt in.


πŸ“œ License

Apache License 2.0 β€” consistent with HMS-Wearable-Example and friendly to HMS ecosystem contributors.


πŸ’¬ Contact

About

Battery-frugal monitor for Huawei watches and HMS phones. Hard-mode sampling, <0.5%/24h drain.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors