propose_policy_change
Propose one change to an existing policy: pass policyId and exactly one of the parts below; for changes of several kinds, call it once per part. Parts: settings (the restrictions, security, connectivity, location, reporting and Play Store settings get_policy_settings lists); apps (add, remove or change how apps are installed); homeScreen (kiosk mode, the Nomid launcher or the device's own home screen, and the dock); details (the description, tags or policy group); edits (anything else, such as Wi-Fi, passwords or fences, as JSON Pointer edits of get_policy_document).
settings: Propose changing settings of an existing policy (restrictions, security, connectivity, location, reporting, Play Store mode). Nothing changes yet: this returns a proposal with the change list (current -> new value), the number of devices on the policy and its impact. Show the change list to the user and get their explicit approval. Read get_policy_settings first for the ids, current and allowed values. Change only the settings the user asked for: one setting can cover several words of the request (DEVELOPER_SETTINGS is developer options and USB debugging), and a setting with a similar name is not part of it (USB_DATA_ACCESS is file transfer over USB, not debugging). Apps are changed with the apps part; Wi-Fi and other networks, fences, the launcher look and everything else with the edits part.
apps: Propose adding apps to an existing policy (a Google Play or Nomid Store app by package name, or a Nomid secure web app for a URL), removing them, or changing how they are installed. Nothing changes yet: this returns a proposal with the change list, the number of devices on the policy and its impact. Show it to the user and get their explicit approval. find_app says whether an app is already in the policy, in the Library, on Google Play or installed on a device; get_policy_settings lists the policy's apps. Nomid's own apps and the kiosk app can't be changed here, nor can an app be made the kiosk app: kiosk mode, the kiosk app and the dock are set with the homeScreen part. In a kiosk that opens a single app, an added app is installed but not shown.
homeScreen: Propose switching the home screen of an existing policy, as the portal's Launcher section does: kiosk mode on or off (Nomid Kiosk, multi-app or locked to a single app), the Nomid launcher, or the device's own home screen, and which apps sit in the launcher's dock. Nothing changes yet: this returns a proposal with the change list, the number of devices on the policy and its impact (HIGH whenever devices are on it). Show it to the user and get their explicit approval. The Nomid launcher can also show the device's own built-in apps (addSystemApps: PHONE, CONTACTS, CAMERA, MESSAGES, SETTINGS, BROWSER), which open whatever app fills that role on the device: this is how a preinstalled dialer or contacts app that isn't on Google Play gets on the home screen, with no package name. Nomid Kiosk doesn't offer them: it opens only the policy's own apps. Which other installed apps the launcher and the multi-app kiosk also show is appsOutsidePolicy (by default every installed app, preinstalled ones included): only when the user says the kiosk or launcher shows apps they didn't choose, or asks to hide or show such apps, propose the current mode with appsOutsidePolicy POLICY_ONLY; on any other change leave it out. The kiosk app and the other dock apps must already be in the policy: add them with the apps part first, and propose this only once that change is applied (applied with apply_policy_proposal; never while it is still pending). Read the current mode with get_policy_document (its overview says it) before saying what the policy has. Once in kiosk, its controls (status bar, navigation buttons, power button, device settings) are edited with the edits part at /kioskCustomization.
details: Propose changing how an existing policy is organized in the portal: its description, its tags or the policy group it belongs to. Devices are not affected. Nothing changes yet: this returns a proposal with the change list. Show it to the user and get their explicit approval. Tags replace the current list: read them with get_policy_document first and send the whole new list. A group must be one the user can move policies into; when it isn't, the answer names the groups they can use.
edits: Propose changes to any editable part of an existing policy - Wi-Fi networks, password rules, restrictions, system updates, launcher look, time and geo fences, an app's managed configuration - as JSON Pointer edits of the document get_policy_document returns (read it first and follow its field names and shapes). Nothing changes yet: this returns a proposal with each field's old and new value, the number of devices on the policy and its impact. Show it to the user and get their explicit approval. Prefer the settings part for the settings get_policy_settings lists, and the apps part to add or remove apps, the homeScreen part to switch kiosk mode or the launcher, and the details part for the description, tags or group. Contact lists, library files and the VR environment are attached by id: read /phoneContacts, /libraryFiles or /vr with get_policy_document, pick from the items it lists under attachable, then append {"phoneContactsUuid": ...} to /phoneContacts/-, {"libraryFileUuid": ...} to /libraryFiles/- or SET /vr/pico/vrEnvironmentId; REMOVE detaches one. A Wi-Fi network is added by appending {"Name": ..., "Type": "WiFi", "WiFi": {"SSID": ..., "Security": "WPA-PSK" (or "None", "WEP-PSK"), "Passphrase": ..., "AutoConnect": true}} to /openNetworkConfigurations/NetworkConfigurations/-; ask the user for a password the network needs, never invent one. A field the document doesn't show yet can still be SET: an app becomes the always-on VPN with /alwaysOnVpn set to {"packageName": ..., "lockdownEnabled": false} (true blocks the network until the VPN connects), once the app is in the policy (add it with the apps part first, and propose this only once that change is applied: applied with apply_policy_proposal; never while it is still pending); /personalUsagePolicies/maxDaysWithWorkOff is how many days the work profile of a company-owned device can stay off; /shortSupportMessage/message (and /longSupportMessage/message) is the support message devices show where a setting is blocked by the policy. strongUnlock in a /passwordPolicies entry (e.g. /passwordPolicies/0/strongUnlock, the entry of the scope the user means) set to EVERY_DAY makes the device ask for the PIN, pattern or password at least once every 24 hours, so it can't keep unlocking with fingerprint or face alone; DEFAULT_DEVICE_TIMEOUT keeps the device's own default (72 hours on stock Android). A schedule (time fence) is appended to /timeFence/rules/- as {"packages": [...], "availabilities": [{"dayOfWeek": "MONDAY", "startOpen": "08:00", "endClosed": "18:00"}, ...]}: the apps open only inside those windows, and not at all on a day without one. Enum values are Nomid's names as get_policy_document shows them (DEVICE, EVERY_DAY), not Google's (SCOPE_DEVICE, REQUIRE_EVERY_DAY); a refusal lists the accepted ones.
Once the user approves, apply it with apply_policy_proposal (a person approves a HIGH impact one in the Nomid portal instead: give the user its approvalUrl).