android-management-api

Disable Digital Wellbeing using Android Management API in Kiosk mode


We are using Android Management API in an enterprise environment where we have multiple devices enrolled as dedicated devices in kiosk mode running a custom private app.

Sometimes when the user activates the device there will be a popup from Digital Wellbeing with the message "Need time to focus? Use Focus mode to pause distracting apps."

We are using the following policy:

"applications": [
    {
    "packageName": "PRIVATE_ENTERPRISE_APP",
    "defaultPermissionPolicy": "GRANT",
    "installType": "KIOSK",
    "autoUpdateMode": "AUTO_UPDATE_HIGH_PRIORITY"
    }
],
"statusReportingSettings": {
    "applicationReportsEnabled": false,
    "deviceSettingsEnabled": true,
    "softwareInfoEnabled": true,
    "memoryInfoEnabled": true,
    "networkInfoEnabled": true,
    "displayInfoEnabled": true,
    "powerManagementEventsEnabled": true,
    "hardwareStatusEnabled": true,
    "systemPropertiesEnabled": true
},
"screenCaptureDisabled": true,
"adjustVolumeDisabled": true,
"keyguardDisabled": true,
"autoDateAndTimeZone": "AUTO_DATE_AND_TIME_ZONE_ENFORCED",
"kioskCustomization": {
    "deviceSettings": "SETTINGS_ACCESS_ALLOWED",
    "statusBar": "NOTIFICATIONS_AND_SYSTEM_INFO_DISABLED"
},
"openNetworkConfiguration": {
    "NetworkConfigurations": [{
    "GUID": "WIFINETWORK",
    "Name": "WIFINETWORK",
    "Type": "WiFi",
    "WiFi": {
        "SSID": "WIFINETWORK",
        "Security": "WPA-PSK",
        "Passphrase": "WIFIPASSWORD",
        "AutoConnect": true,
        "MACAddressRandomizationMode": "Hardware"
    }
    }]
}

Because we are running one custom app in kiosk mode and explicitly disable the keyguard, notifications and system information, the lockscreen should not be hijacked by a system app that has no relevance to the kiosk mode.


Solution

  • You can uninstall or block the default system app Digital Wellbeing by using "installType": "BLOCKED", the app is blocked and can’t be installed. If the app was installed under a previous policy, it will be uninstalled.

    The alternative to blocking the app completely is to just deny the notification permission for the app.

    Sample code (Note that the package name of the wellbeing app varies depending on the manufacturer - e.g. for Samsung devices the package name would be com.samsung.android.wellbeing):

    "applications": [
      {
        "packageName": "com.google.samples.apps.iosched",
        "defaultPermissionPolicy": "GRANT",
        "installType": "KIOSK"
      },
      {
        "packageName": "com.google.android.apps.wellbeing",
        "installType": "BLOCKED",
        "permissionGrants": [
          {
            "permission": "android.permission.POST_NOTIFICATIONS",
            "policy": "DENY"
          }
        ]
      }
    ],