# Config Provisioner A privileged system app that provisions PawletOS devices on first boot. ## How it works On `BOOT_COMPLETED`, the provisioner reads `/vendor/etc/config_provisioner/vendor.cfg` (or falls back to built-in defaults) and does three things: 1. **Config APK** — if `enable_configapk_service=true`, reads settings and APNs from the pre-installed config APK and applies them. 2. **Device provisioned** — sets `DEVICE_PROVISIONED` and `USER_SETUP_COMPLETE` according to `device_provisioned`. 3. **Setup wizard** — enables or disables setup wizard packages according to `enable_setupwizard`. On `USER_PRESENT` (after the screen is first unlocked), if `enable_configapk_service=true` and `config_apk_url` is set, it downloads an updated config APK and re-applies settings. ## Control keys These three keys drive the core behaviour. All have built-in defaults so the device auto-provisions correctly even with no `vendor.cfg` present. | Key | Default | Description | |-----|---------|-------------| | `enable_configapk_service` | `true` | Apply settings/APNs from the config APK and check for OTA config updates. | | `device_provisioned` | `true` | Mark the device as provisioned (`DEVICE_PROVISIONED=1`, `USER_SETUP_COMPLETE=1`). Set `false` to leave setup incomplete. | | `enable_setupwizard` | `false` | `false` = disable setup wizard packages. `true` = leave them enabled. | ## Supporting keys | Key | Default | Description | |-----|---------|-------------| | `config_apk_package` | `app.pawlet.config` | Package name of the pre-installed config APK. | | `config_apk_url` | *(empty)* | URL to download an updated config APK on unlock. Leave empty to disable OTA config updates. | | `vendor_id` | `default_vendor` | Identifier logged during provisioning. | | `network_timeout` | `30000` | Download timeout in milliseconds. | | `ota_check_interval_ms` | `86400000` | Minimum time between OTA config update checks (default: 24 h). | Keys can also be set via system properties (`persist.configprovisioner.`), which are used as a fallback when the config file is absent or the key is missing. ## Example vendor.cfg ``` enable_configapk_service=true device_provisioned=true enable_setupwizard=false config_apk_package=app.pawlet.config config_apk_url=https://oxmc.me/aosp_apis/data/default-config.apk ``` ## Config APK format The config APK provides: - **`res/xml/settings.xml`** — ``, ``, or `` tags with `name`/`value` attributes. Wrap in `` to apply conditionally by `manufacturer`, `brand`, `model`, `sdk`, `sdk_min`, `sdk_max`, `form_factor` (`phone`/`tablet`/`tv`/`flip`), or `feature`. - **`res/xml/apns.xml`** or **`assets/apns/*.xml`** — APN entries inserted into the telephony provider (duplicates are skipped). ## Permissions - `CHANGE_COMPONENT_ENABLED_STATE` — disable setup wizard packages - `WRITE_SECURE_SETTINGS` — write `USER_SETUP_COMPLETE` / `DEVICE_PROVISIONED` - `INSTALL_PACKAGES` — install downloaded config APK - `WRITE_APN_SETTINGS` — insert APN entries ## License GNU General Public License v3.0 — see [LICENSE](LICENSE).