staged sessions: clear INSTALL_ALLOW_DOWNGRADE if pre-reboot session did not have it
Note: this applies only to user builds.
In case of staged sessions, post-reboot StagingManager creates new
non-staged sessions to install apks. Since StagingManager is in
system_server, those sessions will have INSTALL_ALLOW_DOWNGRADE flag
enabled, even if original session did not have it (e.g. if it's created
by Phonesky). This gives an installer an ability to downgrade an app by
issuing a staged install.
This CL fixes it by allowing downgrade only if one of the following
applies:
* It's a debuggable build.
* Session was created by a system_server (RollbackManager use case).
* Session was created by root or shell (adb development use case).
Test: adb install foo_v2.apk && adb install --staged -d foo_v1.apk on user build
Test: CtsStagedInstallHostTestCases (userdebug and user builds)
Bug: 128409829
Fixes: 128409829
Change-Id: I2e5e8fd98584095b7d52891c88f033cb4c5caf70
1 file changed