Merge changes Id338f439,Ic7f50453 into main

* changes:
  bootstat: avoid vector<const T>
  fs_mgr: avoid vector<const T>
diff --git a/debuggerd/client/debuggerd_client.cpp b/debuggerd/client/debuggerd_client.cpp
index af1bb81..632f6f1 100644
--- a/debuggerd/client/debuggerd_client.cpp
+++ b/debuggerd/client/debuggerd_client.cpp
@@ -138,7 +138,7 @@
 
     auto remaining = end - std::chrono::steady_clock::now();
     if (remaining < decltype(remaining)::zero()) {
-      log_error(output_fd, 0, "timeout expired");
+      log_error(output_fd, 0, "timeout expired (update_timeout)");
       return false;
     }
 
@@ -254,7 +254,7 @@
     if (timeout_ms <= 0) {
       remaining_ms = -1;
     } else if (remaining_ms < 0) {
-      log_error(output_fd, 0, "timeout expired");
+      log_error(output_fd, 0, "timeout expired before poll");
       return false;
     }
 
@@ -271,7 +271,7 @@
         return false;
       }
     } else if (rc == 0) {
-      log_error(output_fd, 0, "timeout expired");
+      log_error(output_fd, 0, "poll timeout expired");
       return false;
     }
 
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 7f41cea..5156754 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -1556,6 +1556,7 @@
                                    attempted_entry.mount_point, wiped ? "true" : "false",
                                    attempted_entry.fs_type,
                                    attempted_entry.fs_mgr_flags.is_zoned ? "true" : "false",
+                                   std::to_string(attempted_entry.length),
                                    android::base::Join(attempted_entry.user_devices, ' ')},
                                   nullptr)) {
                         LERROR << "Encryption failed";
@@ -1601,6 +1602,7 @@
                                current_entry.mount_point, "true" /* shouldFormat */,
                                current_entry.fs_type,
                                current_entry.fs_mgr_flags.is_zoned ? "true" : "false",
+                               std::to_string(current_entry.length),
                                android::base::Join(current_entry.user_devices, ' ')},
                               nullptr)) {
                     LERROR << "Encryption failed";
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
index 6d422c6..1ec8634 100644
--- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
@@ -335,6 +335,9 @@
     // after loading selinux policy.
     bool PrepareSnapuserdArgsForSelinux(std::vector<std::string>* snapuserd_argv);
 
+    // If snapuserd from first stage init was started from system partition.
+    bool MarkSnapuserdFromSystem();
+
     // Detach dm-user devices from the first stage snapuserd. Load
     // new dm-user tables after loading selinux policy.
     bool DetachFirstStageSnapuserdForSelinux();
@@ -670,6 +673,7 @@
     std::string GetForwardMergeIndicatorPath();
     std::string GetOldPartitionMetadataPath();
     std::string GetBootSnapshotsWithoutSlotSwitchPath();
+    std::string GetSnapuserdFromSystemPath();
 
     const LpMetadata* ReadOldPartitionMetadata(LockedFile* lock);
 
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index c01360e..3a474d7 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -88,6 +88,7 @@
         "/metadata/ota/snapshot-boot-without-slot-switch";
 static constexpr char kBootIndicatorPath[] = "/metadata/ota/snapshot-boot";
 static constexpr char kRollbackIndicatorPath[] = "/metadata/ota/rollback-indicator";
+static constexpr char kSnapuserdFromSystem[] = "/metadata/ota/snapuserd-from-system";
 static constexpr auto kUpdateStateCheckInterval = 2s;
 /*
  * The readahead size is set to 32kb so that
@@ -318,7 +319,7 @@
     std::vector<std::string> files = {
             GetSnapshotBootIndicatorPath(),          GetRollbackIndicatorPath(),
             GetForwardMergeIndicatorPath(),          GetOldPartitionMetadataPath(),
-            GetBootSnapshotsWithoutSlotSwitchPath(),
+            GetBootSnapshotsWithoutSlotSwitchPath(), GetSnapuserdFromSystemPath(),
     };
     for (const auto& file : files) {
         RemoveFileIfExists(file);
@@ -1457,6 +1458,10 @@
     return metadata_dir_ + "/" + android::base::Basename(kRollbackIndicatorPath);
 }
 
+std::string SnapshotManager::GetSnapuserdFromSystemPath() {
+    return metadata_dir_ + "/" + android::base::Basename(kSnapuserdFromSystem);
+}
+
 std::string SnapshotManager::GetForwardMergeIndicatorPath() {
     return metadata_dir_ + "/allow-forward-merge";
 }
@@ -2122,6 +2127,16 @@
     return update_status.o_direct();
 }
 
+bool SnapshotManager::MarkSnapuserdFromSystem() {
+    auto path = GetSnapuserdFromSystemPath();
+
+    if (!android::base::WriteStringToFile("1", path)) {
+        PLOG(ERROR) << "Unable to write to vendor update path: " << path;
+        return false;
+    }
+    return true;
+}
+
 /*
  * Please see b/304829384 for more details.
  *
@@ -2158,11 +2173,26 @@
  *         iii: If both (i) and (ii) are true, then use the dm-snapshot based
  *         approach.
  *
+ * 3: Post OTA reboot, if the vendor partition was updated from Android 12 to
+ * any other release post Android 12, then snapuserd binary will be "system"
+ * partition as post Android 12, init_boot will contain a copy of snapuserd
+ * binary. Thus, during first stage init, if init is able to communicate to
+ * daemon, that gives us a signal that the binary is from "system" copy. Hence,
+ * there is no need to fallback to legacy dm-snapshot. Thus, init will use a
+ * marker in /metadata to signal that the snapuserd binary from first stage init
+ * can handle userspace snapshots.
+ *
  */
 bool SnapshotManager::IsLegacySnapuserdPostReboot() {
     if (is_legacy_snapuserd_.has_value() && is_legacy_snapuserd_.value() == true) {
         auto slot = GetCurrentSlot();
         if (slot == Slot::Target) {
+            // If this marker is present, then daemon can handle userspace
+            // snapshots; also, it indicates that the vendor partition was
+            // updated from Android 12.
+            if (access(GetSnapuserdFromSystemPath().c_str(), F_OK) == 0) {
+                return false;
+            }
             return true;
         }
     }
diff --git a/fs_mgr/libsnapshot/snapshot_test.cpp b/fs_mgr/libsnapshot/snapshot_test.cpp
index 3299ec5..1435b12 100644
--- a/fs_mgr/libsnapshot/snapshot_test.cpp
+++ b/fs_mgr/libsnapshot/snapshot_test.cpp
@@ -1978,6 +1978,8 @@
 }
 
 TEST_F(MetadataMountedTest, Recovery) {
+    GTEST_SKIP() << "b/350715463";
+
     test_device->set_recovery(true);
     metadata_dir_ = test_device->GetMetadataDir();
 
diff --git a/fs_mgr/libsnapshot/snapuserd/Android.bp b/fs_mgr/libsnapshot/snapuserd/Android.bp
index d83524a..b3a7e8c 100644
--- a/fs_mgr/libsnapshot/snapuserd/Android.bp
+++ b/fs_mgr/libsnapshot/snapuserd/Android.bp
@@ -166,6 +166,7 @@
     ],
     ramdisk_available: false,
     vendor_ramdisk_available: true,
+    recovery_available: true,
 }
 
 // This target will install to /system/bin/snapuserd_ramdisk
diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_test.cpp b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_test.cpp
index 56f7b59..6d0ae3d 100644
--- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_test.cpp
+++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_test.cpp
@@ -79,6 +79,8 @@
     std::unique_ptr<ICowWriter> CreateCowDeviceInternal();
     std::unique_ptr<ICowWriter> CreateV3Cow();
 
+    unique_fd GetCowFd() { return unique_fd{dup(cow_system_->fd)}; }
+
     std::unique_ptr<ITestHarness> harness_;
     size_t size_ = 10_MiB;
     int total_base_size_ = 0;
@@ -101,7 +103,9 @@
 #endif
 }
 
-void SnapuserdTestBase::TearDown() {}
+void SnapuserdTestBase::TearDown() {
+    cow_system_ = nullptr;
+}
 
 void SnapuserdTestBase::CreateBaseDevice() {
     total_base_size_ = (size_ * 5);
@@ -132,10 +136,7 @@
     CowOptions options;
     options.compression = "gz";
 
-    unique_fd fd(cow_system_->fd);
-    cow_system_->fd = -1;
-
-    return CreateCowWriter(2, options, std::move(fd));
+    return CreateCowWriter(2, options, GetCowFd());
 }
 
 std::unique_ptr<ICowWriter> SnapuserdTestBase::CreateV3Cow() {
@@ -151,10 +152,7 @@
     std::string path = android::base::GetExecutableDirectory();
     cow_system_ = std::make_unique<TemporaryFile>(path);
 
-    unique_fd fd(cow_system_->fd);
-    cow_system_->fd = -1;
-
-    return CreateCowWriter(3, options, std::move(fd));
+    return CreateCowWriter(3, options, GetCowFd());
 }
 
 void SnapuserdTestBase::CreateCowDevice() {
diff --git a/init/Android.bp b/init/Android.bp
index 7b7a856..c70a5de 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -338,7 +338,7 @@
     module_type: "cc_defaults",
     config_namespace: "ANDROID",
     bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
-    properties: ["installable"],
+    properties: ["no_full_install"],
 }
 
 // Do not install init_first_stage even with mma if we're system-as-root.
@@ -347,7 +347,7 @@
     name: "init_first_stage_defaults",
     soong_config_variables: {
         BOARD_USES_RECOVERY_AS_BOOT: {
-            installable: false,
+            no_full_install: true,
         },
     },
 
diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp
index 5d3a273..55cce6e 100644
--- a/init/first_stage_mount.cpp
+++ b/init/first_stage_mount.cpp
@@ -395,12 +395,7 @@
 
     use_snapuserd_ = sm->IsSnapuserdRequired();
     if (use_snapuserd_) {
-        if (sm->UpdateUsesUserSnapshots()) {
-            LaunchFirstStageSnapuserd();
-        } else {
-            LOG(FATAL) << "legacy virtual-ab is no longer supported";
-            return false;
-        }
+        LaunchFirstStageSnapuserd();
     }
 
     sm->SetUeventRegenCallback([this](const std::string& device) -> bool {
diff --git a/init/snapuserd_transition.cpp b/init/snapuserd_transition.cpp
index 9e3ff41..2370bc2 100644
--- a/init/snapuserd_transition.cpp
+++ b/init/snapuserd_transition.cpp
@@ -100,6 +100,10 @@
     }
     if (client->SupportsSecondStageSocketHandoff()) {
         setenv(kSnapuserdFirstStageInfoVar, "socket", 1);
+        auto sm = SnapshotManager::NewForFirstStageMount();
+        if (!sm->MarkSnapuserdFromSystem()) {
+            LOG(ERROR) << "Failed to update MarkSnapuserdFromSystem";
+        }
     }
 
     setenv(kSnapuserdFirstStagePidVar, std::to_string(pid).c_str(), 1);
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index 39cae1b..3c3eeb6 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -155,23 +155,18 @@
                 "fs_config.cpp",
             ],
         },
-        not_windows: {
-            srcs: libcutils_nonwindows_sources + [
-                "ashmem-host.cpp",
-                "trace-host.cpp",
-            ],
-        },
-        windows: {
-            host_ldlibs: ["-lws2_32"],
-
+        host: {
             srcs: [
                 "trace-host.cpp",
+                "ashmem-host.cpp",
             ],
-
+        },
+        not_windows: {
+            srcs: libcutils_nonwindows_sources,
+        },
+        windows: {
             enabled: true,
-            cflags: [
-                "-D_GNU_SOURCE",
-            ],
+            host_ldlibs: ["-lws2_32"],
         },
         android: {
             sanitize: {
@@ -240,6 +235,7 @@
 cc_defaults {
     name: "libcutils_test_default",
     srcs: [
+        "ashmem_base_test.cpp",
         "native_handle_test.cpp",
         "properties_test.cpp",
         "sockets_test.cpp",
@@ -298,20 +294,26 @@
 cc_defaults {
     name: "libcutils_test_static_defaults",
     defaults: ["libcutils_test_default"],
-    static_libs: [
-        "libc",
-        "libcgrouprc_format",
-    ] + test_libraries + always_static_test_libraries,
     stl: "libc++_static",
     require_root: true,
 
     target: {
         android: {
             static_executable: true,
+            static_libs: [
+                "libcgrouprc_format",
+            ] + test_libraries + always_static_test_libraries,
+        },
+        not_windows: {
+            static_libs: test_libraries + always_static_test_libraries,
         },
         windows: {
+            static_libs: [
+                "libbase",
+                "libcutils",
+                "libcutils_sockets",
+            ],
             host_ldlibs: ["-lws2_32"],
-
             enabled: true,
         },
     },
@@ -319,6 +321,7 @@
 
 cc_test {
     name: "libcutils_test_static",
+    host_supported: true,
     test_suites: ["device-tests"],
     defaults: ["libcutils_test_static_defaults"],
 }
diff --git a/libcutils/ashmem-host.cpp b/libcutils/ashmem-host.cpp
index 2ba1eb0..9003b76 100644
--- a/libcutils/ashmem-host.cpp
+++ b/libcutils/ashmem-host.cpp
@@ -17,10 +17,13 @@
 #include <cutils/ashmem.h>
 
 /*
- * Implementation of the user-space ashmem API for the simulator, which lacks
- * an ashmem-enabled kernel. See ashmem-dev.c for the real ashmem-based version.
+ * Implementation of the user-space ashmem API for the simulator, which lacks an
+ * ashmem-enabled kernel. See ashmem-dev.c for the real ashmem-based version.  A
+ * disk-backed temp file is the best option that is consistently supported
+ * across all host platforms.
  */
 
+#include <android-base/unique_fd.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
@@ -31,8 +34,10 @@
 #include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
-
 #include <utils/Compat.h>
+#include <memory>
+
+using android::base::unique_fd;
 
 static bool ashmem_validate_stat(int fd, struct stat* buf) {
     int result = fstat(fd, buf);
@@ -40,15 +45,20 @@
         return false;
     }
 
-    /*
-     * Check if this is an "ashmem" region.
-     * TODO: This is very hacky, and can easily break.
-     * We need some reliable indicator.
-     */
-    if (!(buf->st_nlink == 0 && S_ISREG(buf->st_mode))) {
+    // Check if this is an ashmem region. Since there's no such thing on the host,
+    // we can't actually implement that. Check that it's at least a regular file.
+    if (!S_ISREG(buf->st_mode)) {
         errno = ENOTTY;
         return false;
     }
+    // In Win32, unlike Unix, the temp file is not unlinked immediately after
+    // creation.
+#if !defined(_WIN32)
+    if (buf->st_nlink != 0) {
+        errno = ENOTTY;
+        return false;
+    }
+#endif
     return true;
 }
 
@@ -58,19 +68,24 @@
 }
 
 int ashmem_create_region(const char* /*ignored*/, size_t size) {
-    char pattern[PATH_MAX];
-    snprintf(pattern, sizeof(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid());
-    int fd = mkstemp(pattern);
-    if (fd == -1) return -1;
+    // Files returned by tmpfile are automatically removed.
+    std::unique_ptr<FILE, decltype(&fclose)> tmp(tmpfile(), &fclose);
 
-    unlink(pattern);
-
-    if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) {
-      close(fd);
-      return -1;
+    if (!tmp) {
+        return -1;
     }
-
-    return fd;
+    int fd = fileno(tmp.get());
+    if (fd == -1) {
+        return -1;
+    }
+    unique_fd dupfd = unique_fd(dup(fd));
+    if (dupfd == -1) {
+        return -1;
+    }
+    if (TEMP_FAILURE_RETRY(ftruncate(dupfd, size)) == -1) {
+        return -1;
+    }
+    return dupfd.release();
 }
 
 int ashmem_set_prot_region(int /*fd*/, int /*prot*/) {
diff --git a/libcutils/ashmem_base_test.cpp b/libcutils/ashmem_base_test.cpp
new file mode 100644
index 0000000..c9b14e5
--- /dev/null
+++ b/libcutils/ashmem_base_test.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+#include <gtest/gtest.h>
+
+#include <unistd.h>
+
+#include <android-base/mapped_file.h>
+#include <android-base/unique_fd.h>
+#include <cutils/ashmem.h>
+
+/*
+ * Tests in AshmemBaseTest are designed to run on Android as well as host
+ * platforms (Linux, Mac, Windows).
+ */
+
+#if defined(_WIN32)
+static inline size_t getpagesize() {
+    return 4096;
+}
+#endif
+
+using android::base::unique_fd;
+
+TEST(AshmemBaseTest, BasicTest) {
+    const size_t size = getpagesize();
+    std::vector<uint8_t> data(size);
+    std::generate(data.begin(), data.end(), [n = 0]() mutable { return n++ & 0xFF; });
+
+    unique_fd fd = unique_fd(ashmem_create_region(nullptr, size));
+    ASSERT_TRUE(fd >= 0);
+    ASSERT_TRUE(ashmem_valid(fd));
+    ASSERT_EQ(size, static_cast<size_t>(ashmem_get_size_region(fd)));
+
+    std::unique_ptr<android::base::MappedFile> mapped =
+            android::base::MappedFile::FromFd(fd, 0, size, PROT_READ | PROT_WRITE);
+    EXPECT_TRUE(mapped.get() != nullptr);
+    void* region1 = mapped->data();
+    EXPECT_TRUE(region1 != nullptr);
+
+    memcpy(region1, data.data(), size);
+    ASSERT_EQ(0, memcmp(region1, data.data(), size));
+
+    std::unique_ptr<android::base::MappedFile> mapped2 =
+            android::base::MappedFile::FromFd(fd, 0, size, PROT_READ | PROT_WRITE);
+    EXPECT_TRUE(mapped2.get() != nullptr);
+    void* region2 = mapped2->data();
+    EXPECT_TRUE(region2 != nullptr);
+    ASSERT_EQ(0, memcmp(region2, data.data(), size));
+}
diff --git a/libcutils/ashmem_test.cpp b/libcutils/ashmem_test.cpp
index 571b410..ccbb8c9 100644
--- a/libcutils/ashmem_test.cpp
+++ b/libcutils/ashmem_test.cpp
@@ -69,28 +69,6 @@
     }
 }
 
-TEST(AshmemTest, BasicTest) {
-    const size_t size = getpagesize();
-    std::vector<uint8_t> data(size);
-    FillData(data);
-
-    unique_fd fd;
-    ASSERT_NO_FATAL_FAILURE(TestCreateRegion(size, fd, PROT_READ | PROT_WRITE));
-
-    void* region1 = nullptr;
-    ASSERT_NO_FATAL_FAILURE(TestMmap(fd, size, PROT_READ | PROT_WRITE, &region1));
-
-    memcpy(region1, data.data(), size);
-    ASSERT_EQ(0, memcmp(region1, data.data(), size));
-
-    EXPECT_EQ(0, munmap(region1, size));
-
-    void *region2;
-    ASSERT_NO_FATAL_FAILURE(TestMmap(fd, size, PROT_READ, &region2));
-    ASSERT_EQ(0, memcmp(region2, data.data(), size));
-    EXPECT_EQ(0, munmap(region2, size));
-}
-
 TEST(AshmemTest, ForkTest) {
     const size_t size = getpagesize();
     std::vector<uint8_t> data(size);
diff --git a/libcutils/sockets_test.cpp b/libcutils/sockets_test.cpp
index 1fa40bc..f6f9c36 100644
--- a/libcutils/sockets_test.cpp
+++ b/libcutils/sockets_test.cpp
@@ -19,8 +19,6 @@
 // should be the case for loopback communication, but is not guaranteed.
 
 #include <string.h>
-#include <sys/socket.h>
-#include <sys/types.h>
 #include <time.h>
 
 #include <cutils/sockets.h>
diff --git a/libutils/CallStack_test.cpp b/libutils/CallStack_test.cpp
index bfe6b87..5ed3c27 100644
--- a/libutils/CallStack_test.cpp
+++ b/libutils/CallStack_test.cpp
@@ -73,7 +73,7 @@
     android::CallStack::logStack("callstack_test");
     auto logger_list = android_logger_list_open(android_name_to_log_id("main"),
                                                 ANDROID_LOG_NONBLOCK,
-                                                10000 /* tail */, getpid());
+                                                INT_MAX /* tail */, getpid());
     ASSERT_NE(nullptr, logger_list);
     std::string log;
     while (true) {
diff --git a/libutils/Looper.cpp b/libutils/Looper.cpp
index 7700c90..e11d197 100644
--- a/libutils/Looper.cpp
+++ b/libutils/Looper.cpp
@@ -70,8 +70,7 @@
 // Maximum number of file descriptors for which to retrieve poll events each iteration.
 static const int EPOLL_MAX_EVENTS = 16;
 
-static pthread_once_t gTLSOnce = PTHREAD_ONCE_INIT;
-static pthread_key_t gTLSKey = 0;
+thread_local static sp<Looper> gThreadLocalLooper;
 
 Looper::Looper(bool allowNonCallbacks)
     : mAllowNonCallbacks(allowNonCallbacks),
@@ -91,38 +90,12 @@
 Looper::~Looper() {
 }
 
-void Looper::initTLSKey() {
-    int error = pthread_key_create(&gTLSKey, threadDestructor);
-    LOG_ALWAYS_FATAL_IF(error != 0, "Could not allocate TLS key: %s", strerror(error));
-}
-
-void Looper::threadDestructor(void *st) {
-    Looper* const self = static_cast<Looper*>(st);
-    if (self != nullptr) {
-        self->decStrong((void*)threadDestructor);
-    }
-}
-
 void Looper::setForThread(const sp<Looper>& looper) {
-    sp<Looper> old = getForThread(); // also has side-effect of initializing TLS
-
-    if (looper != nullptr) {
-        looper->incStrong((void*)threadDestructor);
-    }
-
-    pthread_setspecific(gTLSKey, looper.get());
-
-    if (old != nullptr) {
-        old->decStrong((void*)threadDestructor);
-    }
+    gThreadLocalLooper = looper;
 }
 
 sp<Looper> Looper::getForThread() {
-    int result = pthread_once(& gTLSOnce, initTLSKey);
-    LOG_ALWAYS_FATAL_IF(result != 0, "pthread_once failed");
-
-    Looper* looper = (Looper*)pthread_getspecific(gTLSKey);
-    return sp<Looper>::fromExisting(looper);
+    return gThreadLocalLooper;
 }
 
 sp<Looper> Looper::prepare(int opts) {
diff --git a/libutils/abi-dumps/arm64/source-based/libutils.so.lsdump b/libutils/abi-dumps/arm64/source-based/libutils.so.lsdump
index 82ddca8..caea1a9 100644
--- a/libutils/abi-dumps/arm64/source-based/libutils.so.lsdump
+++ b/libutils/abi-dumps/arm64/source-based/libutils.so.lsdump
@@ -510,9 +510,6 @@
    "name" : "_ZN7android47LightRefBase_reportIncStrongRequireStrongFailedEPKv"
   },
   {
-   "name" : "_ZN7android6Looper10initTLSKeyEv"
-  },
-  {
    "name" : "_ZN7android6Looper11sendMessageERKNS_2spINS_14MessageHandlerEEERKNS_7MessageE"
   },
   {
@@ -528,9 +525,6 @@
    "name" : "_ZN7android6Looper14removeMessagesERKNS_2spINS_14MessageHandlerEEEi"
   },
   {
-   "name" : "_ZN7android6Looper16threadDestructorEPv"
-  },
-  {
    "name" : "_ZN7android6Looper17sendMessageAtTimeElRKNS_2spINS_14MessageHandlerEEERKNS_7MessageE"
   },
   {
@@ -6910,13 +6904,6 @@
    "source_file" : "system/core/libutils/include/utils/LightRefBase.h"
   },
   {
-   "access" : "private",
-   "function_name" : "android::Looper::initTLSKey",
-   "linker_set_key" : "_ZN7android6Looper10initTLSKeyEv",
-   "return_type" : "_ZTIv",
-   "source_file" : "system/core/libutils/include/utils/Looper.h"
-  },
-  {
    "function_name" : "android::Looper::sendMessage",
    "linker_set_key" : "_ZN7android6Looper11sendMessageERKNS_2spINS_14MessageHandlerEEERKNS_7MessageE",
    "parameters" :
@@ -6989,19 +6976,6 @@
    "source_file" : "system/core/libutils/include/utils/Looper.h"
   },
   {
-   "access" : "private",
-   "function_name" : "android::Looper::threadDestructor",
-   "linker_set_key" : "_ZN7android6Looper16threadDestructorEPv",
-   "parameters" :
-   [
-    {
-     "referenced_type" : "_ZTIPv"
-    }
-   ],
-   "return_type" : "_ZTIv",
-   "source_file" : "system/core/libutils/include/utils/Looper.h"
-  },
-  {
    "function_name" : "android::Looper::sendMessageAtTime",
    "linker_set_key" : "_ZN7android6Looper17sendMessageAtTimeElRKNS_2spINS_14MessageHandlerEEERKNS_7MessageE",
    "parameters" :
diff --git a/libutils/abi-dumps/arm_arm64/source-based/libutils.so.lsdump b/libutils/abi-dumps/arm_arm64/source-based/libutils.so.lsdump
index dfc1ab5..b9c4c52 100644
--- a/libutils/abi-dumps/arm_arm64/source-based/libutils.so.lsdump
+++ b/libutils/abi-dumps/arm_arm64/source-based/libutils.so.lsdump
@@ -514,9 +514,6 @@
    "name" : "_ZN7android47LightRefBase_reportIncStrongRequireStrongFailedEPKv"
   },
   {
-   "name" : "_ZN7android6Looper10initTLSKeyEv"
-  },
-  {
    "name" : "_ZN7android6Looper11sendMessageERKNS_2spINS_14MessageHandlerEEERKNS_7MessageE"
   },
   {
@@ -532,9 +529,6 @@
    "name" : "_ZN7android6Looper14removeMessagesERKNS_2spINS_14MessageHandlerEEEi"
   },
   {
-   "name" : "_ZN7android6Looper16threadDestructorEPv"
-  },
-  {
    "name" : "_ZN7android6Looper17sendMessageAtTimeExRKNS_2spINS_14MessageHandlerEEERKNS_7MessageE"
   },
   {
@@ -6950,13 +6944,6 @@
    "source_file" : "system/core/libutils/include/utils/LightRefBase.h"
   },
   {
-   "access" : "private",
-   "function_name" : "android::Looper::initTLSKey",
-   "linker_set_key" : "_ZN7android6Looper10initTLSKeyEv",
-   "return_type" : "_ZTIv",
-   "source_file" : "system/core/libutils/include/utils/Looper.h"
-  },
-  {
    "function_name" : "android::Looper::sendMessage",
    "linker_set_key" : "_ZN7android6Looper11sendMessageERKNS_2spINS_14MessageHandlerEEERKNS_7MessageE",
    "parameters" :
@@ -7029,19 +7016,6 @@
    "source_file" : "system/core/libutils/include/utils/Looper.h"
   },
   {
-   "access" : "private",
-   "function_name" : "android::Looper::threadDestructor",
-   "linker_set_key" : "_ZN7android6Looper16threadDestructorEPv",
-   "parameters" :
-   [
-    {
-     "referenced_type" : "_ZTIPv"
-    }
-   ],
-   "return_type" : "_ZTIv",
-   "source_file" : "system/core/libutils/include/utils/Looper.h"
-  },
-  {
    "function_name" : "android::Looper::sendMessageAtTime",
    "linker_set_key" : "_ZN7android6Looper17sendMessageAtTimeExRKNS_2spINS_14MessageHandlerEEERKNS_7MessageE",
    "parameters" :
diff --git a/libutils/include/utils/Looper.h b/libutils/include/utils/Looper.h
index 41c5536..a02280b 100644
--- a/libutils/include/utils/Looper.h
+++ b/libutils/include/utils/Looper.h
@@ -499,8 +499,6 @@
     void rebuildEpollLocked();
     void scheduleEpollRebuildLocked();
 
-    static void initTLSKey();
-    static void threadDestructor(void *st);
     static void initEpollEvent(struct epoll_event* eventItem);
 };
 
diff --git a/mini_keyctl/OWNERS b/mini_keyctl/OWNERS
index f9e7b25..1f2485a 100644
--- a/mini_keyctl/OWNERS
+++ b/mini_keyctl/OWNERS
@@ -1,4 +1,3 @@
-alanstokes@google.com
 ebiggers@google.com
 jeffv@google.com
 jiyong@google.com