Loading automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -627,11 +627,7 @@ DumpResult FakeVehicleHardware::dump(const std::vector<std::string>& options) { } else if (EqualsIgnoreCase(option, "--inject-event")) { result.buffer = dumpInjectEvent(options); } else if (EqualsIgnoreCase(option, kUserHalDumpOption)) { if (options.size() == 1) { result.buffer = mFakeUserHal->showDumpHelp(); } else { result.buffer = mFakeUserHal->dump(options[1]); } result.buffer = mFakeUserHal->dump(); } else if (EqualsIgnoreCase(option, "--genfakedata")) { result.buffer = genFakeDataCommand(options); } else { Loading automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +3 −13 Original line number Diff line number Diff line Loading @@ -1520,26 +1520,16 @@ TEST_F(FakeVehicleHardwareTest, testDumpInvalidOptions) { ASSERT_THAT(result.buffer, ContainsRegex("Invalid option: --invalid")); } TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHalHelp) { std::vector<std::string> options; options.push_back("--user-hal"); DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_NE(result.buffer, ""); ASSERT_THAT(result.buffer, ContainsRegex("dumps state used for user management")); } TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHal) { std::vector<std::string> options; options.push_back("--user-hal"); // Indent: " ". options.push_back(" "); DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_NE(result.buffer, ""); ASSERT_THAT(result.buffer, ContainsRegex(" No InitialUserInfo response\n")); ASSERT_THAT(result.buffer, ContainsRegex("No InitialUserInfo response\nNo SwitchUser response\nNo CreateUser " "response\nNo SetUserIdentificationAssociation response\n")); } struct SetPropTestCase { Loading automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ class FakeUserHal final { std::string showDumpHelp() const; // Dump its contents. std::string dump(std::string indent) const; std::string dump() const; private: const std::shared_ptr<VehiclePropValuePool> mValuePool; Loading automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -339,33 +339,31 @@ std::string FakeUserHal::showDumpHelp() const { return fmt::format("{}: dumps state used for user management\n", kUserHalDumpOption); } std::string FakeUserHal::dump(std::string indent) const { std::string FakeUserHal::dump() const { std::scoped_lock<std::mutex> lockGuard(mLock); std::string info; if (mInitialUserResponseFromCmd != nullptr) { info += fmt::format("{}InitialUserInfo response: {}\n", indent, info += fmt::format("InitialUserInfo response: {}\n", mInitialUserResponseFromCmd->toString()); } else { info += fmt::format("{}No InitialUserInfo response\n", indent); info += "No InitialUserInfo response\n"; } if (mSwitchUserResponseFromCmd != nullptr) { info += fmt::format("{}SwitchUser response: {}\n", indent, mSwitchUserResponseFromCmd->toString()); info += fmt::format("SwitchUser response: {}\n", mSwitchUserResponseFromCmd->toString()); } else { info += fmt::format("{}No SwitchUser response\n", indent); info += "No SwitchUser response\n"; } if (mCreateUserResponseFromCmd != nullptr) { info += fmt::format("{}CreateUser response: {}\n", indent, mCreateUserResponseFromCmd->toString()); info += fmt::format("CreateUser response: {}\n", mCreateUserResponseFromCmd->toString()); } else { info += fmt::format("{}No CreateUser response\n", indent); info += "No CreateUser response\n"; } if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) { info += fmt::format("{}SetUserIdentificationAssociation response: {}\n", indent, info += fmt::format("SetUserIdentificationAssociation response: {}\n", mSetUserIdentificationAssociationResponseFromCmd->toString()); } else { info += fmt::format("{}No SetUserIdentificationAssociation response\n", indent); info += "No SetUserIdentificationAssociation response\n"; } return info; } Loading automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -792,7 +792,7 @@ binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numA DumpResult result = mVehicleHardware->dump(options); dprintf(fd, "%s", (result.buffer + "\n").c_str()); if (!result.callerShouldDumpState) { dprintf(fd, "Skip dumping Vehicle HAL State.\n"); ALOGE("Skip dumping Vehicle HAL State."); return STATUS_OK; } dprintf(fd, "Vehicle HAL State: \n"); Loading Loading
automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -627,11 +627,7 @@ DumpResult FakeVehicleHardware::dump(const std::vector<std::string>& options) { } else if (EqualsIgnoreCase(option, "--inject-event")) { result.buffer = dumpInjectEvent(options); } else if (EqualsIgnoreCase(option, kUserHalDumpOption)) { if (options.size() == 1) { result.buffer = mFakeUserHal->showDumpHelp(); } else { result.buffer = mFakeUserHal->dump(options[1]); } result.buffer = mFakeUserHal->dump(); } else if (EqualsIgnoreCase(option, "--genfakedata")) { result.buffer = genFakeDataCommand(options); } else { Loading
automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +3 −13 Original line number Diff line number Diff line Loading @@ -1520,26 +1520,16 @@ TEST_F(FakeVehicleHardwareTest, testDumpInvalidOptions) { ASSERT_THAT(result.buffer, ContainsRegex("Invalid option: --invalid")); } TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHalHelp) { std::vector<std::string> options; options.push_back("--user-hal"); DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_NE(result.buffer, ""); ASSERT_THAT(result.buffer, ContainsRegex("dumps state used for user management")); } TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHal) { std::vector<std::string> options; options.push_back("--user-hal"); // Indent: " ". options.push_back(" "); DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_NE(result.buffer, ""); ASSERT_THAT(result.buffer, ContainsRegex(" No InitialUserInfo response\n")); ASSERT_THAT(result.buffer, ContainsRegex("No InitialUserInfo response\nNo SwitchUser response\nNo CreateUser " "response\nNo SetUserIdentificationAssociation response\n")); } struct SetPropTestCase { Loading
automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ class FakeUserHal final { std::string showDumpHelp() const; // Dump its contents. std::string dump(std::string indent) const; std::string dump() const; private: const std::shared_ptr<VehiclePropValuePool> mValuePool; Loading
automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -339,33 +339,31 @@ std::string FakeUserHal::showDumpHelp() const { return fmt::format("{}: dumps state used for user management\n", kUserHalDumpOption); } std::string FakeUserHal::dump(std::string indent) const { std::string FakeUserHal::dump() const { std::scoped_lock<std::mutex> lockGuard(mLock); std::string info; if (mInitialUserResponseFromCmd != nullptr) { info += fmt::format("{}InitialUserInfo response: {}\n", indent, info += fmt::format("InitialUserInfo response: {}\n", mInitialUserResponseFromCmd->toString()); } else { info += fmt::format("{}No InitialUserInfo response\n", indent); info += "No InitialUserInfo response\n"; } if (mSwitchUserResponseFromCmd != nullptr) { info += fmt::format("{}SwitchUser response: {}\n", indent, mSwitchUserResponseFromCmd->toString()); info += fmt::format("SwitchUser response: {}\n", mSwitchUserResponseFromCmd->toString()); } else { info += fmt::format("{}No SwitchUser response\n", indent); info += "No SwitchUser response\n"; } if (mCreateUserResponseFromCmd != nullptr) { info += fmt::format("{}CreateUser response: {}\n", indent, mCreateUserResponseFromCmd->toString()); info += fmt::format("CreateUser response: {}\n", mCreateUserResponseFromCmd->toString()); } else { info += fmt::format("{}No CreateUser response\n", indent); info += "No CreateUser response\n"; } if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) { info += fmt::format("{}SetUserIdentificationAssociation response: {}\n", indent, info += fmt::format("SetUserIdentificationAssociation response: {}\n", mSetUserIdentificationAssociationResponseFromCmd->toString()); } else { info += fmt::format("{}No SetUserIdentificationAssociation response\n", indent); info += "No SetUserIdentificationAssociation response\n"; } return info; } Loading
automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -792,7 +792,7 @@ binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numA DumpResult result = mVehicleHardware->dump(options); dprintf(fd, "%s", (result.buffer + "\n").c_str()); if (!result.callerShouldDumpState) { dprintf(fd, "Skip dumping Vehicle HAL State.\n"); ALOGE("Skip dumping Vehicle HAL State."); return STATUS_OK; } dprintf(fd, "Vehicle HAL State: \n"); Loading