Loading cmds/installd/otapreopt.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -308,7 +308,7 @@ private: // This is different from the normal installd. We only do the base // directory, the rest will be created on demand when each app is compiled. if (access(GetOtaDirectoryPrefix().c_str(), R_OK) < 0) { LOG(ERROR) << "Could not access " << GetOtaDirectoryPrefix(); PLOG(ERROR) << "Could not access " << GetOtaDirectoryPrefix(); return false; } Loading Loading @@ -460,7 +460,7 @@ private: // this tool will wipe the OTA artifact cache and try again (for robustness after // a failed OTA with remaining cache artifacts). if (access(apk_path, F_OK) != 0) { LOG(WARNING) << "Skipping A/B OTA preopt of non-existing package " << apk_path; PLOG(WARNING) << "Skipping A/B OTA preopt of non-existing package " << apk_path; return true; } Loading cmds/installd/otapreopt_chroot.cpp +27 −12 Original line number Diff line number Diff line Loading @@ -45,6 +45,10 @@ using android::base::StringPrintf; namespace android { namespace installd { // We don't know the filesystem types of the partitions in the update package, // so just try the possibilities one by one. static constexpr std::array kTryMountFsTypes = {"ext4", "erofs"}; static void CloseDescriptor(int fd) { if (fd >= 0) { int result = close(fd); Loading Loading @@ -82,6 +86,27 @@ static void DeactivateApexPackages() { } } static bool TryMountWithFstypes(const char* block_device, const char* target) { for (int i = 0; i < kTryMountFsTypes.size(); ++i) { const char* fstype = kTryMountFsTypes[i]; int mount_result = mount(block_device, target, fstype, MS_RDONLY, /* data */ nullptr); if (mount_result == 0) { return true; } if (errno == EINVAL && i < kTryMountFsTypes.size() - 1) { // Only try the next fstype if mounting failed due to the current one // being invalid. LOG(WARNING) << "Failed to mount " << block_device << " on " << target << " with " << fstype << " - trying " << kTryMountFsTypes[i + 1]; } else { PLOG(ERROR) << "Failed to mount " << block_device << " on " << target << " with " << fstype; return false; } } __builtin_unreachable(); } static void TryExtraMount(const char* name, const char* slot, const char* target) { std::string partition_name = StringPrintf("%s%s", name, slot); Loading @@ -91,12 +116,7 @@ static void TryExtraMount(const char* name, const char* slot, const char* target if (dm.GetState(partition_name) != dm::DmDeviceState::INVALID) { std::string path; if (dm.GetDmDevicePathByName(partition_name, &path)) { int mount_result = mount(path.c_str(), target, "ext4", MS_RDONLY, /* data */ nullptr); if (mount_result == 0) { if (TryMountWithFstypes(path.c_str(), target)) { return; } } Loading @@ -105,12 +125,7 @@ static void TryExtraMount(const char* name, const char* slot, const char* target // Fall back and attempt a direct mount. std::string block_device = StringPrintf("/dev/block/by-name/%s", partition_name.c_str()); int mount_result = mount(block_device.c_str(), target, "ext4", MS_RDONLY, /* data */ nullptr); UNUSED(mount_result); (void)TryMountWithFstypes(block_device.c_str(), target); } // Entry for otapreopt_chroot. Expected parameters are: Loading cmds/installd/otapreopt_script.sh +7 −7 Original line number Diff line number Diff line Loading @@ -60,6 +60,11 @@ print -u${STATUS_FD} "global_progress $PROGRESS" i=0 while ((i<MAXIMUM_PACKAGES)) ; do DONE=$(cmd otadexopt done) if [ "$DONE" = "OTA complete." ] ; then break fi DEXOPT_PARAMS=$(cmd otadexopt next) /system/bin/otapreopt_chroot $STATUS_FD $TARGET_SLOT_SUFFIX $DEXOPT_PARAMS >&- 2>&- Loading @@ -67,13 +72,8 @@ while ((i<MAXIMUM_PACKAGES)) ; do PROGRESS=$(cmd otadexopt progress) print -u${STATUS_FD} "global_progress $PROGRESS" DONE=$(cmd otadexopt done) if [ "$DONE" = "OTA incomplete." ] ; then sleep 1 i=$((i+1)) continue fi break done DONE=$(cmd otadexopt done) Loading cmds/servicemanager/ServiceManager.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -228,8 +228,13 @@ static bool meetsDeclarationRequirements(const sp<IBinder>& binder, const std::s #endif // !VENDORSERVICEMANAGER ServiceManager::Service::~Service() { if (!hasClients) { // only expected to happen on process death if (hasClients) { // only expected to happen on process death, we don't store the service // name this late (it's in the map that holds this service), but if it // is happening, we might want to change 'unlinkToDeath' to explicitly // clear this bit so that we can abort in other cases, where it would // mean inconsistent logic in servicemanager (unexpected and tested, but // the original lazy service impl here had that bug). LOG(WARNING) << "a service was removed when there are clients"; } } Loading libs/binder/tests/binderRpcTest.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -237,9 +237,13 @@ std::string BinderRpc::PrintParamInfo(const testing::TestParamInfo<ParamType>& i std::to_string(clientVersion) + "_serverV" + std::to_string(serverVersion); if (singleThreaded) { ret += "_single_threaded"; } else { ret += "_multi_threaded"; } if (noKernel) { ret += "_no_kernel"; } else { ret += "_with_kernel"; } return ret; } Loading Loading @@ -435,8 +439,7 @@ TEST_P(BinderRpc, ThreadPoolGreaterThanEqualRequested) { for (auto& t : ts) t.join(); } static void testThreadPoolOverSaturated(sp<IBinderRpcTest> iface, size_t numCalls, size_t sleepMs = 500) { static void testThreadPoolOverSaturated(sp<IBinderRpcTest> iface, size_t numCalls, size_t sleepMs) { size_t epochMsBefore = epochMillis(); std::vector<std::thread> ts; Loading @@ -462,7 +465,7 @@ TEST_P(BinderRpc, ThreadPoolOverSaturated) { constexpr size_t kNumThreads = 10; constexpr size_t kNumCalls = kNumThreads + 3; auto proc = createRpcTestSocketServerProcess({.numThreads = kNumThreads}); testThreadPoolOverSaturated(proc.rootIface, kNumCalls); testThreadPoolOverSaturated(proc.rootIface, kNumCalls, 250 /*ms*/); } TEST_P(BinderRpc, ThreadPoolLimitOutgoing) { Loading @@ -475,7 +478,7 @@ TEST_P(BinderRpc, ThreadPoolLimitOutgoing) { constexpr size_t kNumCalls = kNumOutgoingConnections + 3; auto proc = createRpcTestSocketServerProcess( {.numThreads = kNumThreads, .numOutgoingConnections = kNumOutgoingConnections}); testThreadPoolOverSaturated(proc.rootIface, kNumCalls); testThreadPoolOverSaturated(proc.rootIface, kNumCalls, 250 /*ms*/); } TEST_P(BinderRpc, ThreadingStressTest) { Loading @@ -483,9 +486,9 @@ TEST_P(BinderRpc, ThreadingStressTest) { GTEST_SKIP() << "This test requires multiple threads"; } constexpr size_t kNumClientThreads = 10; constexpr size_t kNumServerThreads = 10; constexpr size_t kNumCalls = 100; constexpr size_t kNumClientThreads = 5; constexpr size_t kNumServerThreads = 5; constexpr size_t kNumCalls = 50; auto proc = createRpcTestSocketServerProcess({.numThreads = kNumServerThreads}); Loading Loading
cmds/installd/otapreopt.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -308,7 +308,7 @@ private: // This is different from the normal installd. We only do the base // directory, the rest will be created on demand when each app is compiled. if (access(GetOtaDirectoryPrefix().c_str(), R_OK) < 0) { LOG(ERROR) << "Could not access " << GetOtaDirectoryPrefix(); PLOG(ERROR) << "Could not access " << GetOtaDirectoryPrefix(); return false; } Loading Loading @@ -460,7 +460,7 @@ private: // this tool will wipe the OTA artifact cache and try again (for robustness after // a failed OTA with remaining cache artifacts). if (access(apk_path, F_OK) != 0) { LOG(WARNING) << "Skipping A/B OTA preopt of non-existing package " << apk_path; PLOG(WARNING) << "Skipping A/B OTA preopt of non-existing package " << apk_path; return true; } Loading
cmds/installd/otapreopt_chroot.cpp +27 −12 Original line number Diff line number Diff line Loading @@ -45,6 +45,10 @@ using android::base::StringPrintf; namespace android { namespace installd { // We don't know the filesystem types of the partitions in the update package, // so just try the possibilities one by one. static constexpr std::array kTryMountFsTypes = {"ext4", "erofs"}; static void CloseDescriptor(int fd) { if (fd >= 0) { int result = close(fd); Loading Loading @@ -82,6 +86,27 @@ static void DeactivateApexPackages() { } } static bool TryMountWithFstypes(const char* block_device, const char* target) { for (int i = 0; i < kTryMountFsTypes.size(); ++i) { const char* fstype = kTryMountFsTypes[i]; int mount_result = mount(block_device, target, fstype, MS_RDONLY, /* data */ nullptr); if (mount_result == 0) { return true; } if (errno == EINVAL && i < kTryMountFsTypes.size() - 1) { // Only try the next fstype if mounting failed due to the current one // being invalid. LOG(WARNING) << "Failed to mount " << block_device << " on " << target << " with " << fstype << " - trying " << kTryMountFsTypes[i + 1]; } else { PLOG(ERROR) << "Failed to mount " << block_device << " on " << target << " with " << fstype; return false; } } __builtin_unreachable(); } static void TryExtraMount(const char* name, const char* slot, const char* target) { std::string partition_name = StringPrintf("%s%s", name, slot); Loading @@ -91,12 +116,7 @@ static void TryExtraMount(const char* name, const char* slot, const char* target if (dm.GetState(partition_name) != dm::DmDeviceState::INVALID) { std::string path; if (dm.GetDmDevicePathByName(partition_name, &path)) { int mount_result = mount(path.c_str(), target, "ext4", MS_RDONLY, /* data */ nullptr); if (mount_result == 0) { if (TryMountWithFstypes(path.c_str(), target)) { return; } } Loading @@ -105,12 +125,7 @@ static void TryExtraMount(const char* name, const char* slot, const char* target // Fall back and attempt a direct mount. std::string block_device = StringPrintf("/dev/block/by-name/%s", partition_name.c_str()); int mount_result = mount(block_device.c_str(), target, "ext4", MS_RDONLY, /* data */ nullptr); UNUSED(mount_result); (void)TryMountWithFstypes(block_device.c_str(), target); } // Entry for otapreopt_chroot. Expected parameters are: Loading
cmds/installd/otapreopt_script.sh +7 −7 Original line number Diff line number Diff line Loading @@ -60,6 +60,11 @@ print -u${STATUS_FD} "global_progress $PROGRESS" i=0 while ((i<MAXIMUM_PACKAGES)) ; do DONE=$(cmd otadexopt done) if [ "$DONE" = "OTA complete." ] ; then break fi DEXOPT_PARAMS=$(cmd otadexopt next) /system/bin/otapreopt_chroot $STATUS_FD $TARGET_SLOT_SUFFIX $DEXOPT_PARAMS >&- 2>&- Loading @@ -67,13 +72,8 @@ while ((i<MAXIMUM_PACKAGES)) ; do PROGRESS=$(cmd otadexopt progress) print -u${STATUS_FD} "global_progress $PROGRESS" DONE=$(cmd otadexopt done) if [ "$DONE" = "OTA incomplete." ] ; then sleep 1 i=$((i+1)) continue fi break done DONE=$(cmd otadexopt done) Loading
cmds/servicemanager/ServiceManager.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -228,8 +228,13 @@ static bool meetsDeclarationRequirements(const sp<IBinder>& binder, const std::s #endif // !VENDORSERVICEMANAGER ServiceManager::Service::~Service() { if (!hasClients) { // only expected to happen on process death if (hasClients) { // only expected to happen on process death, we don't store the service // name this late (it's in the map that holds this service), but if it // is happening, we might want to change 'unlinkToDeath' to explicitly // clear this bit so that we can abort in other cases, where it would // mean inconsistent logic in servicemanager (unexpected and tested, but // the original lazy service impl here had that bug). LOG(WARNING) << "a service was removed when there are clients"; } } Loading
libs/binder/tests/binderRpcTest.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -237,9 +237,13 @@ std::string BinderRpc::PrintParamInfo(const testing::TestParamInfo<ParamType>& i std::to_string(clientVersion) + "_serverV" + std::to_string(serverVersion); if (singleThreaded) { ret += "_single_threaded"; } else { ret += "_multi_threaded"; } if (noKernel) { ret += "_no_kernel"; } else { ret += "_with_kernel"; } return ret; } Loading Loading @@ -435,8 +439,7 @@ TEST_P(BinderRpc, ThreadPoolGreaterThanEqualRequested) { for (auto& t : ts) t.join(); } static void testThreadPoolOverSaturated(sp<IBinderRpcTest> iface, size_t numCalls, size_t sleepMs = 500) { static void testThreadPoolOverSaturated(sp<IBinderRpcTest> iface, size_t numCalls, size_t sleepMs) { size_t epochMsBefore = epochMillis(); std::vector<std::thread> ts; Loading @@ -462,7 +465,7 @@ TEST_P(BinderRpc, ThreadPoolOverSaturated) { constexpr size_t kNumThreads = 10; constexpr size_t kNumCalls = kNumThreads + 3; auto proc = createRpcTestSocketServerProcess({.numThreads = kNumThreads}); testThreadPoolOverSaturated(proc.rootIface, kNumCalls); testThreadPoolOverSaturated(proc.rootIface, kNumCalls, 250 /*ms*/); } TEST_P(BinderRpc, ThreadPoolLimitOutgoing) { Loading @@ -475,7 +478,7 @@ TEST_P(BinderRpc, ThreadPoolLimitOutgoing) { constexpr size_t kNumCalls = kNumOutgoingConnections + 3; auto proc = createRpcTestSocketServerProcess( {.numThreads = kNumThreads, .numOutgoingConnections = kNumOutgoingConnections}); testThreadPoolOverSaturated(proc.rootIface, kNumCalls); testThreadPoolOverSaturated(proc.rootIface, kNumCalls, 250 /*ms*/); } TEST_P(BinderRpc, ThreadingStressTest) { Loading @@ -483,9 +486,9 @@ TEST_P(BinderRpc, ThreadingStressTest) { GTEST_SKIP() << "This test requires multiple threads"; } constexpr size_t kNumClientThreads = 10; constexpr size_t kNumServerThreads = 10; constexpr size_t kNumCalls = 100; constexpr size_t kNumClientThreads = 5; constexpr size_t kNumServerThreads = 5; constexpr size_t kNumCalls = 50; auto proc = createRpcTestSocketServerProcess({.numThreads = kNumServerThreads}); Loading