thehardwarestore.ai

where AI agents shop for the right tools

$ show NoWakeLock/NoWakeLock

[account ↗] [repo ↗] APPLICATION ★ 312 20 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

NoWakeLock is a production-grade Android Xposed module and companion app that provides granular control over system power management. It intercepts and selectively blocks or limits WakeLocks, Alarms, and Services at the Android framework level via Xposed hooks, enabling users to reduce battery drain. The system consists of two processes: an Xposed module running in the system_server process that performs the actual interception using both legacy (XposedBridge) and modern (libxposed API 102) APIs, and a standard Android application with a Jetpack Compose UI that allows users to configure per-app and per-item blocking rules, view real-time statistics, and manage settings. Data flows from the Xposed hooks through a ContentProvider-based IPC (XProvider) into a dual Room database architecture (AppDatabase for configuration, InfoDatabase for runtime events). The app features Material Design 3, multi-language support, backup/restore via JSON, multi-user profiles, module health diagnostics, and hot reload support for modern Xposed frameworks. The codebase demonstrates a clean MVVM architecture with Koin dependency injection, Kotlin Coroutines/Flow for reactive data flow, and comprehensive unit/instrumentation tests. While primarily a standalone application, several core concurrency utilities (BoundedEventQueue, ReloadableEventConsumer, WakelockRegistry) could be extracted and reused in other Android or system-level projects.

RATING8.1/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS8
VELOCITY0.83
OPEN ISSUES3
CLOSED ISSUES36
LAST COMMIT1 month ago
Files by Type (count)
Markdown
230
Kotlin
208
XML
49
JSON
30
Text
21
HTML
16
Other (no ext)
12
Java
12
Other (.webp)
10
YAML
8
Other (.png)
6
Other (.mdc)
5
Files by Type (size)
Markdown
2MB
Kotlin
881KB
Other (.png)
261KB
JSON
188KB
HTML
166KB
XML
135KB
Other (no ext)
58KB
Other (.mdc)
54KB
Other (.jar)
42KB
YAML
42KB
Other (.webp)
38KB
Java
31KB

The LLM identified 4 files worth highlighting for reuse:

A thread-safe, multi-producer single-consumer bounded queue that atomically tracks rejections. The queue has a fixed capacity and a 'retire' mechanism to prevent new offers after shutdown. It uses a ConcurrentLinkedQueue for the internal buffer and AtomicInteger for rejection counting, with a non-blocking offer and a blocking drain. This is a reusable concurrency primitive for event processing pipelines.

file: app/src/main/java/com/js/nowakelock/data/counter/BoundedEventQueue.kt ↗ | tags: #concurrency #producer-consumer #bounded-queue

A coroutine-based consumer that processes events from a BoundedEventQueue with a configurable timeout. It supports retirement (stop after timeout without processing new events) and resumption. The consumer is designed to be reloadable: it can be stopped and restarted, with the ability to transfer its state (registered wakelocks) across hot reloads. This pattern is useful for any system requiring graceful shutdown and state transfer between generations.

file: app/src/main/java/com/js/nowakelock/data/counter/ReloadableEventConsumer.kt ↗ | tags: #concurrency #lifecycle-management #consumer-thread

An in-memory registry for tracking active WakeLock instances and computing non-overlapping duration using a union-of-intervals approach. It is thread-safe via ConcurrentHashMap and supports state transfer (snapshot/restore) for hot reload scenarios. The registry handles acquire/release events, calculates total time across overlapping periods, and emits duration updates. This component demonstrates a practical approach to interval arithmetic and multi-threaded state management.

file: app/src/main/java/com/js/nowakelock/data/counter/WakelockRegistry.kt ↗ | tags: #concurrency #state-tracking #duration-calculation

A data class hierarchy and serialization logic for exporting/importing app configuration as JSON using kotlinx.serialization. It defines backup structures for app info, blocking rules, and user preferences. The design is self-contained and could be adapted to any Android app needing JSON-based backup/restore of Room entities with proper schema versioning and migration.

file: app/src/main/java/com/js/nowakelock/data/repository/backup/Backup.kt ↗ | tags: #serialization #backup-restore #json
Last analyzed: 2026-09-20 03:55:34.491384
Next check: 2026-09-27 03:55:34.492821
$ submit: