mirror of
https://github.com/Evolution-X-Devices/device_google_redfin
synced 2026-01-28 12:38:32 +00:00
Redfin: fix DumpstateMode validation.
The PROTO mode was added after initial HAL upgrade and is causing VTS failures due to the way the DumpstateMode param is being validated. Bug: 150873571 Test: make (no device run VTS, older devices pass with identical change) Change-Id: I5a26d9e12fb60ddd5526275cb0d176ff9acef6e4 (cherry picked from commit 1d4fd8a0b221ef14cbe56a67dbe7b303bf065cd0)
This commit is contained in:
committed by
Cyan_Hsieh
parent
ce11c70fd3
commit
db895423ca
@@ -22,6 +22,7 @@
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <hidl/HidlBinderSupport.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <pthread.h>
|
||||
@@ -441,13 +442,20 @@ Return<DumpstateStatus> DumpstateDevice::dumpstateBoard_1_1(const hidl_handle& h
|
||||
return DumpstateStatus::ILLEGAL_ARGUMENT;
|
||||
}
|
||||
|
||||
if (mode == DumpstateMode::WEAR) {
|
||||
bool isModeValid = false;
|
||||
for (const auto dumpstateMode : hidl_enum_range<DumpstateMode>()) {
|
||||
if (mode == dumpstateMode) {
|
||||
isModeValid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isModeValid) {
|
||||
ALOGE("Invalid mode: %d\n", mode);
|
||||
return DumpstateStatus::ILLEGAL_ARGUMENT;
|
||||
} else if (mode == DumpstateMode::WEAR) {
|
||||
// We aren't a Wear device.
|
||||
ALOGE("Unsupported mode: %d\n", mode);
|
||||
return DumpstateStatus::UNSUPPORTED_MODE;
|
||||
} else if (mode < DumpstateMode::FULL || mode > DumpstateMode::DEFAULT) {
|
||||
ALOGE("Invalid mode: %d\n", mode);
|
||||
return DumpstateStatus::ILLEGAL_ARGUMENT;
|
||||
}
|
||||
|
||||
RunCommandToFd(fd, "Notify modem", {"/vendor/bin/modem_svc", "-s"}, CommandOptions::WithTimeout(1).Build());
|
||||
|
||||
Reference in New Issue
Block a user