mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-24 04:45:32 -04:00
unuversal7885: parts-aidl: Display: format changes
* Let compiler auto infer lambda's type * Change signature to clearify the usage
This commit is contained in:
parent
c9ed1bc494
commit
188737dfe5
1 changed files with 5 additions and 6 deletions
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
@ -52,14 +51,14 @@ enum DisplayResult {
|
||||||
constexpr const char *OK_STR = "OK";
|
constexpr const char *OK_STR = "OK";
|
||||||
constexpr const char *NOOP_STR = "NOOP";
|
constexpr const char *NOOP_STR = "NOOP";
|
||||||
|
|
||||||
static DisplayResult parseResult(std::string *result, DisplaySys from) {
|
static DisplayResult parseResult(std::string *result, DisplaySys from, bool enabled) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
std::string parsed;
|
std::string parsed;
|
||||||
const std::function<void(std::string *)> addEmpty = [](std::string *str) {
|
auto addEmpty = [](std::string *str) {
|
||||||
if (str->empty())
|
if (str->empty())
|
||||||
*str = std::string("(empty)");
|
*str = std::string("(empty)");
|
||||||
};
|
};
|
||||||
ss << DisplayStrBuilder(true, from);
|
ss << DisplayStrBuilder(enabled, from);
|
||||||
ss << ":";
|
ss << ":";
|
||||||
if (result->find(ss.str()) == std::string::npos) {
|
if (result->find(ss.str()) == std::string::npos) {
|
||||||
LOG_E("Unexpected: Failed to find built string in result string");
|
LOG_E("Unexpected: Failed to find built string in result string");
|
||||||
|
|
@ -99,7 +98,7 @@ error:
|
||||||
std::string res;
|
std::string res;
|
||||||
writeDisplay(true, type);
|
writeDisplay(true, type);
|
||||||
res = FileIO::readline(SEC_TSP_CMD_RESULT);
|
res = FileIO::readline(SEC_TSP_CMD_RESULT);
|
||||||
switch (parseResult(&res, type)) {
|
switch (parseResult(&res, type, true)) {
|
||||||
case DisplayResult::NOOP: {
|
case DisplayResult::NOOP: {
|
||||||
*_aidl_return = true;
|
*_aidl_return = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -107,7 +106,7 @@ error:
|
||||||
case DisplayResult::OK: {
|
case DisplayResult::OK: {
|
||||||
writeDisplay(true, type);
|
writeDisplay(true, type);
|
||||||
res = FileIO::readline(SEC_TSP_CMD_RESULT);
|
res = FileIO::readline(SEC_TSP_CMD_RESULT);
|
||||||
switch (parseResult(&res, type)) {
|
switch (parseResult(&res, type, true)) {
|
||||||
case DisplayResult::NOOP: {
|
case DisplayResult::NOOP: {
|
||||||
*_aidl_return = false;
|
*_aidl_return = false;
|
||||||
writeDisplay(false, type);
|
writeDisplay(false, type);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue