This directory contains the full source code for the Android System Function Library — a production-grade Kotlin library that provides a unified, version-aware API surface for system-privileged Android applications.
SystemFunction_src/
├── SystemLib/ # Core library — main entry point for all consumers
├── Android12/ # API 31–32 specific implementations
├── Android13/ # API 33 specific implementations
├── Android14/ # API 34 specific implementations
├── Android15/ # API 35 specific implementations
├── Android16/ # API 36 specific implementations
└── t/ # Internal test/scratch module
Dependency graph:
Your App
└── systemlib (SystemLib module)
├── android12
├── android13
├── android14
├── android15
└── android16
SystemLib is the unified API layer. It exposes a single, stable set of entry points and internally dispatches to the correct version-specific module at runtime based on Build.VERSION.SDK_INT. Callers never need to interact with Android12–Android16 directly.
| Module | API Level | Android Version |
|---|---|---|
| Android12 | 31, 32 | Android 12, 12L |
| Android13 | 33 | Android 13 |
| Android14 | 34 | Android 14 |
| Android15 | 35 | Android 15 |
| Android16 | 36 | Android 16 |
The core SystemLib module sets minSdk = 21 and compileSdk = 36.
| File | Responsibility |
|---|---|
SystemLib.kt |
Launcher, status bar, device info, time/timezone, system properties |
Syslib.kt |
App management, network, storage, power, OTA, accessibility, USB |
DPM.kt |
Device Policy Manager — admin activation, lock screen, kiosk, certificates |
InputLib.kt |
Input event injection (touch, scroll, keyboard) |
Oops.kt |
AppOps mode control, runtime permission grants, battery optimization |
DeviceUtils.kt |
Device type detection (TV, Wear, Auto) |
X.kt |
Image conversion utilities, system settings read/write |
NtpClient.kt |
NTP time synchronization |
oemconfig.kt |
OEMConfig restriction XML parser |
Logger.java |
Internal logging utility |
disableSensor12— sensor privacy viaISensorPrivacyManager.setIndividualSensorPrivacydisableEthernet12— ethernet control viaIEthernetManager.Trackstop/Trackstart- Screensaver (Dream) management —
IDreamManager - Lock screen disable —
ILockSettings+LockPatternUtils - Wireless debugging —
IAdbManager.allowWirelessDebugging - Notification listener grant —
INotificationManager.setNotificationListenerAccessGrantedForUser
disableSensor13— sensor privacy viaISensorPrivacyManager.setToggleSensorPrivacydisableEthernet13— ethernet control viaIEthernetManager.setEthernetEnabledcameraListener— camera and torch status monitoring viaICameraServicesetLock— device lock viaIDevicePolicyManager.lockNow(2-param)
setProfileOwner14— 2-param variant (parameter count changed from API 33)setLock14— 3-paramlockNowwithcallerPackageNamelockScreen— screen-off-only (no lock) viaSurfaceComposer.setPowerMode
setPackagesSuspendedAsUser15— 9-param variant (2 new params vs API 34)enableNFC15/disableNFC15—INfcAdapterremoved; usesNfcAdapterreflection
setActiveAdmin16— 4-param variant withcallerPackageNamesetPackagesSuspendedAsUser16— same 9-param signature as Android 15
- Android Studio Ladybug or later
- JDK 22
- Android SDK with API 36 installed
- System signature keystore (
platform.jks) for running on device
./gradlew :SystemLib:assembleReleasePublishes all AAR artifacts to ../SystemLib_repository:
./gradlew :SystemLib:publishReleasePublicationToMavenRepository
./gradlew :Android12:publishReleasePublicationToMavenRepository
./gradlew :Android13:publishReleasePublicationToMavenRepository
./gradlew :Android14:publishReleasePublicationToMavenRepository
./gradlew :Android15:publishReleasePublicationToMavenRepository
./gradlew :Android16:publishReleasePublicationToMavenRepositorySystem signature is mandatory. All APIs that call into IPackageManager, IDevicePolicyManager, IPowerManager, IInputManager, and similar AIDL services require the calling app to hold system UID (android.uid.system) and be signed with the platform key.
AIDL interface stability. These libraries call @UnsupportedAppUsage-annotated and AIDL hidden interfaces. The per-version modules exist precisely because these interfaces change between major Android releases. Always verify behavior after targeting a new API level.
DPM prerequisite. All DPM.kt methods require the app to be activated as a Device Admin or Profile Owner first. For unattended activation, configure the default supervision component in the ROM's config.xml:
<!-- frameworks/base/core/res/res/values/config.xml -->
<string name="config_defaultSupervisionProfileOwnerComponent" translatable="false">
com.your.package/com.your.package.AdminReceiver
</string>AOSP source references:
frameworks/base/core/java/android/app/admin/DevicePolicyManager.javaframeworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
Known limitation. copyDir() in X.kt currently traverses the directory tree and prints paths only — it does not copy files. Do not use it for file copy operations.
See API_REFERENCE_EN.md for the complete English API reference, or API_REFERENCE.md for the Chinese version.