Mark ab/7061308 as merged in stage.

Bug: 180401296
Merged-In: I6017d049dfe7d4d33e4deaa6f821dcf9c8573f35
Change-Id: Ie6f9cc2e151fe097d56abaf7ba9acffa35b1fb31
diff --git a/Android.bp b/Android.bp
index f3c7e7b..27af338 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,41 @@
 // This file is generated by cargo2android.py --run --device --dependencies --tests.
 
+package {
+    default_applicable_licenses: ["external_rust_crates_scopeguard_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+//
+// large-scale-change included anything that looked like it might be a license
+// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
+//
+// Please consider removing redundant or irrelevant files from 'license_text:'.
+// See: http://go/android-license-faq
+license {
+    name: "external_rust_crates_scopeguard_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+        "SPDX-license-identifier-MIT",
+    ],
+    license_text: [
+        "LICENSE-APACHE",
+        "LICENSE-MIT",
+    ],
+}
+
 rust_library {
     name: "libscopeguard",
     host_supported: true,
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 38e14e2..3ac1ffc 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,17 +2,9 @@
 {
   "presubmit": [
     {
-      "host": true,
-      "name": "scopeguard_host_test_src_lib"
-    },
-    {
       "name": "scopeguard_device_test_src_lib"
     },
     {
-      "host": true,
-      "name": "lock_api_host_test_src_lib"
-    },
-    {
       "name": "lock_api_device_test_src_lib"
     }
   ]
diff --git a/patches/disable_panic_tests.patch b/patches/disable_panic_tests.patch
new file mode 100644
index 0000000..97615cd
--- /dev/null
+++ b/patches/disable_panic_tests.patch
@@ -0,0 +1,20 @@
+diff --git a/src/lib.rs b/src/lib.rs
+index d33c2b6..39f5026 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -500,6 +500,7 @@ mod tests {
+ 
+     #[cfg(feature = "use_std")]
+     #[test]
++    #[ignore = "Android uses panic_abort"]
+     fn test_defer_success_2() {
+         let drops = Cell::new(0);
+         let _ = catch_unwind(AssertUnwindSafe(|| {
+@@ -511,6 +512,7 @@ mod tests {
+ 
+     #[cfg(feature = "use_std")]
+     #[test]
++    #[ignore = "Android uses panic_abort"]
+     fn test_defer_unwind_1() {
+         let drops = Cell::new(0);
+         let _ = catch_unwind(AssertUnwindSafe(|| {
diff --git a/src/lib.rs b/src/lib.rs
index d33c2b6..39f5026 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -500,6 +500,7 @@
 
     #[cfg(feature = "use_std")]
     #[test]
+    #[ignore = "Android uses panic_abort"]
     fn test_defer_success_2() {
         let drops = Cell::new(0);
         let _ = catch_unwind(AssertUnwindSafe(|| {
@@ -511,6 +512,7 @@
 
     #[cfg(feature = "use_std")]
     #[test]
+    #[ignore = "Android uses panic_abort"]
     fn test_defer_unwind_1() {
         let drops = Cell::new(0);
         let _ = catch_unwind(AssertUnwindSafe(|| {