Fix serialization / deserialization of SealedObject

Thanks to apphelia@ for the report.

The readObject() implementation had hardcoded the
field order incorrectly leading to a couple of
fields being swapped on each serialization:
paramsAlg and sealAlg. This was wrong as far back
as 2009 so the class has likely never worked for
its intended purpose. Field order during
Serialization is primitives first, then fields.
Secondary ordering is alphabetical.

The purpose of overriding readObject() at all is for
safety in the event of compromised stream data.

It would be more appropriate to clone() rather than
readUnshared(). readUnshared() assumes a
corresponding writeUnshared(), which is not present.
The readUnshared() probably only works here because
the byte[] arrays typically are not shared anyway.

From reading latest guidelines on safe serialization
the code need not be order-specific: it can use
readFields(). s.defaultReadObject() could have been
used instead but the guidelines recommend against.
Performance is probably not a concern.

Until now nobody could have been using SealedObject
for its intended purpose otherwise they would have
noticed this bug (or they were always serializing /
deserializing an even number of times!).

Anybody attempting to use SealedObject on earlier
versions of Android will need to serialize /
deserialize twice to avoid the bug. After this fix
the class will work as intended.

Additional:

Some duplicated code has been extracted into methods,
and streams are now closed when they are finished
with. In reality this will have no effect
given the stream implementations involved.

Bug: https://code.google.com/p/android/issues/detail?id=73235
Change-Id: If745d6556437ae7839543e66dd15f912afd4ec98
Throw an error when parsing an obviously bad Double

Thanks to Robbie Hott for the bug report.

Bug: https://code.google.com/p/android/issues/detail?id=71216
Change-Id: I402fa27e0b90c1c1d26169d79c7061e4a2caa138