Advance Wallpaper Manager is an Android application for creating depth-effect live wallpapers. It renders a clock layer behind extracted subject foreground masks using on-device machine learning models and a native C++ rendering pipeline.
| Main Gallery | Depth Editor | Clock Customization |
|---|---|---|
![]() |
![]() |
![]() |
- Layered composition rendering base image, clock text, and foreground subject mask in a single pass.
- Synchronized gesture transformations: scale, pan, and rotation applied to wallpaper and subject mask simultaneously.
- Occlusion clamp (
clockDepth) limiting foreground opacity over clock text.
- Google ML Kit Subject Segmentation API integration.
- TensorFlow Lite models (
selfie_segmenter.tfliteanddeeplabv3_mobilenetv2.tflite) for offline processing. - Native C++ edge refinement pipeline:
- Confidence threshold (
$\tau$ ) - Boundary expansion and shrinking via morphological dilation (
$+\text{px}$ ) and erosion ($-\text{px}$ ) - Box blur feathering
- Color decontamination to prevent edge halos
- Automatic fallback to ML Kit if local model fails
- Confidence threshold (
- Horizontal and vertical stacked text layouts.
- System font detection and custom font imports (
.ttf,.otf,.zip). - Font embedding inside saved configuration archives.
- Adjustable size, thickness, height stretch, letter spacing, line spacing, and auto color extraction.
- Self-contained ZIP archives (
.dwp) containing:config.jsonbase.pngmask.pngpreview.pngfont.ttf
- Import and export support via Android Storage Access Framework.
- Scheduled background wallpaper rotation using WorkManager.
- Intervals: Daily, Hourly, or On-Awake (pre-loads assets when screen turns off).
- Kotlin 2.0, C++20 (Android NDK)
- Jetpack Compose, Material 3, Navigation Compose
- Kotlin Coroutines and Flow
- Android NDK
ANativeWindowandAndroidBitmap - Google ML Kit Subject Segmentation
- TensorFlow Lite 2.16
- Android WorkManager
The C++ pipeline in native-lib.cpp renders directly to ANativeWindow_Buffer using RGBA_8888 pixel arrays.
[ ANativeWindow Buffer ]
├── 1. Draw Base Wallpaper (Scale, Rotation, Panning)
├── 2. Draw Clock Bitmap (Centered, Scaled, Rotation)
└── 3. Draw Subject Mask (Scale, Rotation, Occlusion Clamp)
-
Inverse 2D Affine Sampling:
$$x = \text{origCx} + (dx0 \cdot \cos\theta + dy0 \cdot \sin\theta) \cdot \text{invScale}$$ $$y = \text{origCy} + (-dx0 \cdot \sin\theta + dy0 \cdot \cos\theta) \cdot \text{invScale}$$ -
Clock Occlusion Clamp:
$$\alpha_{\text{clock_area}}(x, y) = \min(\alpha(x, y), \lfloor \text{clockDepth} \times 255 \rfloor)$$ -
Morphological Expansion:
- Dilation (
$+\text{px}$ ):$\alpha_{\text{new}}(x, y) = \max_{k \in [-r, r]} \alpha(x + k, y)$ - Erosion (
$-\text{px}$ ):$\alpha_{\text{new}}(x, y) = \min_{k \in [-r, r]} \alpha(x + k, y)$
- Dilation (
- Android Studio 2024.2+
- Android SDK 37 (Min SDK 29)
- CMake 3.22.1+
- JDK 17
- Clone the repository:
git clone https://github.com/your-username/AdvanceWallpaperManager.git
- Build debug APK:
./gradlew app:assembleDebug
- Load an image in the Source tab.
- Select segmentation mode under Model tab and adjust threshold or expansion parameters.
- Customize font, size, or position under Clock tab.
- Scale, rotate, or position wallpaper under Wallpaper tab.
- Tap Apply & Auto-Save in the Apply tab.
Copyright (C) 2026 Advance Wallpaper Manager
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.



