How tiendnm/zukulock works
Project Type and Purpose
• ZukuLock is a lightweight Android application whose purpose is to toggle the screen’s power state via the command “input keyevent 26”.
• It avoids the need for Accessibility permissions by leveraging Shizuku for system-level command execution.
• The intended use is for devices (especially Google Pixel) that lack double-tap-to-lock functionality, and for enabling the use of banking apps that may block Accessibility-enabled apps.
Analyzing the File Structure
• Notice the standard Android project layout inside the “app” directory, with subdirectories for source code (src/main/java) and resources (src/main/res).
• The key Java/Kotlin files are in the package com.tiendnm.zukulock:
• ShizukuHelper.kt: Responsible for interfacing with the Shizuku service, which allows the app to run the “input keyevent 26” command.
• SleepService.kt: Possibly handles additional background operations (or timing/delayed execution) related to the screen toggling process.
• Gradle configuration and wrapper files indicate standard build and dependency management without any extra layers (such as a separate backend or web service).
Core Components
a. Android Launcher / Home Screen:
b. Main Activity:
• Serves as the entry point that triggers the action immediately upon launch.
c. Shizuku Integration (ShizukuHelper):
• Handles the request to execute the system-level command. It plays a pivotal role in bridging the application logic with the underlying Android system.
d. (Optionally) SleepService:
• Represents additional functionality or background processing, such as ensuring the screen is toggled correctly without user-visible transitions.
e. Android OS (Underlying System):
• Receives the “input keyevent 26” command and toggles the screen state. It’s the destination that executes the power button emulation.
f. External Service Dependency:
• Shizuku: Although not an included module in the project code, it is an essential third-party service the application relies on to gain system-level command execution (without requiring root access).
Relationships and Data Flow
• User Action: The user interacts with the launcher, which opens the Main Activity.
• Command Flow: MainActivity (or possibly a service component) calls ShizukuHelper.
• ShizukuHelper sends a request – effectively executing the “adb shell input keyevent 26” command – which signals the Android OS to toggle the screen’s power.
• SleepService (if integrated) can be depicted as monitoring the status or managing background tasks associated with the process.
Architectural Patterns & Design Principles
• Simple event-driven architecture: a user gesture results in a series of calls, ending with a system command.
• Separation of concerns: dividing responsibilities between an activity (user interface/input), helper classes (command execution), and service classes (background tasks).
• Integration with external service (Shizuku) for elevated system-level permissions.
2. MainActivity starts and immediately triggers an action.
3. The MainActivity then calls ShizukuHelper to perform the command.
4. ShizukuHelper interfaces with the Shizuku external service.
5. The command “input keyevent 26” is sent to the Android OS.
6. (Optional) Include SleepService if it acts as a background task handler.