Support Parcel, Bundle under Ravenwood, with CTS.

We have baseline implementations of the Parcel and Bundle, so we're
ready to support them under the Ravenwood environment.  Brings along
the relevant CTS to prove that it works consistently on both devices
and Ravenwood.  Make a few test-driven bug fixes to Parcel code.

Currently does not support FDs or Binders.

Add new `@IgnoreUnderRavenwood` annotation that is respected by a
new `RavenwoodRule`, letting the same test code be shared to run
under both devices and Ravenwood.  Currently packaged under our own
area of the tree, but named to match layout of `platform_testing`
for future migration.

Add "ThrowClass" policy.

Bug: 292141694
Test: atest-dev CtsOsTestCasesRavenwood CtsOsTestCases:ParcelTest CtsOsTestCases:BundleTest
Change-Id: I88d19afff47fbea6557e922a10e8555ee0f70ba3
diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp
index d0e442e..5c9bf18 100644
--- a/ravenwood/Android.bp
+++ b/ravenwood/Android.bp
@@ -32,3 +32,14 @@
     host_supported: true,
     visibility: ["//visibility:public"],
 }
+
+java_library {
+    name: "ravenwood-junit",
+    srcs: ["junit-src/**/*.java"],
+    libs: [
+        "junit",
+    ],
+    sdk_version: "core_current",
+    host_supported: true,
+    visibility: ["//visibility:public"],
+}
diff --git a/ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java b/ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java
new file mode 100644
index 0000000..0aac084
--- /dev/null
+++ b/ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2023 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 android.platform.test.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * THIS ANNOTATION IS EXPERIMENTAL. REACH OUT TO g/ravenwood BEFORE USING IT, OR YOU HAVE ANY
+ * QUESTIONS ABOUT IT.
+ *
+ * @hide
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface IgnoreUnderRavenwood {
+}
diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
new file mode 100644
index 0000000..a6b3f66
--- /dev/null
+++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2023 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 android.platform.test.ravenwood;
+
+import android.platform.test.annotations.IgnoreUnderRavenwood;
+
+import org.junit.Assume;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * THIS RULE IS EXPERIMENTAL. REACH OUT TO g/ravenwood BEFORE USING IT, OR YOU HAVE ANY
+ * QUESTIONS ABOUT IT.
+ *
+ * @hide
+ */
+public class RavenwoodRule implements TestRule {
+    public boolean isUnderRavenwood() {
+        // TODO: give ourselves a better environment signal
+        return System.getProperty("java.class.path").contains("ravenwood");
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) {
+                    Assume.assumeFalse(isUnderRavenwood());
+                }
+                base.evaluate();
+            }
+        };
+    }
+}