By AP Infotech Engineering • Guide — 2026 • 8 min read
Table of Contents
- What an Android Device Policy Controller (DPC) Solves
- 7-App Django 5.2 Backend, Multi-Tenancy & Entitlement Ledger
- ECDSA P-256 Signed Commands & Android Keystore AES-256-GCM
- Kiosk Mode, Anti-Reset Protection & Android 9–16 Provisioning
- Real Hardware Testing & Engineering Boundaries
Complete Engineering Guide
Device financing providers, enterprise IT teams, and field fleets across India need deterministic remote policy control rather than fragile third-party lock apps. Built in-house at AP Infotech & Cyber Solution and published under github.com/Emijaan/dpc, AK DeviceLock (AKDL) is a multi-tenant Android Device Policy Controller (DPC) combining a native Kotlin agent (com.akdevicelock.dpc), a 7-app Django 5.2 backend, and a React 19 + TypeScript operator portal.
On the server side, the control plane splits cleanly into seven focused Django apps — accounts, roles, devices, commands, entitlements, audit, and notifications — backed by PostgreSQL, Celery background workers, and JWT authentication with rotating blacklisted refresh tokens. Superusers, Retailers, and Vendors operate inside strict tenant ownership boundaries, allocating 365-day enrollment entitlements through an append-only consumption ledger.
Every sensitive instruction (DEVICE_LOCK, DEVICE_UNLOCK, DEVICE_STATUS, DEVICE_SYNC, DEVICE_RELEASE) is cryptographically signed using ECDSA P-256 (SHA256withECDSA) over a canonical payload containing command_id, device_id, issued_at, expires_at, and nonce. On the phone, CommandVerifier validates both the signature against an embedded X.509 public key and server-relative expiration before touching device state. Device credentials are SHA-256 hashed at rest on the server, sealed inside non-exportable Android Keystore AES-256-GCM storage (SecureStore) in Device-Protected Storage, and rotated every 7 days.
When restricted, KioskRestrictionManager activates Android Lock Task Mode, sets a persistent LockedHomeAlias launcher surviving Direct Boot (LOCKED_BOOT_COMPLETED), disables the status bar and unauthorized ADB debugging/factory reset via EnrollmentProtection (DISALLOW_FACTORY_RESET, DISALLOW_SAFE_BOOT, DISALLOW_USB_FILE_TRANSFER), while preserving emergency 112 calling and support contact access. Firebase Cloud Messaging HTTP v1 data-only pushes wake sleeping devices so they pull signed commands reliably over TLS.
Provisioning covers Android 9–11 via 1-step Device Owner QR codes (/panel/qr/ serving signed APKs directly through Nginx), Android 12–15 via 2-step TestDPC 9.0.12 ownership transfer, and Android 16 via session-scoped USB scripts — verified across physical Vivo 1902 (Android 9) and Samsung SM-X115 (Android 16) test hardware alongside 48 passing Django multi-tenant isolation, entitlement, and crypto tests. Need a custom Android DPC, MDM, or Django + React enterprise platform? Explore our Custom Software service or review the repository directly.