vibrator: correct debug() calibration file path
Bug: 356823441 Test: dumpsys Flag: EXEMPT bugfix Change-Id: I2d126e63ae7365b4bd199d00776f10b11c700702
This commit is contained in:
parent
70c67ccdb5
commit
c5a772a3f2
3 changed files with 18 additions and 5 deletions
|
@ -69,6 +69,7 @@ HwCalBase::HwCalBase() {
|
|||
std::ifstream calfile;
|
||||
std::ifstream calfile_dual;
|
||||
auto propertyPrefix = std::getenv("PROPERTY_PREFIX");
|
||||
auto calPath = std::getenv("CALIBRATION_FILEPATH");
|
||||
|
||||
if (propertyPrefix != NULL) {
|
||||
mPropertyPrefix = std::string(propertyPrefix);
|
||||
|
@ -76,6 +77,14 @@ HwCalBase::HwCalBase() {
|
|||
ALOGE("Failed get property prefix!");
|
||||
}
|
||||
|
||||
// Keep the cal file path for the current HwCalBase instance.
|
||||
if (calPath != NULL) {
|
||||
mCalPath = std::string(calPath);
|
||||
} else {
|
||||
ALOGE("Failed get the calibration file path!");
|
||||
}
|
||||
|
||||
// Read the cal data for the current instance.
|
||||
utils::fileFromEnv("CALIBRATION_FILEPATH", &calfile);
|
||||
|
||||
for (std::string line; std::getline(calfile, line);) {
|
||||
|
@ -89,6 +98,7 @@ HwCalBase::HwCalBase() {
|
|||
}
|
||||
}
|
||||
|
||||
// Read the cal data for the other instance.
|
||||
utils::fileFromEnv("CALIBRATION_FILEPATH_DUAL", &calfile_dual);
|
||||
|
||||
for (std::string line; std::getline(calfile_dual, line);) {
|
||||
|
@ -106,7 +116,6 @@ HwCalBase::HwCalBase() {
|
|||
|
||||
void HwCalBase::debug(int fd) {
|
||||
std::ifstream stream;
|
||||
std::string path;
|
||||
std::string line;
|
||||
struct context {
|
||||
HwCalBase *obj;
|
||||
|
@ -133,9 +142,8 @@ void HwCalBase::debug(int fd) {
|
|||
|
||||
dprintf(fd, "Persist:\n");
|
||||
|
||||
utils::fileFromEnv("CALIBRATION_FILEPATH", &stream, &path);
|
||||
|
||||
dprintf(fd, " %s:\n", path.c_str());
|
||||
utils::openNoCreate(mCalPath, &stream);
|
||||
dprintf(fd, " %s:\n", mCalPath.c_str());
|
||||
while (std::getline(stream, line)) {
|
||||
dprintf(fd, " %s\n", line.c_str());
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@ class HwCalBase {
|
|||
|
||||
private:
|
||||
std::string mPropertyPrefix;
|
||||
std::string mCalPath;
|
||||
std::map<std::string, std::string> mCalData;
|
||||
};
|
||||
|
||||
|
|
|
@ -1081,7 +1081,7 @@ ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex, const
|
|||
if (mIsDual) {
|
||||
mHwApiDual->getOwtFreeSpace(&freeBytes);
|
||||
if (ch-> size() > freeBytes) {
|
||||
ALOGE("Invalid OWT length in flip: Effect %d: %d > %d!", effectIndex,
|
||||
ALOGE("Invalid OWT length in flip: Effect %d: %zu > %d!", effectIndex,
|
||||
ch-> size(), freeBytes);
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
|
@ -1619,12 +1619,16 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) {
|
|||
verFile.close();
|
||||
}
|
||||
|
||||
dprintf(fd, "\n");
|
||||
|
||||
mHwApiDef->debug(fd);
|
||||
|
||||
dprintf(fd, "\n");
|
||||
|
||||
mHwCalDef->debug(fd);
|
||||
|
||||
dprintf(fd, "\n");
|
||||
|
||||
if (mIsDual) {
|
||||
mHwApiDual->debug(fd);
|
||||
dprintf(fd, "\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue