OSDN Git Service

DngCreator: Do not cache timezone in static initializer
authorEino-Ville Talvala <etalvala@google.com>
Wed, 28 Sep 2016 00:15:11 +0000 (17:15 -0700)
committerEino-Ville Talvala <etalvala@google.com>
Wed, 28 Sep 2016 18:10:00 +0000 (11:10 -0700)
commitec727411d2d97ba79d3e32edb304279af078377e
tree810a930440da1463ac4feba8a65dc5116687e334
parent29678c0357b5803ae41ad10639da5656d3c285d5
DngCreator: Do not cache timezone in static initializer

The static initializer for a pre-loaded framework class is run
no later than at zygote startup, which happens at device boot.

Which means that if the timezone later changes, DngCreator will use
an incorrect cached timezone until the next reboot.  This is especially
evident in freshly wiped devices, where initial setup will typically
change the timezone.

Instead, read the timezone each time DngCreator is created, which is
also when we query the current time for constructing the timestamps.

Test: android.hardware.camera2.cts.DngCreatorTest#testSingleImageThumbnail
Bug: 31743060
Change-Id: I83a4eac762650e5f904f3b8fa779c094cef30562
core/java/android/hardware/camera2/DngCreator.java