DO NOT MERGE Port DB upgrades from master.

This brings the DB helper up-to-date with Master and fixes the
two bugs mentioned below on the factory ROM branch.

Bug 5118670
Bug 5336673

Change-Id: Ic3c68eeb96d08e74cfbd635baa61a8ce53bd9bf2
2 files changed