diff options
author | Sam Blitzstein <sblitz@google.com> | 2015-02-13 11:40:04 -0800 |
---|---|---|
committer | mh0rst <moritz@mho-service.net> | 2016-05-07 20:53:28 +0200 |
commit | 5969b9a0b925095ca0bfe036a54b98c1f479abe4 (patch) | |
tree | 5c53ec3386f7f0196e8c314aba1d9f0526c2d310 /src/com/android | |
parent | 5bff6769e52dfc57528a6f30101461d80fb5a1e9 (diff) | |
download | android_frameworks_opt_timezonepicker-5969b9a0b925095ca0bfe036a54b98c1f479abe4.tar.gz android_frameworks_opt_timezonepicker-5969b9a0b925095ca0bfe036a54b98c1f479abe4.tar.bz2 android_frameworks_opt_timezonepicker-5969b9a0b925095ca0bfe036a54b98c1f479abe4.zip |
Remove code using mTransitions because we shouldn't rely on ZoneInfo implHEADreplicant-6.0-0004-transitionreplicant-6.0-0004-rc6replicant-6.0-0004-rc5-transitionreplicant-6.0-0004-rc5replicant-6.0-0004-rc4replicant-6.0-0004-rc3replicant-6.0-0004-rc2replicant-6.0-0004-rc1replicant-6.0-0004replicant-6.0-0003replicant-6.0-0002replicant-6.0-0001stable/cm-13.0-ZNH5Ycm-13.0
Bug: 19172146
(cherry picked from commit 882a2d8881017d0315bfb5fd213487147cde4450)
Change-Id: I90404c95982505accd97afcc2eb4f27210d1d143
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/timezonepicker/TimeZoneInfo.java | 68 |
1 files changed, 1 insertions, 67 deletions
diff --git a/src/com/android/timezonepicker/TimeZoneInfo.java b/src/com/android/timezonepicker/TimeZoneInfo.java index 9d302eb..e9590f5 100644 --- a/src/com/android/timezonepicker/TimeZoneInfo.java +++ b/src/com/android/timezonepicker/TimeZoneInfo.java @@ -46,7 +46,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> { TimeZone mTz; public String mTzId; int mRawoffset; - public int[] mTransitions; // may have trailing 0's. public String mCountry; public int groupId; public String mDisplayName; @@ -59,13 +58,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> { mTzId = tz.getID(); mCountry = country; mRawoffset = tz.getRawOffset(); - - try { - mTransitions = getTransitions(tz, time); - } catch (NoSuchFieldException ignored) { - } catch (IllegalAccessException ignored) { - ignored.printStackTrace(); - } } SparseArray<String> mLocalTimeCache = new SparseArray<String>(); @@ -194,34 +186,8 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> { return displayName; } - private static int[] getTransitions(TimeZone tz, long time) - throws IllegalAccessException, NoSuchFieldException { - Class<?> zoneInfoClass = tz.getClass(); - Field mTransitionsField = zoneInfoClass.getDeclaredField("mTransitions"); - mTransitionsField.setAccessible(true); - int[] objTransitions = (int[]) mTransitionsField.get(tz); - int[] transitions = null; - if (objTransitions.length != 0) { - transitions = new int[NUM_OF_TRANSITIONS]; - int numOfTransitions = 0; - for (int i = 0; i < objTransitions.length; ++i) { - if (objTransitions[i] < time) { - continue; - } - transitions[numOfTransitions++] = objTransitions[i]; - if (numOfTransitions == NUM_OF_TRANSITIONS) { - break; - } - } - } - return transitions; - } - public boolean hasSameRules(TimeZoneInfo tzi) { - // this.mTz.hasSameRules(tzi.mTz) - - return this.mRawoffset == tzi.mRawoffset - && Arrays.equals(this.mTransitions, tzi.mTransitions); + return this.mTz.hasSameRules(tzi.mTz); } @Override @@ -268,33 +234,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> { sb.append(getLocalTime(1383307200000L)); sb.append(SEPARATOR); - // if (this.mTransitions != null && this.mTransitions.length != 0) { - // sb.append('"'); - // DateFormat df = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss Z", - // Locale.US); - // df.setTimeZone(tz); - // DateFormat weekdayFormat = new SimpleDateFormat("EEEE", Locale.US); - // weekdayFormat.setTimeZone(tz); - // Formatter f = new Formatter(sb); - // for (int i = 0; i < this.mTransitions.length; ++i) { - // if (this.mTransitions[i] < time) { - // continue; - // } - // - // String fromTime = formatTime(df, this.mTransitions[i] - 1); - // String toTime = formatTime(df, this.mTransitions[i]); - // f.format("%s -> %s (%d)", fromTime, toTime, this.mTransitions[i]); - // - // String weekday = weekdayFormat.format(new Date(1000L * - // this.mTransitions[i])); - // if (!weekday.equals("Sunday")) { - // f.format(" -- %s", weekday); - // } - // sb.append("##"); - // } - // sb.append('"'); - // } - // sb.append(SEPARATOR); sb.append('\n'); return sb.toString(); } @@ -332,11 +271,6 @@ public class TimeZoneInfo implements Comparable<TimeZoneInfo> { } } - if (Arrays.equals(this.mTransitions, other.mTransitions)) { - Log.e(TAG, "Not expected to be comparing tz with the same country, same offset," + - " same dst, same transitions:\n" + this.toString() + "\n" + other.toString()); - } - // Finally diff by display name if (mDisplayName != null && other.mDisplayName != null) return this.mDisplayName.compareTo(other.mDisplayName); |