Merge 1e0e1b52a7940cc058d98d4e739743de9bc9eddd on remote branch

Change-Id: I2786a872bba7cff478c4e124cd6c2898e39256ea
diff --git a/common/util/src/com/android/compatibility/common/util/GasTest.java b/common/util/src/com/android/compatibility/common/util/GasTest.java
new file mode 100644
index 0000000..4c3b555
--- /dev/null
+++ b/common/util/src/com/android/compatibility/common/util/GasTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 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 com.android.compatibility.common.util;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** Marks the type of test with purpose of asserting GAS requirements. */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface GasTest {
+    String requirement();
+}
diff --git a/common/util/src/com/android/compatibility/common/util/ResultHandler.java b/common/util/src/com/android/compatibility/common/util/ResultHandler.java
index 1e57c32..ffe16b4 100644
--- a/common/util/src/com/android/compatibility/common/util/ResultHandler.java
+++ b/common/util/src/com/android/compatibility/common/util/ResultHandler.java
@@ -96,6 +96,7 @@
     private static final String MODULE_TAG = "Module";
     private static final String MODULES_DONE_ATTR = "modules_done";
     private static final String MODULES_TOTAL_ATTR = "modules_total";
+    private static final String MODULES_NOT_DONE_REASON = "Reason";
     private static final String NAME_ATTR = "name";
     private static final String OS_ARCH_ATTR = "os_arch";
     private static final String OS_NAME_ATTR = "os_name";
@@ -226,7 +227,7 @@
             parser.nextTag();
             boolean hasRunHistoryTag = true;
             try {
-                parser.require(parser.START_TAG, NS, RUN_HISTORY_TAG);
+                parser.require(XmlPullParser.START_TAG, NS, RUN_HISTORY_TAG);
             } catch (XmlPullParserException e) {
                 hasRunHistoryTag = false;
             }
@@ -248,6 +249,13 @@
                 long runtime = Long.parseLong(parser.getAttributeValue(NS, RUNTIME_ATTR));
                 module.addRuntime(runtime);
                 while (parser.nextTag() == XmlPullParser.START_TAG) {
+                    // If a reason for not done exists, handle it.
+                    if (parser.getName().equals(MODULES_NOT_DONE_REASON)) {
+                        parser.require(XmlPullParser.START_TAG, NS, MODULES_NOT_DONE_REASON);
+                        parser.nextTag();
+                        parser.require(XmlPullParser.END_TAG, NS, MODULES_NOT_DONE_REASON);
+                        continue;
+                    }
                     parser.require(XmlPullParser.START_TAG, NS, CASE_TAG);
                     String caseName = parser.getAttributeValue(NS, NAME_ATTR);
                     ICaseResult testCase = module.getOrCreateResult(caseName);