OSDN Git Service

Make read/write from/to XML persistent state more robust.
authorSvet Ganov <svetoslavganov@google.com>
Wed, 22 Apr 2015 20:34:31 +0000 (13:34 -0700)
committerSvet Ganov <svetoslavganov@google.com>
Wed, 22 Apr 2015 20:42:54 +0000 (13:42 -0700)
commitba0821ed3bc2536be02df1ae850619b111cbd6f4
treeb608df12b48268882137d233fdac43a26021d6be
parent4f2dcfd48010a338dc9a2f5870ed12b382c30cd7
Make read/write from/to XML persistent state more robust.

When writing critical state to XML an excpetion can lead to creating
a malformed XML that is later parsed and may put the device in a bad
state. Hence, on any error while writing we should bail out and drop
the partially write state on the floor.

Corollary, any error on parsing can lead to having a partially read
state that is not consistent which may lead to writing this bad state
back to disk. Hence, on any error while parsing we should bail as
our current state may be unrecoverable.

Change-Id: Ia050c16198cb583f8a51263ad2035dbb948052b8
packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
services/core/java/com/android/server/pm/Settings.java