Handle corrupt packages.xml
If the device hard reboots or is otherwise killed between write and fsync of packages.xml, it can write all zeros. This is not a problem in most cases as packages.xml is renamed to packages-backup.xml before writing begins. In the case (boot after a failed first boot) that a packages.xml does not exist, we may read that all 0 packages.xml. In such a case we will encounter IOExceptions and will not get the opportunity to build the VersionInfos that we require later during boot. This change adds a finally block for those exception cases to populate the VersionInfos to adequately handle subsequent stages of boot. Fixes: 178518634 Bug: 178518634 Test: manual; adb shell 'stop; rm /data/system/packages.xml; fallocate -l 1K /data/system/packages.xml; start' Change-Id: I532b2bcd5b739345c8cd2e3f3a3d9a6393f68fba
Loading
Please register or sign in to comment