How zxy19/yunmei_unintelligent works
Project Type and Purpose
• This is an Android mobile application (third-party client) named “云莓不智能,” reverse-engineered to provide two core features:
• 打卡 (attendance punch‐in with geolocation)
• 开门 (unlocking a Bluetooth lock)
• Code is pure Java, built with Android SDK and Gradle. It interfaces both with the Yunmei Smart cloud API and Bluetooth/NFC hardware on the device.
File Structure Analysis
• Top-level Gradle files:
• settings.gradle, build.gradle, gradle.properties, gradle/ wrapper → standard Android multi-module setup (only “app” module here).
• app/
• app/src/main/java/cc/xypp/yunmeiui → UI layer (Activities) + business/service layer + data/util layer.
• app/src/main/res → Android UI resources (layouts, drawables, themes, XML configurations).
• app/proguard-rules.pro → release minification rules.
• Key packages under java/cc/xypp/yunmeiui:
• activities: MainActivity, loginActivity, addLockActivity, lockInfoActivity, lockDebug, NfcActivity, QrActivity, settingActivity, serviceOpenDoor
• entity: Lock.java, User.java
• function/services: CodeService, UnlockService, RecordService, SignService
• utils: HTTP client wrappers, cryptographic helpers (MD5Utils, HexUtil), QRUtils, SecureStorage (SharedPreferences), YunmeiAPI (cloud endpoints), LockManageUtil, ToastUtil, AlertUtils
• widgets: CircleProgress custom view
README Insights
• Confirms two features (punch and unlock), required permissions (location, Bluetooth, internet), and that all user data flows directly to Yunmei cloud or local SharedPreferences.
• No backend code here; the app consumes Yunmei Smart’s private API.
a. Main Components to Include
1. UI Layer (Activities & Fragments)
2. Service Layer (CodeService, SignService, UnlockService, RecordService)
3. Data Layer (YunmeiAPI client, SharedPreferences via SecureStorage, local model entities)
4. Hardware Interfaces (Bluetooth adapter, NFC adapter, Camera/QR scanner)
5. External System (Yunmei Smart Cloud API endpoints)
b. Component Interactions
• UI → Service Layer: Activities invoke service methods for business logic (e.g., unlockService.unlock(lockId)).
• Service Layer → Data Layer: Services call YunmeiAPI (HTTP via HttpClient4) or interact with SharedPreferences.
• Data Layer → External API: HTTP POST/GET to Yunmei cloud for login, punch, lock-info fetch.
• Service Layer ↔ Hardware: UnlockService uses Android Bluetooth APIs to connect to the lock; NfcActivity uses NFC adapter; QrActivity uses camera/QRUtils.
• UI ↔ Storage: loginActivity reads/writes credentials via SecureStorage.
c. Architectural Patterns & Principles
• MVC-like separation:
• View = Activities + Layouts
• Controller/Service = function/*.java
• Model = entity/*.java + storage
• Single App (no microservices), layered approach to separate UI, business logic, and I/O.
• Use of Builder pattern in HTTP client wrappers.
• Modularization per feature (CodeService vs. UnlockService).
d. Key Technologies & Frameworks
• Android SDK (Activity, Service, BroadcastReceiver)
• Bluetooth API, NFC API, Camera API
• HttpClient4 for HTTP calls
• Gradle build system, ProGuard for release builds
• SharedPreferences for local storage (wrapped in SecureStorage)