I have a "device owner" Android app which silently installs APK using PackageInstaller (see the code, for example, here).
This code works perfectly on all Android 7+ devices except Xiaomi Redmi 7A (running MIUI 11). The installation fails, here's the related logcat output:
01-16 00:43:21.494 1488 2892 I InstallationStatistic: beginInstallSession: 417086238
01-16 00:43:21.600 1488 1658 D com.android.server.pm.PackageManagerServiceInjector: Package verify start
01-16 00:43:21.601 1488 1538 D CompatibilityInfo: mCompatibilityFlags - 0
01-16 00:43:21.601 1488 1538 D CompatibilityInfo: applicationDensity - 320
01-16 00:43:21.601 1488 1538 D CompatibilityInfo: applicationScale - 1.0
01-16 00:43:21.611 24382 24395 D GuardProvider: start parse apk : /data/app/vmdl417086238.tmp
01-16 00:43:21.618 24382 24395 E i.guardprovide: Invalid ID 0x00000000.
01-16 00:43:21.638 4434 24418 D PackageVerifyedRecevier: verify package /data/app/vmdl417086238.tmp info: PackageInfo{45d0d6b com.hmdm.sendphoto}
01-16 00:43:21.638 4434 24418 D PackageVerifyedRecevier: verify package /data/app/vmdl417086238.tmp finish true
01-16 00:43:21.639 1488 1658 I com.android.server.pm.PackageManagerServiceInjector: MIUILOG- Install Reject uid: 10161 pkg : com.hmdm.launcher
01-16 00:43:21.639 1488 1658 E PackageInstaller: Commit of session 417086238 failed: Permission Denied
Package ID of the installer (device owner) is com.hmdm.launcher. Package ID of the app being installed is com.hmdm.sendphoto.
I tried to add the "Install unknown apps" permission but this didn't help.
Looks like the app must request MIUI OS for some special (undocumented) permissions?
The device owner rights were granted to the application by QR code based enrollment.