Skip to content

Repository files navigation

QuickLock Android 📱✨

License: MIT Minimum SDK Platform

QuickLock is a lightweight, open-source utility designed to preserve your device's physical hardware. It provides two fast, software-based alternatives to lock your screen instantly—eliminating the need to press your physical power button.

Perfect for large devices, setups where the power button is damaged, or just extending your device's operational lifespan.


🚀 Features

  • Quick Settings Tile: Lock your screen directly from the Android status bar pull-down menu.
  • Home Screen Widget: A simple, customizable one-tap widget to lock your phone right from your launcher.
  • Biometric Friendly: Designed using modern Android APIs so that locking the device does not break Fingerprint or Face Unlock triggers on subsequent wake-ups.
  • Battery Efficient: Zero background syncs, zero wake-locks, and absolute minimal memory footprint.
  • Privacy First: Requires no internet permissions, ensuring your data never leaves your device.

🛠️ Installation & Setup

Because this application interacts directly with system-level UI locking mechanisms, a quick one-time configuration is required:

  1. Install the APK: Build the app from source or download the latest version from the Releases tab.
  2. Enable Accessibility Privileges:
    • Navigate to Settings > Accessibility > Installed Apps / Services.
    • Find QuickLock and toggle it ON.
    • Why? Modern Android operating systems require this permission to trigger native screen locks without forcing a PIN/Password lock on next wake.
  3. Add the Quick Settings Tile:
    • Swipe down twice from the top of your screen to open the full Quick Settings panel.
    • Tap the Edit (Pencil) icon.
    • Drag the QuickLock tile into your active grid.
  4. Place the Widget:
    • Long-press any empty space on your Home Screen.
    • Select Widgets, scroll to QuickLock, and drop it onto your desktop.

📊 Code Quality & Testing

We maintain high code standards using static analysis and automated testing.

Running Tests

  • Unit Tests: ./gradlew testDebugUnitTest
  • Instrumented UI Tests: ./gradlew connectedDebugAndroidTest (requires an emulator or device)

Code Coverage (JaCoCo)

To generate a comprehensive code coverage report (combining both Unit and UI tests):

./gradlew jacocoTestReport

The report will be available at: app/build/reports/jacoco/jacocoTestReport/html/index.html

Static Analysis (Lint & SonarQube)

  • Android Lint: To check for code issues and styling:
    ./gradlew lint
    The report is generated at: app/build/reports/lint-results-debug.html
  • SonarQube: To perform deep static analysis and upload reports:
    ./gradlew sonar -Dsonar.token=<your_token>

🏗️ Architecture & Core Components

QuickLock is built purely with native Kotlin, leveraging modern Android components to guarantee fast execution and low resource usage.

System Diagram & Flow


[User Action] ───>  [Input Mechanism]       ───> [Execution Core]          ───> [Android OS API]
├─ Home Screen Widget          └─ QuickLockService         └─ performGlobalAction
└─ Quick Settings Tile             (Accessibility Context)    (GLOBAL_ACTION_LOCK_SCREEN)

Technical Highlights

  • Accessibility Service Backend: Instead of using the legacy DevicePolicyManager (which violently locks the system and breaks Biometric authentication), this app uses AccessibilityService. When triggered, it executes:
    performGlobalAction(AccessibilityService.GLOBAL_ACTION_LOCK_SCREEN)
    This securely locks the OS naturally, mimicking a normal physical power button press.
  • Glance / AppWidgets: The widget UI uses optimized layout management to remain lightweight and fully responsive to modern dynamic themes (Material You).
  • TileService API: The Quick Settings option leverages TileService to bind and unbind reactively, ensuring zero idle RAM consumption when the tile isn't actively being tapped.

💻 Technical Requirements

  • Minimum SDK: Android 9.0 (API Level 28 - required for the global lock action API)
  • Target SDK: Android 14+ (API Level 34+)
  • Build System: Gradle (Kotlin DSL)
  • Language: Kotlin 100%

🤝 Contributing

Contributions are welcome! If you want to improve the widget designs, add custom Material You color tint support, or enhance documentation:

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

📄 License

Distributed under the Apache License 2.0. See LICENSE for more information.

About

A lightweight, privacy-focused Android utility to lock your screen instantly via a Home Screen Widget or Quick Settings (QS) Tile. Built natively with modern Android components to save your physical power button from wear and tear.

Topics

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages