Create GregorianCalendar via a delegate.
GregorianCalendar has a minimum-cost constructor that is not available
on the host. This change wraps the call to that constructor in a static
method that LayoutLib can replace.
Bug: http://b.android.com/79160
Change-Id: I44a6557a048d1239a514eac38634cd0a887302c9
diff --git a/luni/src/main/java/libcore/util/ZoneInfo.java b/luni/src/main/java/libcore/util/ZoneInfo.java
index 4a70a83..4d58d93 100644
--- a/luni/src/main/java/libcore/util/ZoneInfo.java
+++ b/luni/src/main/java/libcore/util/ZoneInfo.java
@@ -360,10 +360,16 @@
private int gmtOffsetSeconds;
public WallTime() {
- this.calendar = new GregorianCalendar(false);
+ this.calendar = createGregorianCalendar();
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
}
+ // LayoutLib replaces this method via bytecode manipulation, since the
+ // minimum-cost constructor is not available on host machines.
+ private static GregorianCalendar createGregorianCalendar() {
+ return new GregorianCalendar(false);
+ }
+
/**
* Sets the wall time to a point in time using the time zone information provided. This
* is a replacement for the old native localtime_tz() function.