Merge "Use android::base::Result in libnativeloader"
diff --git a/fs_mgr/liblp/builder.cpp b/fs_mgr/liblp/builder.cpp
index 25a042f..c12e3b2 100644
--- a/fs_mgr/liblp/builder.cpp
+++ b/fs_mgr/liblp/builder.cpp
@@ -30,8 +30,8 @@
 namespace android {
 namespace fs_mgr {
 
-bool MetadataBuilder::sABOverrideSet;
-bool MetadataBuilder::sABOverrideValue;
+std::optional<bool> MetadataBuilder::sABOverride;
+std::optional<bool> MetadataBuilder::sRetrofitDap;
 
 static const std::string kDefaultGroup = "default";
 
@@ -169,7 +169,8 @@
     // needed. On the other hand, for retrofit devices, we'll need to
     // translate block device and group names to update their slot suffixes.
     auto super_device = GetMetadataSuperBlockDevice(*metadata.get());
-    if (GetBlockDevicePartitionName(*super_device) == "super") {
+    if (GetBlockDevicePartitionName(*super_device) == "super" ||
+        !IsRetrofitDynamicPartitionsDevice()) {
         return New(*metadata.get(), &opener);
     }
 
@@ -210,8 +211,11 @@
 }
 
 void MetadataBuilder::OverrideABForTesting(bool ab_device) {
-    sABOverrideSet = true;
-    sABOverrideValue = ab_device;
+    sABOverride = ab_device;
+}
+
+void MetadataBuilder::OverrideRetrofitDynamicParititonsForTesting(bool retrofit) {
+    sRetrofitDap = retrofit;
 }
 
 MetadataBuilder::MetadataBuilder() : auto_slot_suffixing_(false) {
@@ -580,7 +584,8 @@
     CHECK_NE(sectors_per_block, 0);
     CHECK(sectors_needed % sectors_per_block == 0);
 
-    if (IsABDevice() && !IsRetrofitDevice() && GetPartitionSlotSuffix(partition->name()) == "_b") {
+    if (IsABDevice() && !IsRetrofitMetadata() &&
+        GetPartitionSlotSuffix(partition->name()) == "_b") {
         // Allocate "a" partitions top-down and "b" partitions bottom-up, to
         // minimize fragmentation during OTA.
         free_regions = PrioritizeSecondHalfOfSuper(free_regions);
@@ -1044,14 +1049,21 @@
     auto_slot_suffixing_ = true;
 }
 
-bool MetadataBuilder::IsABDevice() const {
-    if (sABOverrideSet) {
-        return sABOverrideValue;
+bool MetadataBuilder::IsABDevice() {
+    if (sABOverride.has_value()) {
+        return *sABOverride;
     }
     return !android::base::GetProperty("ro.boot.slot_suffix", "").empty();
 }
 
-bool MetadataBuilder::IsRetrofitDevice() const {
+bool MetadataBuilder::IsRetrofitDynamicPartitionsDevice() {
+    if (sRetrofitDap.has_value()) {
+        return *sRetrofitDap;
+    }
+    return !android::base::GetBoolProperty("ro.boot.dynamic_partitions_retrofit", false);
+}
+
+bool MetadataBuilder::IsRetrofitMetadata() const {
     return GetBlockDevicePartitionName(block_devices_[0]) != LP_METADATA_DEFAULT_PARTITION_NAME;
 }
 
diff --git a/fs_mgr/liblp/builder_test.cpp b/fs_mgr/liblp/builder_test.cpp
index fd16e90..377ec68 100644
--- a/fs_mgr/liblp/builder_test.cpp
+++ b/fs_mgr/liblp/builder_test.cpp
@@ -27,7 +27,10 @@
 
 class Environment : public ::testing::Environment {
   public:
-    void SetUp() override { MetadataBuilder::OverrideABForTesting(false); }
+    void SetUp() override {
+        MetadataBuilder::OverrideABForTesting(false);
+        MetadataBuilder::OverrideRetrofitDynamicParititonsForTesting(false);
+    }
 };
 
 int main(int argc, char** argv) {
@@ -38,8 +41,14 @@
 
 class BuilderTest : public ::testing::Test {
   public:
-    void SetUp() override { MetadataBuilder::OverrideABForTesting(false); }
-    void TearDown() override { MetadataBuilder::OverrideABForTesting(false); }
+    void SetUp() override {
+        MetadataBuilder::OverrideABForTesting(false);
+        MetadataBuilder::OverrideRetrofitDynamicParititonsForTesting(false);
+    }
+    void TearDown() override {
+        MetadataBuilder::OverrideABForTesting(false);
+        MetadataBuilder::OverrideRetrofitDynamicParititonsForTesting(false);
+    }
 };
 
 TEST_F(BuilderTest, BuildBasic) {
diff --git a/fs_mgr/liblp/include/liblp/builder.h b/fs_mgr/liblp/include/liblp/builder.h
index e70c552..a2221ef 100644
--- a/fs_mgr/liblp/include/liblp/builder.h
+++ b/fs_mgr/liblp/include/liblp/builder.h
@@ -199,6 +199,9 @@
     // Used by the test harness to override whether the device is "A/B".
     static void OverrideABForTesting(bool ab_device);
 
+    // Used by the test harness to override whether the device is "retrofitting dynamic partitions".
+    static void OverrideRetrofitDynamicParititonsForTesting(bool retrofit);
+
     // Define a new partition group. By default there is one group called
     // "default", with an unrestricted size. A non-zero size will restrict the
     // total space used by all partitions in the group.
@@ -306,8 +309,16 @@
     void ImportExtents(Partition* dest, const LpMetadata& metadata,
                        const LpMetadataPartition& source);
     bool ImportPartition(const LpMetadata& metadata, const LpMetadataPartition& source);
-    bool IsABDevice() const;
-    bool IsRetrofitDevice() const;
+
+    // Return true if the device is an AB device.
+    static bool IsABDevice();
+
+    // Return true if the device is retrofitting dynamic partitions.
+    static bool IsRetrofitDynamicPartitionsDevice();
+
+    // Return true if "this" metadata represents a metadata on a retrofit device.
+    bool IsRetrofitMetadata() const;
+
     bool ValidatePartitionGroups() const;
 
     struct Interval {
@@ -336,8 +347,8 @@
                                                     const std::vector<Interval>& free_list,
                                                     uint64_t sectors_needed) const;
 
-    static bool sABOverrideValue;
-    static bool sABOverrideSet;
+    static std::optional<bool> sABOverride;
+    static std::optional<bool> sRetrofitDap;
 
     LpMetadataGeometry geometry_;
     LpMetadataHeader header_;
diff --git a/fs_mgr/liblp/io_test.cpp b/fs_mgr/liblp/io_test.cpp
index fcef1f0..70dd85f 100644
--- a/fs_mgr/liblp/io_test.cpp
+++ b/fs_mgr/liblp/io_test.cpp
@@ -664,6 +664,8 @@
 }
 
 TEST(liblp, UpdateRetrofit) {
+    MetadataBuilder::OverrideRetrofitDynamicParititonsForTesting(true);
+
     unique_ptr<MetadataBuilder> builder = CreateDefaultBuilder();
     ASSERT_NE(builder, nullptr);
     ASSERT_TRUE(AddDefaultPartitions(builder.get()));
@@ -693,6 +695,8 @@
 }
 
 TEST(liblp, UpdateNonRetrofit) {
+    MetadataBuilder::OverrideRetrofitDynamicParititonsForTesting(false);
+
     unique_fd fd = CreateFlashedDisk();
     ASSERT_GE(fd, 0);
 
diff --git a/healthd/Android.bp b/healthd/Android.bp
index 2cf6be9..53be526 100644
--- a/healthd/Android.bp
+++ b/healthd/Android.bp
@@ -110,3 +110,55 @@
         "libutils",
     ],
 }
+
+sysprop_library {
+    name: "charger_sysprop",
+    srcs: ["charger.sysprop"],
+    property_owner: "Platform",
+    api_packages: ["android.sysprop"],
+}
+
+cc_library_static {
+    name: "libhealthd_draw",
+    export_include_dirs: ["."],
+    static_libs: [
+        "libcharger_sysprop",
+        "libminui",
+    ],
+    shared_libs: [
+        "libbase",
+    ],
+    header_libs: ["libbatteryservice_headers"],
+
+    srcs: ["healthd_draw.cpp"],
+}
+
+cc_library_static {
+    name: "libhealthd_charger",
+    local_include_dirs: ["include"],
+    export_include_dirs: [".", "include"],
+
+    static_libs: [
+        "android.hardware.health@2.0-impl",
+        "android.hardware.health@1.0-convert",
+        "libcharger_sysprop",
+        "libhealthstoragedefault",
+        "libhealthd_draw",
+        "libminui",
+    ],
+
+    shared_libs: [
+        "android.hardware.health@2.0",
+        "libbase",
+        "libcutils",
+        "liblog",
+        "libpng",
+        "libsuspend",
+        "libutils",
+    ],
+
+    srcs: [
+        "healthd_mode_charger.cpp",
+        "AnimationParser.cpp",
+    ],
+}
diff --git a/healthd/Android.mk b/healthd/Android.mk
index d18f15a..b87f3c7 100644
--- a/healthd/Android.mk
+++ b/healthd/Android.mk
@@ -2,74 +2,6 @@
 
 LOCAL_PATH := $(call my-dir)
 
-### libhealthd_draw ###
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libhealthd_draw
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_STATIC_LIBRARIES := libminui
-LOCAL_SHARED_LIBRARIES := libbase
-LOCAL_SRC_FILES := healthd_draw.cpp
-
-ifneq ($(TARGET_HEALTHD_DRAW_SPLIT_SCREEN),)
-LOCAL_CFLAGS += -DHEALTHD_DRAW_SPLIT_SCREEN=$(TARGET_HEALTHD_DRAW_SPLIT_SCREEN)
-else
-LOCAL_CFLAGS += -DHEALTHD_DRAW_SPLIT_SCREEN=0
-endif
-
-ifneq ($(TARGET_HEALTHD_DRAW_SPLIT_OFFSET),)
-LOCAL_CFLAGS += -DHEALTHD_DRAW_SPLIT_OFFSET=$(TARGET_HEALTHD_DRAW_SPLIT_OFFSET)
-else
-LOCAL_CFLAGS += -DHEALTHD_DRAW_SPLIT_OFFSET=0
-endif
-
-LOCAL_HEADER_LIBRARIES := libbatteryservice_headers
-
-include $(BUILD_STATIC_LIBRARY)
-
-### libhealthd_charger ###
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS := -Werror
-ifeq ($(strip $(BOARD_CHARGER_DISABLE_INIT_BLANK)),true)
-LOCAL_CFLAGS += -DCHARGER_DISABLE_INIT_BLANK
-endif
-ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true)
-LOCAL_CFLAGS += -DCHARGER_ENABLE_SUSPEND
-endif
-
-LOCAL_SRC_FILES := \
-    healthd_mode_charger.cpp \
-    AnimationParser.cpp
-
-LOCAL_MODULE := libhealthd_charger
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(LOCAL_PATH) \
-    $(LOCAL_PATH)/include
-
-LOCAL_STATIC_LIBRARIES := \
-    android.hardware.health@2.0-impl \
-    android.hardware.health@1.0-convert \
-    libhealthstoragedefault \
-    libhealthd_draw \
-    libminui \
-
-LOCAL_SHARED_LIBRARIES := \
-    android.hardware.health@2.0 \
-    libbase \
-    libcutils \
-    liblog \
-    libpng \
-    libutils \
-
-ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true)
-LOCAL_SHARED_LIBRARIES += libsuspend
-endif
-
-include $(BUILD_STATIC_LIBRARY)
-
 ### charger ###
 include $(CLEAR_VARS)
 ifeq ($(strip $(BOARD_CHARGER_NO_UI)),true)
@@ -83,18 +15,17 @@
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
 
 LOCAL_CFLAGS := -Werror
-ifeq ($(strip $(LOCAL_CHARGER_NO_UI)),true)
-LOCAL_CFLAGS += -DCHARGER_NO_UI
-endif
 
 CHARGER_STATIC_LIBRARIES := \
     android.hardware.health@2.0-impl \
     android.hardware.health@1.0-convert \
     libbinderthreadstate \
+    libcharger_sysprop \
     libhidltransport \
     libhidlbase \
     libhwbinder_noltopgo \
     libhealthstoragedefault \
+    libminui \
     libvndksupport \
     libhealthd_charger \
     libhealthd_charger_nops \
@@ -106,18 +37,12 @@
     libbase \
     libcutils \
     libjsoncpp \
+    libpng \
     libprocessgroup \
     liblog \
     libutils \
 
-ifneq ($(strip $(LOCAL_CHARGER_NO_UI)),true)
-CHARGER_STATIC_LIBRARIES += libminui
-CHARGER_SHARED_LIBRARIES += libpng
-endif
-
-ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true)
 CHARGER_SHARED_LIBRARIES += libsuspend
-endif
 
 LOCAL_STATIC_LIBRARIES := $(CHARGER_STATIC_LIBRARIES)
 LOCAL_SHARED_LIBRARIES := $(CHARGER_SHARED_LIBRARIES)
@@ -141,8 +66,7 @@
 LOCAL_MODULE_STEM := charger
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
-LOCAL_CFLAGS := -Wall -Werror
-LOCAL_CFLAGS += -DCHARGER_NO_UI
+LOCAL_CFLAGS := -Wall -Werror -DCHARGER_FORCE_NO_UI=1
 
 # charger.recovery doesn't link against libhealthd_{charger,draw} or libminui, since it doesn't need
 # any UI support.
@@ -150,6 +74,7 @@
     android.hardware.health@2.0-impl \
     android.hardware.health@1.0-convert \
     libbinderthreadstate \
+    libcharger_sysprop \
     libhidltransport \
     libhidlbase \
     libhwbinder_noltopgo \
@@ -176,7 +101,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE := charger_test
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
-LOCAL_CFLAGS := -Wall -Werror -DCHARGER_NO_UI
+LOCAL_CFLAGS := -Wall -Werror
 LOCAL_STATIC_LIBRARIES := $(CHARGER_STATIC_LIBRARIES)
 LOCAL_SHARED_LIBRARIES := $(CHARGER_SHARED_LIBRARIES)
 LOCAL_SRC_FILES := \
diff --git a/healthd/AnimationParser.cpp b/healthd/AnimationParser.cpp
index 864038b..fde3b95 100644
--- a/healthd/AnimationParser.cpp
+++ b/healthd/AnimationParser.cpp
@@ -84,7 +84,6 @@
     static constexpr const char* fail_prefix = "fail: ";
     static constexpr const char* clock_prefix = "clock_display: ";
     static constexpr const char* percent_prefix = "percent_display: ";
-    static constexpr const char* frame_prefix = "frame: ";
 
     std::vector<animation::frame> frames;
 
diff --git a/healthd/api/current.txt b/healthd/api/current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/healthd/api/current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/healthd/api/removed.txt b/healthd/api/removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/healthd/api/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/healthd/api/system-current.txt b/healthd/api/system-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/healthd/api/system-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/healthd/api/system-removed.txt b/healthd/api/system-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/healthd/api/system-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/healthd/api/test-current.txt b/healthd/api/test-current.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/healthd/api/test-current.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/healthd/api/test-removed.txt b/healthd/api/test-removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/healthd/api/test-removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/healthd/charger.cpp b/healthd/charger.cpp
index 085cceb..58ed416 100644
--- a/healthd/charger.cpp
+++ b/healthd/charger.cpp
@@ -14,13 +14,18 @@
  * limitations under the License.
  */
 
+#include "charger.sysprop.h"
 #include "healthd_mode_charger.h"
 #include "healthd_mode_charger_nops.h"
 
-int main(int argc, char** argv) {
-#ifdef CHARGER_NO_UI
-    return healthd_charger_nops(argc, argv);
-#else
-    return healthd_charger_main(argc, argv);
+#ifndef CHARGER_FORCE_NO_UI
+#define CHARGER_FORCE_NO_UI 0
 #endif
+
+int main(int argc, char** argv) {
+    if (CHARGER_FORCE_NO_UI || android::sysprop::ChargerProperties::no_ui().value_or(false)) {
+        return healthd_charger_nops(argc, argv);
+    } else {
+        return healthd_charger_main(argc, argv);
+    }
 }
diff --git a/healthd/charger.sysprop b/healthd/charger.sysprop
new file mode 100644
index 0000000..b3f47a1
--- /dev/null
+++ b/healthd/charger.sysprop
@@ -0,0 +1,38 @@
+owner: Platform
+module: "android.sysprop.ChargerProperties"
+
+prop {
+    api_name: "draw_split_screen"
+    type: Boolean
+    prop_name: "ro.charger.draw_split_screen"
+    scope: Internal
+    access: Readonly
+}
+prop {
+    api_name: "draw_split_offset"
+    type: Long
+    prop_name: "ro.charger.draw_split_offset"
+    scope: Internal
+    access: Readonly
+}
+prop {
+    api_name: "disable_init_blank"
+    type: Boolean
+    prop_name: "ro.charger.disable_init_blank"
+    scope: Internal
+    access: Readonly
+}
+prop {
+    api_name: "enable_suspend"
+    type: Boolean
+    prop_name: "ro.charger.enable_suspend"
+    scope: Internal
+    access: Readonly
+}
+prop {
+    api_name: "no_ui"
+    type: Boolean
+    prop_name: "ro.charger.no_ui"
+    scope: Internal
+    access: Readonly
+}
diff --git a/healthd/healthd_draw.cpp b/healthd/healthd_draw.cpp
index 3da8bda..50eee19 100644
--- a/healthd/healthd_draw.cpp
+++ b/healthd/healthd_draw.cpp
@@ -18,15 +18,34 @@
 #include <batteryservice/BatteryService.h>
 #include <cutils/klog.h>
 
+#include "charger.sysprop.h"
 #include "healthd_draw.h"
 
 #define LOGE(x...) KLOG_ERROR("charger", x);
 #define LOGW(x...) KLOG_WARNING("charger", x);
 #define LOGV(x...) KLOG_DEBUG("charger", x);
 
+static bool get_split_screen() {
+    return android::sysprop::ChargerProperties::draw_split_screen().value_or(false);
+}
+
+static int get_split_offset() {
+    int64_t value = android::sysprop::ChargerProperties::draw_split_offset().value_or(0);
+    if (value < static_cast<int64_t>(std::numeric_limits<int>::min())) {
+        LOGW("draw_split_offset = %" PRId64 " overflow for an int; resetting to %d.\n", value,
+             std::numeric_limits<int>::min());
+        value = std::numeric_limits<int>::min();
+    }
+    if (value > static_cast<int64_t>(std::numeric_limits<int>::max())) {
+        LOGW("draw_split_offset = %" PRId64 " overflow for an int; resetting to %d.\n", value,
+             std::numeric_limits<int>::max());
+        value = std::numeric_limits<int>::max();
+    }
+    return static_cast<int>(value);
+}
+
 HealthdDraw::HealthdDraw(animation* anim)
-  : kSplitScreen(HEALTHD_DRAW_SPLIT_SCREEN),
-    kSplitOffset(HEALTHD_DRAW_SPLIT_OFFSET) {
+    : kSplitScreen(get_split_screen()), kSplitOffset(get_split_offset()) {
     int ret = gr_init();
 
     if (ret < 0) {
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index edf34f7..d676083 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -43,11 +43,10 @@
 #include <cutils/uevent.h>
 #include <sys/reboot.h>
 
-#ifdef CHARGER_ENABLE_SUSPEND
 #include <suspend/autosuspend.h>
-#endif
 
 #include "AnimationParser.h"
+#include "charger.sysprop.h"
 #include "healthd_draw.h"
 
 #include <health2/Health.h>
@@ -264,18 +263,16 @@
     LOGW("\n");
 }
 
-#ifdef CHARGER_ENABLE_SUSPEND
 static int request_suspend(bool enable) {
+    if (!android::sysprop::ChargerProperties::enable_suspend().value_or(false)) {
+        return 0;
+    }
+
     if (enable)
         return autosuspend_enable();
     else
         return autosuspend_disable();
 }
-#else
-static int request_suspend(bool /*enable*/) {
-    return 0;
-}
-#endif
 
 static void kick_animation(animation* anim) {
     anim->run = true;
@@ -321,10 +318,10 @@
 
         healthd_draw.reset(new HealthdDraw(batt_anim));
 
-#ifndef CHARGER_DISABLE_INIT_BLANK
-        healthd_draw->blank_screen(true);
-        charger->screen_blanked = true;
-#endif
+        if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) {
+            healthd_draw->blank_screen(true);
+            charger->screen_blanked = true;
+        }
     }
 
     /* animation is over, blank screen and leave */
diff --git a/libmeminfo/vts/AndroidTest.xml b/libmeminfo/vts/AndroidTest.xml
index 530d16e..9614025 100644
--- a/libmeminfo/vts/AndroidTest.xml
+++ b/libmeminfo/vts/AndroidTest.xml
@@ -24,6 +24,7 @@
         <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_meminfo_test/vts_meminfo_test" />
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_meminfo_test/vts_meminfo_test" />
         <option name="binary-test-type" value="gtest"/>
+        <option name="precondition-first-api-level" value="29" />
         <option name="test-timeout" value="10m"/>
     </test>
 </configuration>
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 614188b..b939eee 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -85,6 +85,7 @@
     {"runtime", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("runtime"))},
     {"sphal", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("sphal"))},
     {"vndk", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("vndk"))},
+    {"neuralnetworks", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("neuralnetworks"))},
 };
 
 // The actual gmock object
@@ -98,7 +99,7 @@
           if (namespaces.find(name) != namespaces.end()) {
             return namespaces[name];
           }
-          return nullptr;
+          return TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("(namespace not found"));
         }));
   }
 
@@ -339,11 +340,13 @@
   bool expected_link_with_sphal_ns = !vendor_public_libraries().empty();
   bool expected_link_with_vndk_ns = false;
   bool expected_link_with_default_ns = false;
+  bool expected_link_with_neuralnetworks_ns = true;
   std::string expected_shared_libs_to_platform_ns = default_public_libraries();
   std::string expected_shared_libs_to_runtime_ns = runtime_public_libraries();
   std::string expected_shared_libs_to_sphal_ns = vendor_public_libraries();
   std::string expected_shared_libs_to_vndk_ns = vndksp_libraries();
   std::string expected_shared_libs_to_default_ns = default_public_libraries();
+  std::string expected_shared_libs_to_neuralnetworks_ns = neuralnetworks_public_libraries();
 
   void SetExpectations() {
     NativeLoaderTest::SetExpectations();
@@ -394,6 +397,11 @@
                                               StrEq(expected_shared_libs_to_default_ns)))
           .WillOnce(Return(true));
     }
+    if (expected_link_with_neuralnetworks_ns) {
+      EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("neuralnetworks"),
+                                              StrEq(expected_shared_libs_to_neuralnetworks_ns)))
+          .WillOnce(Return(true));
+    }
   }
 
   void RunTest() {
diff --git a/logcat/logcatd.rc b/logcat/logcatd.rc
index 25104eb..26c9de3 100644
--- a/logcat/logcatd.rc
+++ b/logcat/logcatd.rc
@@ -13,28 +13,13 @@
     # expect /init to report failure if property empty (default)
     setprop persist.logd.logpersistd.size ${persist.logd.logpersistd.count}
 
-on property:persist.logd.logpersistd.size=256
-    setprop persist.logd.logpersistd.size ""
-    setprop logd.logpersistd.size ""
-
 on property:persist.logd.logpersistd.size=*
-    # expect /init to report failure if property empty (default)
     setprop logd.logpersistd.size ${persist.logd.logpersistd.size}
 
-on property:persist.logd.logpersistd.rotate_kbytes=1024
-    setprop persist.logd.logpersistd.rotate_kbytes ""
-    setprop logd.logpersistd.rotate_kbytes ""
-
 on property:persist.logd.logpersistd.rotate_kbytes=*
-   # expect /init to report failure if property empty (default)
-   setprop logd.logpersistd.rotate_kbytes ${persist.logd.logpersistd.rotate_kbytes}
-
-on property:persist.logd.logpersistd.buffer=all
-    setprop persist.logd.logpersistd.buffer ""
-    setprop logd.logpersistd.buffer ""
+    setprop logd.logpersistd.rotate_kbytes ${persist.logd.logpersistd.rotate_kbytes}
 
 on property:persist.logd.logpersistd.buffer=*
-    # expect /init to report failure if property empty (default)
     setprop logd.logpersistd.buffer ${persist.logd.logpersistd.buffer}
 
 on property:persist.logd.logpersistd=logcatd
diff --git a/shell_and_utilities/Android.bp b/shell_and_utilities/Android.bp
index bac3dc3..694b50e 100644
--- a/shell_and_utilities/Android.bp
+++ b/shell_and_utilities/Android.bp
@@ -13,6 +13,7 @@
         "auditctl",
         "awk",
         "bzip2",
+        "ldd",
         "logwrapper",
         "mini-keyctl",
         "mkshrc",