Merge remote-tracking branch 'aosp/icu64' into aosp/master
am: 747b4bb9d5

Change-Id: Ie0063244130f9d0bf6984bba20ebeed9ab22532e
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 321bab6..bd9e926 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,2 +1,3 @@
 [Builtin Hooks]
 bpfmt = true
+gofmt = true
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/format/DataDrivenFormatTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/format/DataDrivenFormatTest.java
index 5789e75..2755bcc 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/format/DataDrivenFormatTest.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/format/DataDrivenFormatTest.java
@@ -29,7 +29,6 @@
 import android.icu.text.DateFormat;
 import android.icu.text.SimpleDateFormat;
 import android.icu.util.Calendar;
-import android.icu.util.JapaneseCalendar;
 import android.icu.util.TimeZone;
 import android.icu.util.ULocale;
 
@@ -101,14 +100,6 @@
             String spec = currentCase.getString("spec");
             String date = currentCase.getString("date");
             String str = currentCase.getString("str");
-
-            // Android-changed: Old Android releases can optionally support the new Japanese era.
-            // Note that the value of CURRENT_ERA comes from the system image, the string "Reiwa"
-            // comes from test side binary resource file.
-            if (JapaneseCalendar.CURRENT_ERA == JapaneseCalendar.HEISEI
-                && "TestConsistentPivot".equals(testData.getName())) {
-                str = str.replace("Reiwa", "Heisei");
-            }
             
             Date fromDate = null;
             boolean useDate = false;
diff --git a/build/Android.bp b/build/Android.bp
new file mode 100644
index 0000000..d63fcd0
--- /dev/null
+++ b/build/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+bootstrap_go_package {
+    name: "soong-icu",
+    pkgPath: "android/soong/icu",
+    deps: [
+        "soong",
+        "soong-android",
+    ],
+    srcs: [
+        "icu.go",
+    ],
+    pluginFor: ["soong_build"],
+}
diff --git a/build/icu.go b/build/icu.go
new file mode 100644
index 0000000..8330032
--- /dev/null
+++ b/build/icu.go
@@ -0,0 +1,54 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package icu
+
+import (
+	"android/soong/android"
+)
+
+func init() {
+	host_whitelist := []string{
+		"art/build/apex/",
+		"device/google/cuttlefish_common/host/commands/",
+		"external/skia",
+		"frameworks/base/libs/hwui",
+	}
+
+	device_whitelist := []string{
+		"art/",
+		"external/chromium-libpac",
+		"external/icu/",
+		"external/v8/",
+		"libcore/",
+	}
+
+	android.AddNeverAllowRules(
+		android.NeverAllow().
+			InDirectDeps("libandroidicu").
+			WithOsClass(android.Host).
+			NotIn(host_whitelist...).
+			Because("libandroidicu is not intended to be used on host"),
+		android.NeverAllow().
+			InDirectDeps("libicuuc").
+			WithOsClass(android.Device).
+			NotIn(device_whitelist...).
+			Because("libicuuc is not intended to be used on device"),
+		android.NeverAllow().
+			InDirectDeps("libicui18n").
+			WithOsClass(android.Device).
+			NotIn(device_whitelist...).
+			Because("libicui18n is not intended to be used on device"),
+	)
+}
diff --git a/icu4c/source/test/intltest/incaltst.cpp b/icu4c/source/test/intltest/incaltst.cpp
index bd3d911..d584e49 100644
--- a/icu4c/source/test/intltest/incaltst.cpp
+++ b/icu4c/source/test/intltest/incaltst.cpp
@@ -712,7 +712,7 @@
             }
             delete fmt;
         }
-    }
+    }    
 
     delete cal2;
     delete cal;
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DataDrivenFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DataDrivenFormatTest.java
index 60b40a2..91cf2ee 100644
--- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DataDrivenFormatTest.java
+++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DataDrivenFormatTest.java
@@ -28,7 +28,6 @@
 import com.ibm.icu.text.DateFormat;
 import com.ibm.icu.text.SimpleDateFormat;
 import com.ibm.icu.util.Calendar;
-import com.ibm.icu.util.JapaneseCalendar;
 import com.ibm.icu.util.TimeZone;
 import com.ibm.icu.util.ULocale;
 
@@ -98,14 +97,6 @@
             String spec = currentCase.getString("spec");
             String date = currentCase.getString("date");
             String str = currentCase.getString("str");
-
-            // Android-changed: Old Android releases can optionally support the new Japanese era.
-            // Note that the value of CURRENT_ERA comes from the system image, the string "Reiwa"
-            // comes from test side binary resource file.
-            if (JapaneseCalendar.CURRENT_ERA == JapaneseCalendar.HEISEI
-                && "TestConsistentPivot".equals(testData.getName())) {
-                str = str.replace("Reiwa", "Heisei");
-            }
             
             Date fromDate = null;
             boolean useDate = false;