Snap for 8564071 from 01e59128a5539731b50682a79bf107f30f42f170 to mainline-cellbroadcast-release

Change-Id: Ibffb8a1b00f3bbd29da21c6e21d6a4447691088b
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index d513c37..a4887c5 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "772c692150c711d7bdd72b5c6287072b8914e519"
+    "sha1": "75f41fb304d299dfbc07679d15193e03273c4597"
   }
 }
diff --git a/Android.bp b/Android.bp
index f8e17c2..2a9d5d9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,6 +22,8 @@
     name: "libmio",
     host_supported: true,
     crate_name: "mio",
+    cargo_env_compat: true,
+    cargo_pkg_version: "0.7.13",
     srcs: ["src/lib.rs"],
     edition: "2018",
     features: [
@@ -39,12 +41,40 @@
     ],
     apex_available: [
         "//apex_available:platform",
+        "com.android.bluetooth",
         "com.android.resolv",
+        "com.android.uwb",
     ],
+    vendor_available: true,
     min_sdk_version: "29",
 }
 
-// dependent_library ["feature_list"]
-//   cfg-if-1.0.0
-//   libc-0.2.94 "default,std"
-//   log-0.4.14 "std"
+rust_test {
+    name: "mio_test_src_lib",
+    host_supported: true,
+    crate_name: "mio",
+    cargo_env_compat: true,
+    cargo_pkg_version: "0.7.13",
+    srcs: ["src/lib.rs"],
+    test_suites: ["general-tests"],
+    auto_gen_config: true,
+    test_options: {
+        unit_test: true,
+    },
+    edition: "2018",
+    features: [
+        "net",
+        "os-ext",
+        "os-poll",
+        "os-util",
+        "tcp",
+        "udp",
+        "uds",
+    ],
+    rustlibs: [
+        "libenv_logger",
+        "liblibc",
+        "liblog_rust",
+        "librand",
+    ],
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 72cb770..4e12fc3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,18 @@
+# 0.7.13
+
+## Fixes
+
+* Fix `Registry::try_clone` invalid usage of `F_DUPFD_CLOEXEC` (#1497,
+  https://github.com/tokio-rs/mio/commit/2883f5c1f35bf1a59682c5ffc4afe6b97d7d6e68).
+
+# 0.7.12 (yanked)
+
+## Fixes
+
+* Set `FD_CLOEXEC` when calling `Registry::try_clone`
+  (https://github.com/tokio-rs/mio/commit/d1617b567ff6bc669d71e367d22e0e93ff7e2e24 for epoll and
+  (https://github.com/tokio-rs/mio/commit/b367a05e408ca90a26383c3aa16d8a16f019dc59 for kqueue).
+
 # 0.7.11
 
 ## Fixes
diff --git a/Cargo.lock b/Cargo.lock
index c91bfb8..8a0bb77 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -40,7 +40,7 @@
 
 [[package]]
 name = "mio"
-version = "0.7.11"
+version = "0.7.13"
 dependencies = [
  "env_logger",
  "libc",
diff --git a/Cargo.toml b/Cargo.toml
index 62090ff..3a103b3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,12 +13,12 @@
 [package]
 edition = "2018"
 name = "mio"
-version = "0.7.11"
+version = "0.7.13"
 authors = ["Carl Lerche <[email protected]>", "Thomas de Zeeuw <[email protected]>", "Tokio Contributors <[email protected]>"]
 include = ["Cargo.toml", "LICENSE", "README.md", "CHANGELOG.md", "src/**/*.rs", "examples/**/*.rs"]
 description = "Lightweight non-blocking IO"
 homepage = "https://github.com/tokio-rs/mio"
-documentation = "https://docs.rs/mio/0.7.7"
+documentation = "https://docs.rs/mio/0.7.13"
 readme = "README.md"
 keywords = ["io", "async", "non-blocking"]
 categories = ["asynchronous"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index a14d17d..aa2e677 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -6,7 +6,7 @@
 # - Update CHANGELOG.md.
 # - Update doc URL.
 # - Create git tag
-version       = "0.7.11"
+version       = "0.7.13"
 license       = "MIT"
 authors       = [
   "Carl Lerche <[email protected]>",
@@ -14,7 +14,7 @@
   "Tokio Contributors <[email protected]>",
 ]
 description   = "Lightweight non-blocking IO"
-documentation = "https://docs.rs/mio/0.7.7"
+documentation = "https://docs.rs/mio/0.7.13"
 homepage      = "https://github.com/tokio-rs/mio"
 repository    = "https://github.com/tokio-rs/mio"
 readme        = "README.md"
diff --git a/METADATA b/METADATA
index eb89225..79077c2 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/mio/mio-0.7.11.crate"
+    value: "https://static.crates.io/crates/mio/mio-0.7.13.crate"
   }
-  version: "0.7.11"
+  version: "0.7.13"
   license_type: NOTICE
   last_upgrade_date {
     year: 2021
-    month: 4
-    day: 1
+    month: 6
+    day: 21
   }
 }
diff --git a/TEST_MAPPING b/TEST_MAPPING
index fadb544..88a3a20 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,23 +1,39 @@
 // Generated by update_crate_tests.py for tests that depend on this crate.
 {
+  "imports": [
+    {
+      "path": "external/rust/crates/futures-util"
+    },
+    {
+      "path": "external/rust/crates/quiche"
+    },
+    {
+      "path": "external/rust/crates/tokio"
+    },
+    {
+      "path": "external/rust/crates/tokio-test"
+    }
+  ],
   "presubmit": [
     {
-      "name": "tokio-test_device_test_tests_macros"
+      "name": "doh_unit_test"
     },
     {
-      "name": "tokio-test_device_test_tests_block_on"
+      "name": "mio_test_src_lib"
     },
     {
-      "name": "tokio-test_device_test_tests_io"
+      "name": "rustBinderTest"
+    }
+  ],
+  "presubmit-rust": [
+    {
+      "name": "doh_unit_test"
     },
     {
-      "name": "futures-util_device_test_src_lib"
+      "name": "mio_test_src_lib"
     },
     {
-      "name": "tokio-test_device_test_src_lib"
-    },
-    {
-      "name": "quiche_device_test_src_lib"
+      "name": "rustBinderTest"
     }
   ]
 }
diff --git a/cargo2android.json b/cargo2android.json
index 86c4a39..7b3f179 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,11 +1,15 @@
 {
   "apex-available": [
     "//apex_available:platform",
-    "com.android.resolv"
+    "com.android.bluetooth",
+    "com.android.resolv",
+    "com.android.uwb"
   ],
   "dependencies": true,
   "device": true,
   "features": "os-poll,tcp,udp,uds,os-util",
   "min-sdk-version": "29",
-  "run": true
-}
\ No newline at end of file
+  "run": true,
+  "vendor-available": true,
+  "tests": true
+}
diff --git a/src/lib.rs b/src/lib.rs
index ad417c2..165a340 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,4 @@
-#![doc(html_root_url = "https://docs.rs/mio/0.7.11")]
+#![doc(html_root_url = "https://docs.rs/mio/0.7.13")]
 #![deny(
     missing_docs,
     missing_debug_implementations,
diff --git a/src/sys/unix/selector/epoll.rs b/src/sys/unix/selector/epoll.rs
index 76ee7f9..38667d6 100644
--- a/src/sys/unix/selector/epoll.rs
+++ b/src/sys/unix/selector/epoll.rs
@@ -41,7 +41,7 @@
     }
 
     pub fn try_clone(&self) -> io::Result<Selector> {
-        syscall!(dup(self.ep)).map(|ep| Selector {
+        syscall!(fcntl(self.ep, libc::F_DUPFD_CLOEXEC, super::LOWEST_FD)).map(|ep| Selector {
             // It's the same selector, so we use the same id.
             #[cfg(debug_assertions)]
             id: self.id,
diff --git a/src/sys/unix/selector/kqueue.rs b/src/sys/unix/selector/kqueue.rs
index 34f5340..b36a537 100644
--- a/src/sys/unix/selector/kqueue.rs
+++ b/src/sys/unix/selector/kqueue.rs
@@ -87,7 +87,7 @@
     }
 
     pub fn try_clone(&self) -> io::Result<Selector> {
-        syscall!(dup(self.kq)).map(|kq| Selector {
+        syscall!(fcntl(self.kq, libc::F_DUPFD_CLOEXEC, super::LOWEST_FD)).map(|kq| Selector {
             // It's the same selector, so we use the same id.
             #[cfg(debug_assertions)]
             id: self.id,
diff --git a/src/sys/unix/selector/mod.rs b/src/sys/unix/selector/mod.rs
index 7525898..b73d645 100644
--- a/src/sys/unix/selector/mod.rs
+++ b/src/sys/unix/selector/mod.rs
@@ -33,3 +33,13 @@
     target_os = "openbsd"
 ))]
 pub(crate) use self::kqueue::{event, Event, Events, Selector};
+
+/// Lowest file descriptor used in `Selector::try_clone`.
+///
+/// # Notes
+///
+/// Usually fds 0, 1 and 2 are standard in, out and error. Some application
+/// blindly assume this to be true, which means using any one of those a select
+/// could result in some interesting and unexpected errors. Avoid that by using
+/// an fd that doesn't have a pre-determined usage.
+const LOWEST_FD: libc::c_int = 3;