Ensure correct install reason

When installing a package, we trust the installer to set the install
reason correctly. However, there are cases where we know what the
install reason should be (e.g. install by Device Owner or Profile Owner
should always be recorded as caused by enterprise policy) or we do not
trust the installer (e.g. an ordinary app not acting on behalf of an
enterprise should not be allowed to set the install reason to enterprise
policy).

This CL introduces a fix-up method that enforces these rules.

Bug: 32692748
Test: Manually tested all scenarios; DO case also covered by CTS

Change-Id: I18eb891401c9e38546f823a14f67391c94b22e28
2 files changed