diff options
Diffstat (limited to '')
-rw-r--r-- | install/install.cpp | 2 | ||||
-rw-r--r-- | install/verifier.cpp | 2 | ||||
-rw-r--r-- | minadbd/minadbd_services.cpp | 17 | ||||
-rw-r--r-- | recovery_ui/ui.cpp | 6 |
4 files changed, 12 insertions, 15 deletions
diff --git a/install/install.cpp b/install/install.cpp index b0162f095..09b88392a 100644 --- a/install/install.cpp +++ b/install/install.cpp @@ -546,7 +546,7 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip) { std::vector<std::string> compatibility_info; ZipEntry info_entry; - std::string info_name; + std::string_view info_name; while (Next(cookie, &info_entry, &info_name) == 0) { std::string content(info_entry.uncompressed_length, '\0'); int32_t ret = ExtractToMemory(zip_handle, &info_entry, reinterpret_cast<uint8_t*>(&content[0]), diff --git a/install/verifier.cpp b/install/verifier.cpp index 02759cdc2..ab750442d 100644 --- a/install/verifier.cpp +++ b/install/verifier.cpp @@ -320,7 +320,7 @@ static std::vector<Certificate> IterateZipEntriesAndSearchForKeys(const ZipArchi std::vector<Certificate> result; - std::string name; + std::string_view name; ZipEntry entry; while ((iter_status = Next(cookie, &entry, &name)) == 0) { std::vector<uint8_t> pem_content(entry.uncompressed_length); diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp index d2b824cfe..1e6eb3165 100644 --- a/minadbd/minadbd_services.cpp +++ b/minadbd/minadbd_services.cpp @@ -156,9 +156,10 @@ static void RescueInstallHostService(unique_fd sfd, const std::string& args) { } } -// Answers the query on a given property. The result will be written to the given sfd. If given an -// empty string, dumps all the supported properties (similar to `adb shell getprop`) in lines, e.g. -// "[prop]: [value]". +// Answers the query on a given property |prop|, by writing the result to the given |sfd|. The +// result will be newline-terminated, so nonexistent or nonallowed query will be answered with "\n". +// If given an empty string, dumps all the supported properties (analogous to `adb shell getprop`) +// in lines, e.g. "[prop]: [value]". static void RescueGetpropHostService(unique_fd sfd, const std::string& prop) { static const std::set<std::string> kGetpropAllowedProps = { "ro.build.date.utc", @@ -171,10 +172,6 @@ static void RescueGetpropHostService(unique_fd sfd, const std::string& prop) { "ro.product.device", "ro.product.vendor.device", }; - if (!prop.empty() && kGetpropAllowedProps.find(prop) == kGetpropAllowedProps.end()) { - return; - } - std::string result; if (prop.empty()) { for (const auto& key : kGetpropAllowedProps) { @@ -184,11 +181,11 @@ static void RescueGetpropHostService(unique_fd sfd, const std::string& prop) { } result += "[" + key + "]: [" + value + "]\n"; } - } else { - result = android::base::GetProperty(prop, ""); + } else if (kGetpropAllowedProps.find(prop) != kGetpropAllowedProps.end()) { + result = android::base::GetProperty(prop, "") + "\n"; } if (result.empty()) { - return; + result = "\n"; } if (!android::base::WriteFully(sfd, result.data(), result.size())) { exit(kMinadbdHostSocketIOError); diff --git a/recovery_ui/ui.cpp b/recovery_ui/ui.cpp index 78b014a88..cf0d3b563 100644 --- a/recovery_ui/ui.cpp +++ b/recovery_ui/ui.cpp @@ -419,7 +419,7 @@ void RecoveryUI::SetScreensaverState(ScreensaverState state) { LOG(INFO) << "Brightness: " << brightness_normal_value_ << " (" << brightness_normal_ << "%)"; } else { - LOG(ERROR) << "Unable to set brightness to normal"; + LOG(WARNING) << "Unable to set brightness to normal"; } break; case ScreensaverState::DIMMED: @@ -429,7 +429,7 @@ void RecoveryUI::SetScreensaverState(ScreensaverState state) { << "%)"; screensaver_state_ = ScreensaverState::DIMMED; } else { - LOG(ERROR) << "Unable to set brightness to dim"; + LOG(WARNING) << "Unable to set brightness to dim"; } break; case ScreensaverState::OFF: @@ -437,7 +437,7 @@ void RecoveryUI::SetScreensaverState(ScreensaverState state) { LOG(INFO) << "Brightness: 0 (off)"; screensaver_state_ = ScreensaverState::OFF; } else { - LOG(ERROR) << "Unable to set brightness to off"; + LOG(WARNING) << "Unable to set brightness to off"; } break; default: |