android-management-api

Android Management API - apps don't install with reason INSTALLATION_FAILURE_REASON_UNKNOWN or IN_PROGRESS


I've got a similar problem that was already described here. The proposed answers don't seem to work and I would like to provide some more context for the issue.

Here's the policy I created for a phone:

{
  "name": "policy",
  "applications": [
    {
      "packageName": "com.microsoft.office.outlook",
      "installType": "FORCE_INSTALLED",
      "defaultPermissionPolicy": "GRANT",
      "disabled": false
    }
  ],
  "maximumTimeToLock": 120000,
  "screenCaptureDisabled": true,
  "cameraDisabled": false,
  "keyguardDisabledFeatures": [
    "ALL_FEATURES"
  ],
  "defaultPermissionPolicy": "GRANT",
  "addUserDisabled": true,
  "adjustVolumeDisabled": false,
  "factoryResetDisabled": true,
  "installAppsDisabled": true,
  "mountPhysicalMediaDisabled": true,
  "modifyAccountsDisabled": true,
  "uninstallAppsDisabled": true,
  "keyguardDisabled": false,
  "bluetoothContactSharingDisabled": true,
  "advancedSecurityOverrides": {
    "developerSettings": "DEVELOPER_SETTINGS_ALLOWED"
  }
}

When the phone is enrolled the app does not install. When the details of the phone are fetched, they contain the key nonComplianceDetails with the details of the app:

{
    "nonComplianceDetails": [
      {
        "settingName": "applications",
        "nonComplianceReason": "APP_NOT_INSTALLED",
        "packageName": "com.microsoft.office.outlook",
        "installationFailureReason": "IN_PROGRESS"
      }
}

or after the policy has been modified in any way:

{
    "nonComplianceDetails": [
      {
        "settingName": "applications",
        "nonComplianceReason": "APP_NOT_INSTALLED",
        "packageName": "com.microsoft.office.outlook",
        "installationFailureReason": "INSTALLATION_FAILURE_REASON_UNKNOWN"
      }
}

I've already tried changing the installType to REQUIRED_FOR_SETUP. I've also tried providing the minimumVersionCode. But these solutions didn't work.

Upon enabling USB debugging and checking out the logs one of the lines of adb logcat | grep Finsky | grep com.microsoft.office.outlook stood out:

Installer: Canceling update. Disallowed by Policy. package=com.microsoft.office.outlook

This led me to believe that there is a conflict between the app installation and some of the policies I specified. Indeed, removing all settings except for applications seems to solve the issue. But I was not able to find specific keys that were to blame. On the contrary, it seemed to me as if the number of policies specified was to blame, not the specific policies.

In any case, so far I wasn't able to solve the issue and would be very grateful if somebody could share their solution.


Solution

  • I must have missed the issue during my previous attempts of figuring out which policy key is to blame but it seems that the key that causes the apps to not install is "installAppsDisabled": true.

    After removing this key the issue seems to be consistently gone.

    The description of this setting in the documentation is a bit confusing: Whether user installation of apps is disabled. I think it doesn't suggest that the automatic install of the apps will not be possible.