Validate decompressed APEX by matching root digest
Currently, we compare the version number of decompressed APEX against
the system CAPEX to determine if system CAPEX has been updated. When
updated we re-decompress the CAPEX. If they have the same version,
we continue using the previously decompressed APEX instead.
This logic utilized the assumption that whenever system APEX is updated,
it will come with a version bump. This is true in production, but
doesn't hold true during development, e.g developers force pushing
new APEX with same version or updating APEX with same version via
droidfood. Since we are comparing version only, apexd thinks system
APEX has not been updated and continues to use the old decompressed
APEX.
In order to resolve this problem we now compare the root digest of the
decompressed APEX against the root digest of original_apex. The root
digest of the original_apex is stored in the manifst of the CAPEX
while building the CAPEX.
Bug: 185708645
Test: atest ApexTestCases ApexCompressionTests
Test: manually tested that pushing apex with different fingerprint
gets decompressed (both via adb and OTA)
Change-Id: Ib924a50c9a340883c666ced42e6832d1d88d87ec
6 files changed