Restore ZoneInfo specific code in GregorianCalendar

During removal of the sun.util.calendar.ZoneInfo class from
OpenJDK some code was removed from GregorianCalendar that cast
the TimeZone to ZoneInfo in order to call a special method in
ZoneInfo to get the raw and DST offset. The removed code was
necessary because the package private method in TimeZone
getOffsets(long, int[]) that provided them separately could not
be overridden by ZoneInfo, the public method getOffset(long) did
not support providing them separately, and attempts to calculate
the DST offset (by subtracting getRawOffset()) from the total
offset did not work properly with ZoneInfo when it had historic
changes to the DST and raw offset.

The result of the removal was that GregorianCalendar had an
inconsistent view of TimeZone which lead to the time calculated
by GregorianCalendar being out by a couple of hours either way
depending on the difference between the applicable offset and
the 'default' offset.

This adds a method in ZoneInfo to return the raw and DST offsets
separately and then adds back in the special code to call that
method in GregorianCalendar. This fixes a number of CalendarTest
failures, including testSetHourOfDayInEuropeLondon. It should
also fix some reported bugs in a number of apps, including
Calendar.

Bug: 26869497
Change-Id: Ia780b628ef951aec6fd08de1cebc7b6e904f77b0
2 files changed