f996d6958851e14c1965a0783e5b4512769997b9 |
|
24-Mar-2017 |
Neil Fuller <nfuller@google.com> |
Centralize knowledge of time zone file paths Centralize the knowledge of time zone file paths. The knowledge is in a couple of places and there is some file name duplication. A new file will be added if time_zones_by_country.xml is made updateable outside of an OTA. Test: make / boot (to confirm the new System class dependency is ok) Test: run cts -m CtsLibcoreTestCases -t libcore.java.lang.SystemTest Test: run cts -m CtsLibcoreTestCases -t libcore.util.TimeZoneDataFilesTest Test: run cts -m CtsLibcoreTestCases -t libcore.util.ZoneInfoDBTest Bug: 25338903 Change-Id: Iaf9afc148faee8db7839513270a621a8149fd5fa (cherry picked from commit bab90fe9bc8cd53373d0881b3f0b97f24bc61b21)
|
b03ea1194e84efad9b77b102c826a8be2d941106 |
|
06-Dec-2016 |
Neil Fuller <nfuller@google.com> |
Improved zoneinfo file validation Improved checks on zoneinfo load and addition of CTS tests to make sure the checks are working. Improved validation and CTS testing is desirable if timezone data is to be pushed to devices outside of an OTA and without substantial per-image testing (and given possible OEM changes). Some changes in ZoneInfoDB are to remove logic that created a large char[] to encourage Strings to share the underlying array. Strings on Android created this way no longer share a char[] so it can be dropped; it also makes checking that the index is sorted correctly easier. Bug: 31008728 Test: CtsLiboreTestCases Change-Id: Ieb033a24de91d1e0121dd0264a4e6a787d4b19f1
|
7e0ee09d14b21b767699e151e681202902bc7a06 |
|
29-Nov-2016 |
Neil Fuller <nfuller@google.com> |
Refactoring before adding stricter validity checking Refactoring before adding stricter validity checking. The tz update behavior needs a way to validate tzdata files and the current code structure doesn't make that easy. This commit is mostly rearranging the existing code to provide a mechanism for loading a single file. The only functional change intended is to add a close() call to close the MemoryMappedFile when a file has been found to be invalid. Bug: 31008728 Test: CtsLibcoreTestCases Change-Id: I3c016f0a489319d93d5621ed3de2763f46ea534c
|
64a979bfdb64e1ad95da9a0954fd522fb3337927 |
|
25-Nov-2016 |
Neil Fuller <nfuller@google.com> |
Modify version checks for the TzDataBundleInstaller Modify version checks for the TzDataBundleInstaller: A new version will be installed from any valid bundle providing it is not older than the one found in /system. Bug: 31008728 Test: make / vogar testing Change-Id: Iadcf8f8e3df03c54339443e95de0d34e30d28bd8
|
b3e502d6cee23d24bfc3717f385effa7b7d250b8 |
|
25-Jan-2016 |
Paul Duffin <paulduffin@google.com> |
Add tests for libcore.util.ZoneInfo, document and fix issues The investigation of bug 26022884 revealed some issues with ZoneInfo, in terms of the code structure, the documentation and the tests (there weren't any). This change fixes those issues in preparation for additional changes to address the problems with GregorianCalendar. The tests were run on a pre-OpenJDK version of AOSP and the following tests failed - as expected: testMakeTimeZone_HasPastDST_NoFutureDST_PositiveTransitions This failed because System.currentTimeMillis() / 1000 does not handle rounding properly when current time is positive. testMakeTimeZone_LotsOfOffsets It failed with an index out of bounds exception rather than an explicit exception. testMakeTimeZone_NegativeTransition This failed because getOffset(long) and inDaylightTime(Date) did not handle rounding properly for negative times. testMakeTimeZone_NoOffsets The test failed with an ArrayIndexOutOfBoundsException. testMakeTimeZone_OneDstTransition The test failed because the constructor did not fail. However, the code makes no sense if there are no non-DST transitions and the existing data doesn't require it. testMakeTimeZone_TooManyOffsets The test failed because the constructor did not fail. However, the code makes no sense if there are more than 256 offsets and the existing data doesn't require it. Bug: 26734751 Change-Id: I5b2a64c99e0fd98aec4fea430397110c1102fd2e
|
02b43bf44cb8bf8653baf8d951943a907310c3a2 |
|
02-Mar-2015 |
Neil Fuller <nfuller@google.com> |
Changes to enable timezone data overrides for ICU and libcore Bug: 19941636 (cherry picked from commit 317d6e12782e069e4fde06ed0f9a976a7c49f580) Change-Id: Ie6ac94ea8b819bed7b95585dd63267b21a5c6f53
|
c93108e864969819bdc9a453b585c547aadfef12 |
|
22-May-2015 |
Neil Fuller <nfuller@google.com> |
munmap the tzdata file if ZoneInfoDB.TzData is ever collected In the unusual / unexpected case that the runtime is shut down cleanly but the process remains we should be munmapping the MappedFile explicitly. MappedFile does not have a finalizer that unmaps automatically. Change-Id: I51c364cbe0f356798dbb73755277da34d97bf452
|
8ac094531caac4c2b1126f8630211603813c97fb |
|
24-Apr-2015 |
Narayan Kamath <narayan@google.com> |
Add a ZoneInfoDB.hasTimeZone API. Allows us to query the DB without having to clone an object or an entire strings array. bug: 19106773 bug: 19987403 (cherry picked from commit 3bb833819dba8d530620ad6d43dc53c3fd54763b) Change-Id: Ic100bc3bb0b985ca49a04ccf6a09306c758b78ef
|
3bb833819dba8d530620ad6d43dc53c3fd54763b |
|
24-Apr-2015 |
Narayan Kamath <narayan@google.com> |
Add a ZoneInfoDB.hasTimeZone API. Allows us to query the DB without having to clone an object or an entire strings array. bug: 19106773 bug: 19987403 Change-Id: I66d466e414972b02a75bcfe68263e74de8b9a768
|
317d6e12782e069e4fde06ed0f9a976a7c49f580 |
|
02-Mar-2015 |
Neil Fuller <nfuller@google.com> |
Changes to enable timezone data overrides for ICU and libcore Bug: 19941636 Change-Id: Id587be99f645978c2e1067c9f8eef26d6d63ec27
|
7983bf0702c7029120ffe4ac4dc6194388098722 |
|
27-Oct-2014 |
Elliott Hughes <enh@google.com> |
Disable tzdata in $ANDROID_DATA. (cherry picked from b0edf66dfcb330e64ae50b8430a0849d4a819774.) Bug: 18139284 Change-Id: I87d52e4f5bf18692a47c762fb4155ba68beffae2
|
b0edf66dfcb330e64ae50b8430a0849d4a819774 |
|
27-Oct-2014 |
Elliott Hughes <enh@google.com> |
Disable tzdata in $ANDROID_DATA. Bug: 18139284 Change-Id: I87d52e4f5bf18692a47c762fb4155ba68beffae2
|
065d7764ac1dfe74ee94d17ca6c810de37b57d3e |
|
11-Aug-2014 |
Elliott Hughes <enh@google.com> |
Fix TimeZone.getAvailableIDs(int). This was broken by the removal of the pre-computed raw offsets from the tzdata file. I think that's still the direction we want to go (with us hopefully using more of icu4j at some point, and eventually relying solely on the icu time zone data), so this patch adds code to lazily evaluate all the offsets by instantiating all the time zones. Bug: 16947622 Change-Id: I6d1dfe5ee6c99338f9807c3af5b6f04539c256c3
|
249a29f9e33e742c101ff5138ba56034ab2e5bf9 |
|
11-Aug-2014 |
Elliott Hughes <enh@google.com> |
Fix TimeZone.getAvailableIDs(int). This was broken by the removal of the pre-computed raw offsets from the tzdata file. I think that's still the direction we want to go (with us hopefully using more of icu4j at some point, and eventually relying solely on the icu time zone data), so this patch adds code to lazily evaluate all the offsets by instantiating all the time zones. (cherry-pick of 065d7764ac1dfe74ee94d17ca6c810de37b57d3e.) Bug: 16947622 Change-Id: I6d1dfe5ee6c99338f9807c3af5b6f04539c256c3
|
b7d5826277766003e36bb8e82a0c09020fc1c823 |
|
17-Jul-2014 |
Neil Fuller <nfuller@google.com> |
Support for a android.text.format.Time implemented entirely in Java (cherry picked from commit 0785676ad838b48512fde6bef58c380daf11994f) Bug: 15765976 Change-Id: Ic1d32743583539fa03924d1c0c122663f37ac3ac
|
0785676ad838b48512fde6bef58c380daf11994f |
|
17-Jul-2014 |
Neil Fuller <nfuller@google.com> |
Support for a android.text.format.Time implemented entirely in Java Bug: 15765976 Change-Id: Ic743168a54ff96e5403a9c73c27eeb7d482a01dc
|
60226561d5af59bc47ee70a4988633050e6fc62e |
|
17-Jul-2014 |
Neil Fuller <nfuller@google.com> |
Add a cache for ZoneInfo objects in Java This mirrors the single-item cache in localtime.c. This is in preparation for an upcoming change to migrate android.format.text.Time over to Java. It will be making use of the Java ZoneInfo instead of the native equivalent. The Java cache has a size of 1 like the bionic one, though this can easily be increased. Given the default TimeZone / ZoneInfo was always pinned, in many cases the memory usage will not go up noticeably. In scenarios where applications load timezones besides the default a cache size of 1 potentially increases pinned memory usage by one ZoneInfo plus the overhead of the prototype object held by the cache (which is never returned to callers). An example ZoneInfo is "Europe/London", which has ~190 transitions (1 int + 1 byte) and ~6 types (1 int + 1 byte). Overhead of other fields is ~ 13 bytes, plus the ID string. 190 * (4 + 1) + 6 * (4 + 1) + 13 = 993 bytes. The prototypes held by the cache share the majority of their memory with their clones returned from ZoneInfo.makeTimeZone() and so the overhead of introducing the cache itself should be in the order of a few tens of bytes at most. In future we may want to increase the cache size to 2 in order to support apps that compare / switch timezones to increase the odds of the default remaining in the cache. Sizes above 2 look increasingly specialist. LMP cherry-pick notes: This is a cherry-pick of the final patch. In master, an original patch was reverted and then the revert was reverted with an added fix. The comment above is from the original commit. The fixed version included: Contains a fix for when the timezone ID is not found. This includes a new test. (cherry picked from d3d39ab8df5c4f6ae663613dc3617ba300282315) Change-Id: I4c145942b6603e0e62badfd052b5716fd68769d2
|
d3d39ab8df5c4f6ae663613dc3617ba300282315 |
|
17-Jul-2014 |
Neil Fuller <nfuller@google.com> |
Revert "Revert "Add a cache for ZoneInfo objects in Java"" This reverts commit 01b6a878d10ee68db87c3d85d137e81a5257a78a. Contains a fix for when the timezone ID is not found. This includes a new test. Change-Id: I2e5e669782ea6caf4e97153ed6b63ca6ee4ef50d
|
01b6a878d10ee68db87c3d85d137e81a5257a78a |
|
17-Jul-2014 |
Neil Fuller <nfuller@google.com> |
Revert "Add a cache for ZoneInfo objects in Java" This reverts commit a6e8689807f5a8bb9470ce7c26a47455d2d0608d. Change-Id: I17a0262d169db3418f2f8888195381f778975dc4
|
a6e8689807f5a8bb9470ce7c26a47455d2d0608d |
|
16-Jul-2014 |
Neil Fuller <nfuller@google.com> |
Add a cache for ZoneInfo objects in Java This mirrors the single-item cache in localtime.c. This is in preparation for an upcoming change to migrate android.format.text.Time over to Java. It will be making use of the Java ZoneInfo instead of the native equivalent. The Java cache has a size of 1 like the bionic one, though this can easily be increased. Given the default TimeZone / ZoneInfo was always pinned, in many cases the memory usage will not go up noticeably. In scenarios where applications load timezones besides the default a cache size of 1 potentially increases pinned memory usage by one ZoneInfo plus the overhead of the prototype object held by the cache (which is never returned to callers). An example ZoneInfo is "Europe/London", which has ~190 transitions (1 int + 1 byte) and ~6 types (1 int + 1 byte). Overhead of other fields is ~ 13 bytes, plus the ID string. 190 * (4 + 1) + 6 * (4 + 1) + 13 = 993 bytes. The prototypes held by the cache share the majority of their memory with their clones returned from ZoneInfo.makeTimeZone() and so the overhead of introducing the cache itself should be in the order of a few tens of bytes at most. In future we may want to increase the cache size to 2 in order to support apps that compare / switch timezones to increase the odds of the default remaining in the cache. Sizes above 2 look increasingly specialist. Change-Id: I0b7daa8ad5d334c8d421dfaa6e0421d3c181a915
|
5d930cadc8f62aee5f18e7921296fe66a54f18ab |
|
24-Apr-2014 |
Elliott Hughes <enh@google.com> |
Groundwork towards making the Libcore.os functionality public. Change-Id: Ie700aa16d91fba53fc5eb2555829cb74d84b12ad
|
2a6f23ff8690ac2f025588a360547ce96cde0943 |
|
29-Jun-2013 |
Elliott Hughes <enh@google.com> |
Add java.nio.charsets.StandardCharsets. Bug: 3484927 Change-Id: I5820267491b850b8fcc696fa48962710de123009
|
eef73ccb5e02b939ae8f348094c64f50955870a5 |
|
26-Apr-2013 |
Elliott Hughes <enh@google.com> |
Remove the now-unused ZoneInfoDB.getVersion API. Change-Id: I05aff6c07e9baca679b8b7759f4f0108067d06e6
|
995caee51334a4f1a1429e29680ea079c900c37a |
|
25-Apr-2013 |
Elliott Hughes <enh@google.com> |
Cope with a corrupt tzdata update. We need to fall back to the next choice on error. Rewrite the code to be testable and add some tests. Add an internal GMT-only fallback in case all our sources of tzdata are bad. Also make time zone detection on the host more useful. Bug: 8373554 Change-Id: I9f91b844a61f07f34b268535e6d24aa0c301bf8d
|
dad6760aedf4c6b29b47dea6352d88fc3df9b2e5 |
|
15-Mar-2013 |
Elliott Hughes <enh@google.com> |
Return Olson ids from TimeZoneNames.forLocale in zone.tab order. Bug: 8391426 Change-Id: I7b1335a8d8e0c804d68c85b18b1c4891ec269c1d
|
8d5562828a5dda6ae0fbe5ba0355a95e650e3d2e |
|
22-Oct-2012 |
Elliott Hughes <enh@google.com> |
Support zone.tab in libcore, and remove the file format version. Bug: 7012465 Change-Id: I2ac580094928806abcf7c6f5f0e6ee950a954135
|
4c0cbc2cf60df843387233801784ae43c2cd747c |
|
20-Oct-2012 |
Elliott Hughes <enh@google.com> |
Make libcore look in /data/misc for tzdata updates. Bug: 7012465 Change-Id: Ia452f9c4482d0a75073e6a174f38114525984f15
|
53d000ca7ea62d0e36c9ba7be8c54c4777cabae6 |
|
19-Oct-2012 |
Elliott Hughes <enh@google.com> |
Make it possible to share libcore.util.ZoneInfo with bionic. The code that generates the single big file from the directory of zoneinfo files needs to be able to get the raw offset for each zone, so we can implement TimeZone.getAvailableIDs(int) cheaply. Bug: 7012465 Change-Id: Icc8355c086dd8e62589c2930fb7f892feea5a217
|
6cbefca623f55004ba65f11577fc25f92f6297dc |
|
17-Oct-2012 |
Elliott Hughes <enh@google.com> |
Pull libcore's time zone data from the new single 'tzdata' file. Bug: 7012465 Change-Id: I5ce1a372755e31f8882fbfc2ea2b582fec1858b3
|
78c3de051d68b703af480778c100ca335690b250 |
|
30-Jul-2012 |
Elliott Hughes <enh@google.com> |
Fix TimeZone's handling of Australia/Lord_Howe. Australia/Lord_Howe has a half hour difference between standard and daylight time, rather than the usual hour. Our ZoneInfo implementation ignored this. Fix that oversight, make SimpleDateFormat actually use this information, and prevent TimeZone.getTimeZone("GMT") and TimeZone.getTimeZone("UTC") from being quite as expensive as they accidentally were. Longer term I think we should probably remove all uses of getDSTSavings from libcore in favor of TimeZone.getOffset, but this is probably a useful step forwards anyway. It fixes Australia/Lord_Howe in the meantime and it means that anyone else who's using getDSTSavings won't be bitten (even if they too really ought to be using TimeZone.getOffset). Bug: 4723412 Bug: http://code.google.com/p/android/issues/detail?id=24684 Change-Id: I5d50afecbe1453157e9c8f0b88305a258a3ba2e0
|
9b510df35b57946d843ffc34cf23fdcfc84c5220 |
|
28-May-2011 |
Elliott Hughes <enh@google.com> |
Make ErrnoException a checked exception. Bug: 4486011 Change-Id: I1877ce593d441653f75ab14884aa2d85f52652ad
|
7e25eff38a191d9c19e45093f4fde5102fb09d78 |
|
19-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add mmap(2), msync(2), and munmap(2). Bug: 3107501 Change-Id: I6a7c4147ec27bab9ded280476bad1157ce03fab8
|
244449b9ccd108197d1c117edda99cd93a891d49 |
|
23-Feb-2011 |
Elliott Hughes <enh@google.com> |
Fix a comment and remove some duplication. Change-Id: I67bb9f1c71c774e04698a3e489bd48e9b27b2b64
|
6d82ce5d35a5e84aedf08528fd98b849f3f565a6 |
|
15-Feb-2011 |
Elliott Hughes <enh@google.com> |
Move ZoneInfo and ZoneInfoDB into libcore.util. Change-Id: I91385512ec27aa2aebdc163ae204e542efa58f21
|