Fix to avoid deleting and setting identical voice commands #1691
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1676
This PR is [ready] for review.
Risk
This PR makes [minor] API changes.
Testing Plan
Unit Tests
Unit test were added in
VoiceCommandUpdateOperationTests.javaCore Tests
TEST:
Test 1:
VoiceCommandA = "command one"
VoiceCommandB = "command two"
Upload A and B on startup
VoiceCommandC = "command one"
VoiceCommandD = "command four"
Upload C and D in a menuSelection listener.
Verify Voice commands on HMI are "command one" and "command four"
Verify that when "command one" is selected the listener for VoiceCommandC is triggered.
Test2:
Upload A on startup
VoiceCommandA = "command one"
Upload C in a menuSelection listener.
VoiceCommandC = "command one"
Verify that when "command one" is selected the listener for VoiceCommandC is triggered.
Test3:
Upload A on startup
VoiceCommandA = "command one"
After A is uploaded, modify VoiceCommandA to have a new listener and upload it in something like a menuSelectionListener
Verify that when "command one" is selected the updated listener is triggered.
Test 4:
VoiceCommandA = "command one"
VoiceCommandB = "command two"
Upload A and B.
After A is uploaded, modify VoiceCommandA to have a new listener and upload it in something like a menuSelectionListener.
Verify that VoiceCommandB("command two") is removed form the hmi.
Verify that when "command one" is selected the updated listener is triggered.
Test 5:
Upload A on startup
VoiceCommandA = "command one"
After A is uploaded, modify VoiceCommandA to : "command one changed"
Verify that "Command one" is deleted and "Command one changed appears.
REPEAT THIS TEST WITH A NEW LISTENER AS WELL.
Test 6:
Upload voiceCommadA on startup
VoiceCommandA = "command one"
After A is uploaded, upload an empty list for voiceCommands
Verify that voiceCommadA is removed
Core version / branch / commit hash / module tested against: [INSERT]
HMI name / version / branch / commit hash / module tested against: [INSERT]
Summary
Modified logic in VoiceCommandManager to not check if voiceCommands are equal to old voice Commands since the new voiceCommands could have different listeners, and moved that logic to VoiceCommandUpdateOperation.
Now if you upload
VoiceCommandsand change a listener and upload them again, the command doesn't get resent to core, the listener just gets updated.Also added logic to not upload identical voiceCommands.
Added clone
Changelog
Enhancements
Bug Fixes
CLA