Merge changes from topic "revert-25477883-gs-common_bootctrl-aidl-APKJEMYEPE" into main

* changes:
  Revert "gs-common: add device_google_gs-common_license"
  Revert "gs-common: move bootctrl hal aidl implementation to gs-c..."
  Revert "gs-common: create bootctrl_aidl.mk and include related m..."
  Revert "gs-common: move sepolicy related to bootctrl hal aidl to..."
diff --git a/device.mk b/device.mk
index 4787315..45b7da8 100644
--- a/device.mk
+++ b/device.mk
@@ -14,7 +14,9 @@
 # limitations under the License.
 #
 
+ifeq (,$(filter true, $(PRODUCT_WITHOUT_TTS_VOICE_PACKS)))
 include device/google/gs-common/tts/voice_packs.mk
+endif
 
 PRODUCT_SOONG_NAMESPACES += \
 	device/google/gs-common/powerstats
diff --git a/edgetpu/sepolicy/edgetpu_tachyon_service.te b/edgetpu/sepolicy/edgetpu_tachyon_service.te
index 66a4667..5ead23b 100644
--- a/edgetpu/sepolicy/edgetpu_tachyon_service.te
+++ b/edgetpu/sepolicy/edgetpu_tachyon_service.te
@@ -27,6 +27,9 @@
 allow edgetpu_tachyon_server gpu_device:dir r_dir_perms;
 allow edgetpu_tachyon_server ion_device:chr_file r_file_perms;
 
+# Allow Tachyon service to access dmabuf sysytem.
+allow edgetpu_tachyon_server dmabuf_system_heap_device:chr_file r_file_perms;
+
 # Allow Tachyon service to read the overcommit_memory info.
 allow edgetpu_tachyon_server proc_overcommit_memory:file r_file_perms;
 
diff --git a/gxp/sepolicy/edgetpu_tachyon_service.te b/gxp/sepolicy/edgetpu_tachyon_service.te
new file mode 100644
index 0000000..35987dd
--- /dev/null
+++ b/gxp/sepolicy/edgetpu_tachyon_service.te
@@ -0,0 +1,3 @@
+# Allow Tachyon service to access the GXP device and read GXP properties.
+allow edgetpu_tachyon_server gxp_device:chr_file rw_file_perms;
+get_prop(edgetpu_tachyon_server, vendor_gxp_prop)
diff --git a/modem/Android.bp b/modem/Android.bp
deleted file mode 100644
index dbc1cac..0000000
--- a/modem/Android.bp
+++ /dev/null
@@ -1,44 +0,0 @@
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-sh_binary {
-    name: "dump_modem.sh",
-    src: "dump_modem.sh",
-    vendor: true,
-    sub_dir: "dump",
-}
-
-cc_defaults {
-    name: "dump_modemlog_defaults",
-    srcs: ["modem_log_dumper.cpp"],
-    local_include_dirs: ["include"],
-    shared_libs: ["liblog"],
-}
-
-cc_binary {
-    name: "dump_modemlog",
-    srcs: ["dump_modemlog.cpp"],
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-    ],
-    shared_libs: [
-        "libbase",
-        "libdump",
-        "liblog",
-    ],
-    defaults: ["dump_modemlog_defaults"],
-    vendor: true,
-    relative_install_path: "dump",
-}
-
-cc_test {
-    name: "dump_modemlog_test",
-    srcs: ["test/*.cpp"],
-    defaults: ["dump_modemlog_defaults"],
-    local_include_dirs: ["test/include"],
-    static_libs: ["libgmock"],
-    vendor: true,
-}
diff --git a/modem/OWNERS b/modem/OWNERS
new file mode 100644
index 0000000..4b70b88
--- /dev/null
+++ b/modem/OWNERS
@@ -0,0 +1,3 @@
+# Give ownership of code files to Apps and Services team.
+# SEPolicy files are intentionally ignored since they should be reviewed by the SEPolicy team.
+per-file *.bp,*.cpp,*.h,*.sh=kierancyphus@google.com,everrosales@google.com,nicoleytlee@google.com,alanblc@google.com
diff --git a/modem/android_property_manager/Android.bp b/modem/android_property_manager/Android.bp
new file mode 100644
index 0000000..af89aec
--- /dev/null
+++ b/modem/android_property_manager/Android.bp
@@ -0,0 +1,9 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_library {
+    name: "modem_android_property_manager",
+    export_include_dirs: [ "include" ],
+    vendor_available: true,
+}
diff --git a/modem/android_property_manager/fake/Android.bp b/modem/android_property_manager/fake/Android.bp
new file mode 100644
index 0000000..247b97c
--- /dev/null
+++ b/modem/android_property_manager/fake/Android.bp
@@ -0,0 +1,23 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+// When `modem_android_property_manager_fake` is included statically, its
+// dependencies are not transitively included, so the target will also have to
+// include this default to restate them.
+cc_defaults {
+    name: "modem_android_property_manager_fake_defaults",
+    static_libs: [
+        "modem_android_property_manager",
+        "libbase",
+        "modem_log_constants",
+    ],
+}
+
+cc_library_static {
+    name: "modem_android_property_manager_fake",
+    export_include_dirs: [ "include" ],
+    srcs: [ "fake_android_property_manager.cpp" ],
+    defaults: [ "modem_android_property_manager_fake_defaults" ],
+    vendor_available: true,
+}
diff --git a/modem/android_property_manager/fake/fake_android_property_manager.cpp b/modem/android_property_manager/fake/fake_android_property_manager.cpp
new file mode 100644
index 0000000..d25d6da
--- /dev/null
+++ b/modem/android_property_manager/fake/fake_android_property_manager.cpp
@@ -0,0 +1,80 @@
+#include "fake_android_property_manager.h"
+
+#include <android-base/parseint.h>
+#include <android-base/result.h>
+
+#include <cerrno>
+#include <map>
+#include <string>
+
+#include "modem_log_constants.h"
+
+namespace pixel_modem {
+
+bool FakeAndroidPropertyManager::GetBoolProperty(const std::string& key,
+                                                 bool default_value) {
+  auto value_result = GetProperty(key);
+  return value_result.ok() ? (*value_result) == kTruthString : default_value;
+}
+
+std::string FakeAndroidPropertyManager::GetProperty(
+    const std::string& key, const std::string& default_value) {
+  auto value_result = GetProperty(key);
+  return value_result.ok() ? *value_result : default_value;
+}
+
+int FakeAndroidPropertyManager::GetIntProperty(const std::string& key,
+                                               int default_value) {
+  int value = default_value;
+
+  auto property_result = GetProperty(key);
+  if (property_result.ok()) {
+    android::base::ParseInt<int>((*property_result).data(), &value);
+  }
+  return value;
+}
+
+/**
+ * This function needs to copy the behaviour of `modem_logging_control` to
+ * ensure that the right properties are being set in order.
+ *
+ * More specifically, this function will also set the
+ * `kModemLoggingStatusProperty` whenever `kModemLoggingEnabledProperty` is
+ * set to simulate modem logging stopping / starting.
+ */
+bool FakeAndroidPropertyManager::SetProperty(const std::string& key,
+                                             const std::string& value) {
+  if (key == logging::kModemLoggingEnabledProperty) {
+    property_map_[logging::kModemLoggingStatusProperty.data()] = value;
+
+    // need to track if modem logging has restarted or not
+    if (value == kFalseString) {
+      modem_logging_has_been_off_ = true;
+    }
+    if (modem_logging_has_been_off_ && (value == kTruthString)) {
+      modem_logging_has_restarted_ = true;
+    }
+  }
+  property_map_[key] = value;
+  return true;
+}
+
+/**
+ * @brief Gets android system property if present.
+ *
+ * @param[in] key Name of property.
+ *
+ * @return Status of get operation and value if successful.
+ * @retval EINVAL Key not present in map.
+ */
+android::base::Result<std::string> FakeAndroidPropertyManager::GetProperty(
+    const std::string& key) {
+  const auto it = property_map_.find(key);
+  if (it == property_map_.end()) {
+    return android::base::Error()
+           << "Property: " << key << " not found." << EINVAL;
+  }
+  return it->second;
+}
+
+}  // namespace pixel_modem
diff --git a/modem/android_property_manager/fake/include/fake_android_property_manager.h b/modem/android_property_manager/fake/include/fake_android_property_manager.h
new file mode 100644
index 0000000..eeea5a0
--- /dev/null
+++ b/modem/android_property_manager/fake/include/fake_android_property_manager.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <map>
+#include <string>
+
+#include "android-base/result.h"
+#include "android_property_manager.h"
+
+namespace pixel_modem {
+
+/**
+ * @brief Fake Implementation of AndroidPropertyManager that mocks some of the
+ * property changing behaviour from pixellogger's `modem_logging_control`.
+ */
+class FakeAndroidPropertyManager : public AndroidPropertyManager {
+ public:
+  bool GetBoolProperty(const std::string& key, bool default_value) override;
+
+  std::string GetProperty(const std::string& key,
+                          const std::string& default_value) override;
+
+  int GetIntProperty(const std::string& key, int default_value) override;
+
+  /**
+   * This function needs to copy the behaviour of `modem_logging_control` to
+   * ensure that the right properties are being set in order.
+   *
+   * More specifically, this function will also set the
+   * `kModemLoggingStatusProperty` whenever `kModemLoggingEnabledProperty` is
+   * set to simulate modem logging stopping / starting.
+   */
+  bool SetProperty(const std::string& key, const std::string& value) override;
+
+  inline bool ModemLoggingHasRestarted() {
+    return modem_logging_has_restarted_;
+  }
+
+ private:
+  /**
+   * @brief Gets android system property if present.
+   *
+   * @param[in] key Name of property.
+   *
+   * @return Status of get operation and value if successful.
+   * @retval EINVAL Key not present in map.
+   */
+  android::base::Result<std::string> GetProperty(const std::string& key);
+
+  std::map<std::string, std::string> property_map_;
+  bool modem_logging_has_been_off_ = false;
+  bool modem_logging_has_restarted_ = false;
+};
+
+}  // namespace pixel_modem
diff --git a/modem/android_property_manager/impl/Android.bp b/modem/android_property_manager/impl/Android.bp
new file mode 100644
index 0000000..2023e8f
--- /dev/null
+++ b/modem/android_property_manager/impl/Android.bp
@@ -0,0 +1,18 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+modem_android_property_manager_impl_public_deps = [
+    "modem_android_property_manager",
+]
+
+cc_library_shared {
+    name: "modem_android_property_manager_impl",
+    export_include_dirs: [ "include" ],
+    srcs: [ "android_property_manager_impl.cpp" ],
+    shared_libs: modem_android_property_manager_impl_public_deps + [
+        "libbase",
+    ],
+    export_shared_lib_headers: modem_android_property_manager_impl_public_deps,
+    vendor_available: true,
+}
diff --git a/modem/android_property_manager/impl/android_property_manager_impl.cpp b/modem/android_property_manager/impl/android_property_manager_impl.cpp
new file mode 100644
index 0000000..b6b900a
--- /dev/null
+++ b/modem/android_property_manager/impl/android_property_manager_impl.cpp
@@ -0,0 +1,29 @@
+#include "android_property_manager_impl.h"
+
+#include <android-base/properties.h>
+
+#include <string>
+
+namespace pixel_modem {
+
+bool AndroidPropertyManagerImpl::GetBoolProperty(const std::string& key,
+                                                 bool default_value) {
+  return android::base::GetBoolProperty(key, default_value);
+}
+
+std::string AndroidPropertyManagerImpl::GetProperty(
+    const std::string& key, const std::string& default_value) {
+  return android::base::GetProperty(key, default_value);
+}
+
+int AndroidPropertyManagerImpl::GetIntProperty(const std::string& key,
+                                               int default_value) {
+  return android::base::GetIntProperty(key, default_value);
+}
+
+bool AndroidPropertyManagerImpl::SetProperty(const std::string& key,
+                                             const std::string& value) {
+  return android::base::SetProperty(key, value);
+}
+
+}  // namespace pixel_modem
diff --git a/modem/android_property_manager/impl/include/android_property_manager_impl.h b/modem/android_property_manager/impl/include/android_property_manager_impl.h
new file mode 100644
index 0000000..91cee25
--- /dev/null
+++ b/modem/android_property_manager/impl/include/android_property_manager_impl.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <string>
+
+#include "android_property_manager.h"
+
+namespace pixel_modem {
+
+/**
+ * @brief Implementation of AndroidPropertyManager that directly forwards to
+ * android base methods.
+ */
+class AndroidPropertyManagerImpl : public AndroidPropertyManager {
+ public:
+  bool GetBoolProperty(const std::string& key, bool default_value) override;
+
+  std::string GetProperty(const std::string& key,
+                          const std::string& default_value) override;
+
+  int GetIntProperty(const std::string& key, int default_value) override;
+
+  bool SetProperty(const std::string& key, const std::string& value) override;
+};
+
+}  // namespace pixel_modem
diff --git a/modem/android_property_manager/include/android_property_manager.h b/modem/android_property_manager/include/android_property_manager.h
new file mode 100644
index 0000000..e41a28d
--- /dev/null
+++ b/modem/android_property_manager/include/android_property_manager.h
@@ -0,0 +1,27 @@
+
+#pragma once
+
+#include <string>
+#include <string_view>
+
+namespace pixel_modem {
+
+// Used to set boolean parameters to true / false
+inline constexpr std::string_view kTruthString = "true";
+inline constexpr std::string_view kFalseString = "false";
+
+/**
+ * @brief Interface for interacting with Android System Properties.
+ */
+class AndroidPropertyManager {
+ public:
+  virtual ~AndroidPropertyManager() = default;
+  virtual bool GetBoolProperty(const std::string& key, bool default_value) = 0;
+  virtual std::string GetProperty(const std::string& key,
+                                  const std::string& default_value) = 0;
+  virtual int GetIntProperty(const std::string& key, int default_value) = 0;
+  virtual bool SetProperty(const std::string& key,
+                           const std::string& value) = 0;
+};
+
+}  // namespace pixel_modem
diff --git a/modem/clock_manager/Android.bp b/modem/clock_manager/Android.bp
new file mode 100644
index 0000000..98aff6f
--- /dev/null
+++ b/modem/clock_manager/Android.bp
@@ -0,0 +1,9 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_library {
+    name: "modem_clock_manager",
+    export_include_dirs: [ "include" ],
+    vendor_available: true,
+}
diff --git a/modem/clock_manager/fake/Android.bp b/modem/clock_manager/fake/Android.bp
new file mode 100644
index 0000000..eb16445
--- /dev/null
+++ b/modem/clock_manager/fake/Android.bp
@@ -0,0 +1,15 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_defaults {
+    name: "fake_modem_clock_manager_defaults",
+    shared_libs: [ "modem_clock_manager" ],
+}
+
+cc_library_static {
+    name: "fake_modem_clock_manager",
+    export_include_dirs: [ "include" ],
+    defaults: [ "fake_modem_clock_manager_defaults" ],
+    vendor_available: true,
+}
diff --git a/modem/clock_manager/fake/include/fake_clock_manager.h b/modem/clock_manager/fake/include/fake_clock_manager.h
new file mode 100644
index 0000000..8956777
--- /dev/null
+++ b/modem/clock_manager/fake/include/fake_clock_manager.h
@@ -0,0 +1,21 @@
+#include "clock_manager.h"
+
+namespace pixel_modem {
+
+/**
+ * @brief Fake implementation of clock manager that doesn't actually sleep.
+ *
+ * A lot of vendor code don't have return values and instead force the client
+ * codes to sleep for a specified period of time before checking some system
+ * properties. However, since unit tests don't rely on the real vendor
+ * implementations, these sleeps should be ignored and so a fake clock should be
+ * used.
+ *
+ * Since this definition is unlikely to change, it will be defined in the header
+ * and not an implementation file.
+ */
+struct FakeClockManager : public ClockManager {
+  void Sleep(size_t /*seconds*/) const override{};
+};
+
+}  // namespace pixel_modem
diff --git a/modem/clock_manager/impl/Android.bp b/modem/clock_manager/impl/Android.bp
new file mode 100644
index 0000000..13f4cc6
--- /dev/null
+++ b/modem/clock_manager/impl/Android.bp
@@ -0,0 +1,16 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+modem_clock_manager_impl_public_deps = [
+    "modem_clock_manager",
+]
+
+cc_library {
+    name: "modem_clock_manager_impl",
+    export_include_dirs: [ "include" ],
+    srcs: [ "clock_manager_impl.cpp" ],
+    shared_libs: modem_clock_manager_impl_public_deps,
+    export_shared_lib_headers: modem_clock_manager_impl_public_deps,
+    vendor_available: true,
+}
diff --git a/modem/clock_manager/impl/clock_manager_impl.cpp b/modem/clock_manager/impl/clock_manager_impl.cpp
new file mode 100644
index 0000000..dc61a63
--- /dev/null
+++ b/modem/clock_manager/impl/clock_manager_impl.cpp
@@ -0,0 +1,9 @@
+#include "clock_manager_impl.h"
+
+#include <unistd.h>
+
+namespace pixel_modem {
+
+void ClockManagerImpl::Sleep(size_t seconds) const { sleep(seconds); }
+
+}  // namespace pixel_modem
diff --git a/modem/clock_manager/impl/include/clock_manager_impl.h b/modem/clock_manager/impl/include/clock_manager_impl.h
new file mode 100644
index 0000000..d626b98
--- /dev/null
+++ b/modem/clock_manager/impl/include/clock_manager_impl.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <cstddef>
+
+#include "clock_manager.h"
+
+namespace pixel_modem {
+
+struct ClockManagerImpl : public ClockManager {
+  void Sleep(size_t seconds) const override;
+};
+
+}  // namespace pixel_modem
diff --git a/modem/clock_manager/include/clock_manager.h b/modem/clock_manager/include/clock_manager.h
new file mode 100644
index 0000000..1db88c5
--- /dev/null
+++ b/modem/clock_manager/include/clock_manager.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <cstddef>
+
+namespace pixel_modem {
+
+/**
+ * @brief Interface for time based operations.
+ *
+ * This interface was intentionally not called `Clock`, like the Java side
+ * counterpart since it's likely that clients would call the local variable
+ * `clock(_)`, which would clash with the C defined `clock` method.
+ */
+struct ClockManager {
+  virtual ~ClockManager() = default;
+
+  /**
+   * @brief Sleep the thread for a given number of seconds.
+   *
+   * @param seconds Minimum number of seconds to sleep for. Note, this is
+   * different than the Java android clock which accepts seconds. This was done
+   * because C++ developers are likely more familiar with the `sleep` command,
+   * which accepts seconds.
+   */
+  virtual void Sleep(size_t seconds) const = 0;
+};
+
+}  // namespace pixel_modem
diff --git a/modem/dump_modemlog.cpp b/modem/dump_modemlog.cpp
deleted file mode 100644
index 1b6b2e9..0000000
--- a/modem/dump_modemlog.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2022 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 <android-base/properties.h>
-#include <dump/pixel_dump.h>
-
-#include "dumper.h"
-#include "modem_log_dumper.h"
-
-namespace modem {
-namespace logging {
-
-/**
- * @brief Implementation of AndroidPropertyManager that directly forwards to
- * android base methods.
- */
-class AndroidPropertyManagerImpl : public AndroidPropertyManager {
- public:
-  bool GetBoolProperty(const std::string& key, bool default_value) override {
-    return android::base::GetBoolProperty(key, default_value);
-  };
-
-  std::string GetProperty(const std::string& key,
-                          const std::string& default_value) override {
-    return android::base::GetProperty(key, default_value);
-  };
-  int GetIntProperty(const std::string& key, int default_value) override {
-    return android::base::GetIntProperty(key, default_value);
-  };
-  void SetProperty(const std::string& key, const std::string& value) override {
-    android::base::SetProperty(key, value);
-  };
-};
-
-/**
- * @brief Implementation of Dumper that directly forwards to their corresponding
- * dumpstate methods.
- */
-class DumperImpl : public Dumper {
- public:
-  void DumpLogs(const LogDumpInfo& log_dump_info) override {
-    dumpLogs(log_dump_info.src_dir.data(), log_dump_info.dest_dir.data(),
-             log_dump_info.limit, log_dump_info.prefix.data());
-  }
-  void CopyFile(const FileCopyInfo& file_copy_info) override {
-    copyFile(file_copy_info.src_dir.data(), file_copy_info.dest_dir.data());
-  }
-};
-
-}  // namespace logging
-}  // namespace modem
-
-int main() {
-  modem::logging::DumperImpl dumper_impl;
-  modem::logging::AndroidPropertyManagerImpl android_property_manager_impl;
-  modem::logging::ModemLogDumper modem_log_dumper(
-      dumper_impl, android_property_manager_impl);
-
-  modem_log_dumper.DumpModemLogs();
-  return 0;
-}
diff --git a/modem/dump_modemlog/Android.bp b/modem/dump_modemlog/Android.bp
new file mode 100644
index 0000000..aca7b20
--- /dev/null
+++ b/modem/dump_modemlog/Android.bp
@@ -0,0 +1,79 @@
+package {
+    default_applicable_licenses: [ "Android-Apache-2.0" ],
+}
+
+sh_binary {
+    name: "dump_modem.sh",
+    src: "dump_modem.sh",
+    vendor: true,
+    sub_dir: "dump",
+}
+
+// Modem Log Dumper
+
+modem_log_dumper_public_deps = [
+    "modem_android_property_manager",
+]
+
+// When `modem_log_dumper` is included statically, its dependencies are not
+// transitively included, so the target will also have to include this default
+// to restate them.
+cc_defaults {
+    name: "modem_log_dumper_defaults",
+    shared_libs: modem_log_dumper_public_deps + [
+        "libbase",
+        // liblog is not directly used by us, but it's a transitive dependency of libbase
+        "liblog",
+        "modem_log_constants",
+    ],
+}
+
+cc_library {
+    name: "modem_log_dumper",
+    srcs: [ "modem_log_dumper.cpp" ],
+    defaults: [ "modem_log_dumper_defaults" ],
+    export_shared_lib_headers: modem_log_dumper_public_deps,
+    export_include_dirs: [ "include" ],
+    vendor_available: true,
+}
+
+// dump_modemlog
+
+cc_binary {
+    name: "dump_modemlog",
+    srcs: [ "dump_modemlog.cpp" ],
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+    shared_libs: [
+        "libbase",
+        "libdump",
+        "liblog",
+        "modem_android_property_manager_impl",
+        "modem_log_dumper",
+    ],
+    vendor: true,
+    relative_install_path: "dump",
+}
+
+cc_test {
+    name: "dump_modemlog_test",
+    srcs: [ "modem_log_dumper_test.cpp" ],
+    defaults: [
+        "modem_log_dumper_defaults",
+        "modem_android_property_manager_fake_defaults",
+    ],
+    static_libs: [
+        "modem_android_property_manager",
+        "modem_android_property_manager_fake",
+        "modem_log_constants",
+        "modem_log_dumper",
+        "libgmock",
+    ],
+    vendor: true,
+    // Shared libs in vendor folder are guarded by SEPolicy, so tests need root
+    // access to run them.
+    require_root: true,
+}
diff --git a/modem/dump_modem.sh b/modem/dump_modemlog/dump_modem.sh
similarity index 100%
rename from modem/dump_modem.sh
rename to modem/dump_modemlog/dump_modem.sh
diff --git a/modem/dump_modemlog/dump_modemlog.cpp b/modem/dump_modemlog/dump_modemlog.cpp
new file mode 100644
index 0000000..bed936c
--- /dev/null
+++ b/modem/dump_modemlog/dump_modemlog.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 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 <android-base/properties.h>
+#include <dump/pixel_dump.h>
+
+#include "android_property_manager_impl.h"
+#include "dumper.h"
+#include "modem_log_dumper.h"
+
+namespace pixel_modem::logging {
+
+/**
+ * @brief Implementation of Dumper that directly forwards to their corresponding
+ * dumpstate methods.
+ */
+class DumperImpl : public Dumper {
+ public:
+  void DumpLogs(const LogDumpInfo& log_dump_info) override {
+    dumpLogs(log_dump_info.src_dir.data(), log_dump_info.dest_dir.data(),
+             log_dump_info.limit, log_dump_info.prefix.data());
+  }
+  void CopyFile(const FileCopyInfo& file_copy_info) override {
+    copyFile(file_copy_info.src_dir.data(), file_copy_info.dest_dir.data());
+  }
+};
+
+}  // namespace pixel_modem::logging
+
+int main() {
+  pixel_modem::logging::DumperImpl dumper_impl;
+  pixel_modem::AndroidPropertyManagerImpl android_property_manager_impl;
+  pixel_modem::logging::ModemLogDumper modem_log_dumper(
+      dumper_impl, android_property_manager_impl);
+
+  modem_log_dumper.DumpModemLogs();
+  return 0;
+}
diff --git a/modem/dump_modemlog/dump_modemlog.mk b/modem/dump_modemlog/dump_modemlog.mk
new file mode 100644
index 0000000..5e91ab7
--- /dev/null
+++ b/modem/dump_modemlog/dump_modemlog.mk
@@ -0,0 +1,5 @@
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/modem/dump_modemlog/sepolicy
+
+PRODUCT_PACKAGES += dump_modem.sh
+PRODUCT_PACKAGES += dump_modemlog
+
diff --git a/modem/dump_modemlog/include/bugreport_constants.h b/modem/dump_modemlog/include/bugreport_constants.h
new file mode 100644
index 0000000..25c800f
--- /dev/null
+++ b/modem/dump_modemlog/include/bugreport_constants.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <string_view>
+
+#include "dumper.h"
+
+namespace pixel_modem::logging {
+
+inline constexpr std::string_view kBugreportPackingDirectory =
+    "/data/vendor/radio/logs/always-on/all_logs";
+
+inline constexpr LogDumpInfo kLogDumpInfo[] = {
+    {.src_dir = "/data/vendor/radio/extended_logs",
+     .dest_dir = kBugreportPackingDirectory,
+     .limit = 20,
+     .prefix = "extended_log_"},
+    {.src_dir = "/data/vendor/radio/sim/",
+     .dest_dir = kBugreportPackingDirectory,
+     .limit = 1,
+     .prefix = "sim_poweron_log_"},
+    {.src_dir = "data/vendor/radio/logs/history",
+     .dest_dir = kBugreportPackingDirectory,
+     .limit = 2,
+     .prefix = "Logging"}};
+
+constexpr FileCopyInfo kFileCopyInfo[] = {
+    {.src_dir = "/mnt/vendor/efs/nv_normal.bin",
+     .dest_dir = "/data/vendor/radio/logs/always-on/all_logs/nv_normal.bin"},
+    {.src_dir = "/mnt/vendor/efs/nv_protected.bin",
+     .dest_dir =
+         "/data/vendor/radio/logs/always-on/all_logs/nv_protected.bin"}};
+
+}  // namespace pixel_modem::logging
diff --git a/modem/include/dumper.h b/modem/dump_modemlog/include/dumper.h
similarity index 95%
rename from modem/include/dumper.h
rename to modem/dump_modemlog/include/dumper.h
index 348e666..a9b96c6 100644
--- a/modem/include/dumper.h
+++ b/modem/dump_modemlog/include/dumper.h
@@ -3,8 +3,7 @@
 #include <ostream>
 #include <string_view>
 
-namespace modem {
-namespace logging {
+namespace pixel_modem::logging {
 
 /**
  * @brief Data object for information about dumpings logs.
@@ -67,5 +66,5 @@
   virtual void DumpLogs(const LogDumpInfo& log_dump_info);
   virtual void CopyFile(const FileCopyInfo& file_copy_info);
 };
-}  // namespace logging
-}  // namespace modem
+
+}  // namespace pixel_modem::logging
diff --git a/modem/include/modem_log_dumper.h b/modem/dump_modemlog/include/modem_log_dumper.h
similarity index 96%
rename from modem/include/modem_log_dumper.h
rename to modem/dump_modemlog/include/modem_log_dumper.h
index 96911b0..1533217 100644
--- a/modem/include/modem_log_dumper.h
+++ b/modem/dump_modemlog/include/modem_log_dumper.h
@@ -3,8 +3,7 @@
 #include "android_property_manager.h"
 #include "dumper.h"
 
-namespace modem {
-namespace logging {
+namespace pixel_modem::logging {
 
 /**
  * @brief Responsible for dumping all relevant modem logs.
@@ -77,5 +76,4 @@
   AndroidPropertyManager& android_property_manager_;
 };
 
-}  // namespace logging
-}  // namespace modem
+}  // namespace pixel_modem::logging
diff --git a/modem/modem_log_dumper.cpp b/modem/dump_modemlog/modem_log_dumper.cpp
similarity index 85%
rename from modem/modem_log_dumper.cpp
rename to modem/dump_modemlog/modem_log_dumper.cpp
index fad8d29..127478e 100644
--- a/modem/modem_log_dumper.cpp
+++ b/modem/dump_modemlog/modem_log_dumper.cpp
@@ -2,11 +2,11 @@
 
 #include <log/log.h>
 
+#include "bugreport_constants.h"
 #include "dumper.h"
 #include "modem_log_constants.h"
 
-namespace modem {
-namespace logging {
+namespace pixel_modem::logging {
 
 void ModemLogDumper::DumpModemLogs() {
   bool shouldRestartModemLogging =
@@ -15,7 +15,11 @@
       kModemLoggingNumberBugreportProperty.data(),
       kDefaultBugreportNumberFiles);
 
-  if (shouldRestartModemLogging) {
+  // Should always trigger `stopModemLogging`. This is because currently copying
+  // modem logs and stopping modem logging are entangled.
+  // TODO: b/289435256 - Always copy logs and return this to checking if logging
+  // is actively running.
+  if (allowedToStopModemLogging()) {
     // If modem logging is running at time of bugreport, it needs to be stopped
     // to ensure that the most recent logs are included in the bugreport. If
     // this command fails, only older log files will be included, as seen in
@@ -76,5 +80,5 @@
   android_property_manager_.SetProperty(kModemLoggingEnabledProperty.data(),
                                         "true");
 }
-}  // namespace logging
-}  // namespace modem
+
+}  // namespace pixel_modem::logging
diff --git a/modem/test/modem_log_dumper_test.cpp b/modem/dump_modemlog/modem_log_dumper_test.cpp
similarity index 90%
rename from modem/test/modem_log_dumper_test.cpp
rename to modem/dump_modemlog/modem_log_dumper_test.cpp
index a052d43..81bec8b 100644
--- a/modem/test/modem_log_dumper_test.cpp
+++ b/modem/dump_modemlog/modem_log_dumper_test.cpp
@@ -2,13 +2,15 @@
 
 #include <string_view>
 
+#include "android_property_manager.h"
+#include "bugreport_constants.h"
 #include "dumper.h"
 #include "fake_android_property_manager.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include "modem_log_constants.h"
 
-namespace modem {
-namespace logging {
+namespace pixel_modem::logging {
 namespace {
 
 using ::testing::Eq;
@@ -23,9 +25,8 @@
 
 void StartModemLogging(
     FakeAndroidPropertyManager& fake_android_property_manager) {
-  fake_android_property_manager.SetProperty(
-      kModemLoggingEnabledProperty.data(),
-      FakeAndroidPropertyManager::kTruthString.data());
+  fake_android_property_manager.SetProperty(kModemLoggingEnabledProperty.data(),
+                                            kTruthString.data());
 }
 
 class MockDumper : public Dumper {
@@ -101,6 +102,6 @@
 
   EXPECT_FALSE(fake_android_property_manager.ModemLoggingHasRestarted());
 }
+
 }  // namespace
-}  // namespace logging
-}  // namespace modem
+}  // namespace pixel_modem::logging
diff --git a/modem/sepolicy/dump_modem.te b/modem/dump_modemlog/sepolicy/dump_modem.te
similarity index 100%
rename from modem/sepolicy/dump_modem.te
rename to modem/dump_modemlog/sepolicy/dump_modem.te
diff --git a/modem/sepolicy/dump_modemlog.te b/modem/dump_modemlog/sepolicy/dump_modemlog.te
similarity index 100%
rename from modem/sepolicy/dump_modemlog.te
rename to modem/dump_modemlog/sepolicy/dump_modemlog.te
diff --git a/modem/sepolicy/file.te b/modem/dump_modemlog/sepolicy/file.te
similarity index 100%
rename from modem/sepolicy/file.te
rename to modem/dump_modemlog/sepolicy/file.te
diff --git a/modem/sepolicy/file_contexts b/modem/dump_modemlog/sepolicy/file_contexts
similarity index 100%
rename from modem/sepolicy/file_contexts
rename to modem/dump_modemlog/sepolicy/file_contexts
diff --git a/modem/sepolicy/genfs_contexts b/modem/dump_modemlog/sepolicy/genfs_contexts
similarity index 100%
rename from modem/sepolicy/genfs_contexts
rename to modem/dump_modemlog/sepolicy/genfs_contexts
diff --git a/modem/include/android_property_manager.h b/modem/include/android_property_manager.h
deleted file mode 100644
index 7135d66..0000000
--- a/modem/include/android_property_manager.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-
-#include <string>
-
-namespace modem {
-namespace logging {
-
-/**
- * @brief Interface for interacting with Android System Properties.
- */
-class AndroidPropertyManager {
- public:
-  virtual ~AndroidPropertyManager() = default;
-  virtual bool GetBoolProperty(const std::string& key, bool default_value);
-  virtual std::string GetProperty(const std::string& key,
-                                  const std::string& default_value);
-  virtual int GetIntProperty(const std::string& key, int default_value);
-  virtual void SetProperty(const std::string& key, const std::string& value);
-};
-}  // namespace logging
-}  // namespace modem
diff --git a/modem/include/modem_log_constants.h b/modem/include/modem_log_constants.h
deleted file mode 100644
index 29a0fa8..0000000
--- a/modem/include/modem_log_constants.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#pragma once
-#include <string>
-
-#include "dumper.h"
-
-namespace modem {
-namespace logging {
-
-// Modem related Android System Properties
-
-// Controls triggering `modem_logging_start` and `modem_logging_stop`.
-inline constexpr static std::string_view kModemLoggingEnabledProperty =
-    "vendor.sys.modem.logging.enable";
-// Signals the current modem logging state. This will be set to
-// `vendor.sys.modem.logging.enable` when `modem_log_start` or `modem_log_stop`
-// terminates.
-inline constexpr static std::string_view kModemLoggingStatusProperty =
-    "vendor.sys.modem.logging.status";
-// Int which specifies how many files to include in the bugreport.
-inline constexpr static std::string_view kModemLoggingNumberBugreportProperty =
-    "persist.vendor.sys.modem.logging.br_num";
-// Signals the current location that is being logged to. This can be used to
-// determine the logging type.
-inline constexpr static std::string_view kModemLoggingPathProperty =
-    "vendor.sys.modem.logging.log_path";
-
-// Bugreport constants
-inline constexpr static int kDefaultBugreportNumberFiles = 100;
-inline constexpr static std::string_view kModemAlwaysOnLogDirectory =
-    "/data/vendor/radio/logs/always-on";
-inline constexpr static std::string_view kModemLogPrefix = "sbuff_";
-inline constexpr static std::string_view kBugreportPackingDirectory =
-    "/data/vendor/radio/logs/always-on/all_logs";
-
-inline constexpr static LogDumpInfo kLogDumpInfo[] = {
-    {.src_dir = "/data/vendor/radio/extended_logs",
-     .dest_dir = kBugreportPackingDirectory,
-     .limit = 20,
-     .prefix = "extended_log_"},
-    {.src_dir = "/data/vendor/radio/sim/",
-     .dest_dir = kBugreportPackingDirectory,
-     .limit = 1,
-     .prefix = "sim_poweron_log_"},
-    {.src_dir = "data/vendor/radio/logs/history",
-     .dest_dir = kBugreportPackingDirectory,
-     .limit = 2,
-     .prefix = "Logging"}};
-
-constexpr static FileCopyInfo kFileCopyInfo[] = {
-    {.src_dir = "/mnt/vendor/efs/nv_normal.bin",
-     .dest_dir = "/data/vendor/radio/logs/always-on/all_logs/nv_normal.bin"},
-    {.src_dir = "/mnt/vendor/efs/nv_protected.bin",
-     .dest_dir =
-         "/data/vendor/radio/logs/always-on/all_logs/nv_protected.bin"}};
-}  // namespace logging
-}  // namespace modem
diff --git a/modem/modem.mk b/modem/modem.mk
index 10df7d4..d921e74 100644
--- a/modem/modem.mk
+++ b/modem/modem.mk
@@ -1,5 +1 @@
-BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/modem/sepolicy
-
-PRODUCT_PACKAGES += dump_modem.sh
-PRODUCT_PACKAGES += dump_modemlog
-
+include device/google/gs-common/modem/dump_modemlog/dump_modemlog.mk
diff --git a/modem/modem_log_constants/Android.bp b/modem/modem_log_constants/Android.bp
new file mode 100644
index 0000000..f4e3177
--- /dev/null
+++ b/modem/modem_log_constants/Android.bp
@@ -0,0 +1,9 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_library {
+    name: "modem_log_constants",
+    export_include_dirs: [ "include" ],
+    vendor_available: true,
+}
diff --git a/modem/modem_log_constants/include/modem_log_constants.h b/modem/modem_log_constants/include/modem_log_constants.h
new file mode 100644
index 0000000..68004cf
--- /dev/null
+++ b/modem/modem_log_constants/include/modem_log_constants.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <string_view>
+
+namespace pixel_modem::logging {
+
+// Modem related Android System Properties
+
+// Controls triggering `modem_logging_start` and `modem_logging_stop`.
+inline constexpr std::string_view kModemLoggingEnabledProperty =
+    "vendor.sys.modem.logging.enable";
+// Signals the current modem logging state. This will be set to
+// `vendor.sys.modem.logging.enable` when `modem_log_start` or `modem_log_stop`
+// terminates.
+inline constexpr std::string_view kModemLoggingStatusProperty =
+    "vendor.sys.modem.logging.status";
+// Int which specifies how many files to include in the bugreport.
+inline constexpr std::string_view kModemLoggingNumberBugreportProperty =
+    "persist.vendor.sys.modem.logging.br_num";
+// Signals the current location that is being logged to. This can be used to
+// determine the logging type.
+inline constexpr std::string_view kModemLoggingPathProperty =
+    "vendor.sys.modem.logging.log_path";
+inline constexpr std::string_view kModemLoggingLogCountProperty =
+    "vendor.sys.modem.logging.log_count";
+inline constexpr std::string_view kModemLoggingLogPath =
+    "vendor.sys.modem.logging.log_path";
+
+// Bugreport constants
+inline constexpr int kDefaultBugreportNumberFiles = 100;
+inline constexpr std::string_view kModemAlwaysOnLogDirectory =
+    "/data/vendor/radio/logs/always-on";
+inline constexpr std::string_view kModemLogPrefix = "sbuff_";
+
+}  // namespace pixel_modem::logging
diff --git a/modem/test/include/fake_android_property_manager.h b/modem/test/include/fake_android_property_manager.h
deleted file mode 100644
index 79fd4f1..0000000
--- a/modem/test/include/fake_android_property_manager.h
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-#include <map>
-#include <string>
-#include <string_view>
-
-#include "android_property_manager.h"
-#include "modem_log_constants.h"
-
-namespace modem {
-namespace logging {
-
-/**
- * @brief Fake Implementation of AndroidPropertyManager that mocks some of the
- * property changing behaviour from pixellogger's `modem_logging_control`.
- */
-class FakeAndroidPropertyManager : public AndroidPropertyManager {
- public:
-  inline constexpr static std::string_view kTruthString = "true";
-  inline constexpr static std::string_view kFalseString = "false";
-
-  bool GetBoolProperty(const std::string& key, bool default_value) override {
-    return MapContainsKey(key)
-               ? GetPropertyInternal(key) == kTruthString
-               : default_value;
-  };
-
-  std::string GetProperty(const std::string& key,
-                          const std::string& default_value) override {
-    return MapContainsKey(key) ? GetPropertyInternal(key) : default_value;
-    ;
-  };
-
-  int GetIntProperty(const std::string& key, int default_value) override {
-    return MapContainsKey(key) ? std::stoi(GetPropertyInternal(key))
-                               : default_value;
-  };
-
-  /**
-   * This function needs to copy the behaviour of `modem_logging_control` to
-   * ensure that the right properties are being set in order.
-   *
-   * More specifically, this function will also set the
-   * `kModemLoggingStatusProperty` whenever `kModemLoggingEnabledProperty` is
-   * set to simulate modem logging stopping / starting.
-   */
-  void SetProperty(const std::string& key, const std::string& value) override {
-    if (key == kModemLoggingEnabledProperty) {
-      property_map_[kModemLoggingStatusProperty.data()] = value;
-
-      // need to track if modem logging has restarted or not
-      if (value == kFalseString) {
-        modem_logging_has_been_off_ = true;
-      }
-      if (modem_logging_has_been_off_ && (value == kTruthString)) {
-        modem_logging_has_restarted_ = true;
-      }
-    }
-    property_map_[key] = value;
-  };
-
-  bool ModemLoggingHasRestarted() { return modem_logging_has_restarted_; }
-
- private:
-  bool MapContainsKey(const std::string& key) {
-    return property_map_.find(key) != property_map_.end();
-  }
-  std::string GetPropertyInternal(const std::string& key) {
-    return property_map_.find(key)->second;
-  }
-
-  std::map<std::string, std::string> property_map_;
-  bool modem_logging_has_been_off_ = false;
-  bool modem_logging_has_restarted_ = false;
-};
-}  // namespace logging
-}  // namespace modem