Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Two voiceCommands contains the same string #1681

Merged
merged 4 commits into from
May 10, 2021

Conversation

JulianKast
Copy link
Contributor

@JulianKast JulianKast commented May 5, 2021

Fixes #1677

This PR is [ready] for review.

Risk

This PR makes [no] API changes.

Testing Plan

  • I have verified that I have not introduced new warnings in this PR (or explain why below)
  • I have run the unit tests with this PR
  • I have tested this PR against Core and verified behavior (if applicable, if not applicable, explain why below).
  • I have tested Android, Java SE, and Java EE

Unit Tests

Unit test were added in VoiceCommandManagerTests

Core Tests

Try to upload two different voice commands with the same strings, observe error messages in logs, and voice commands do not upload.

Error message: Not all voice command strings are unique across all voice commands. Voice commands will not be set.

        List<String> list1 = Collections.singletonList("Command One");
        List<String> list2 = Collections.singletonList("Command One");

        VoiceCommand voiceCommand1 = new VoiceCommand(list1, new VoiceCommandSelectionListener() {
            @Override
            public void onVoiceCommandSelected() {
                Log.i(TAG, "Voice Command 1 triggered");
            }
        });

        VoiceCommand voiceCommand2 = new VoiceCommand(list2, new VoiceCommandSelectionListener() {
            @Override
            public void onVoiceCommandSelected() {
                Log.i(TAG, "Voice Command 2 triggered");
            }
        });

        sdlManager.getScreenManager().setVoiceCommands(Arrays.asList(voiceCommand1, voiceCommand2));

Also, verify that uploading voice commands work normally with each command having a unique string.

Core version / branch / commit hash / module tested against: 7.1.0 and Sync 3
HMI name / version / branch / commit hash / module tested against: generic_hmi 0.10.0, sdl_hmi 5.5.1

Summary

Added capability to VoiceCommandManager to check to make sure all voice commands are unique. If voice commands are not unique, it will print out an error message to the logs and return.

Changelog

Bug Fixes
  • Added missing capability to VoiceCommandManager to check to make sure all voice commands are unique. If voice commands are not unique, it will print out an error message to the logs and return.

CLA

@JulianKast JulianKast changed the base branch from master to develop May 5, 2021 17:26
@codecov
Copy link

codecov bot commented May 5, 2021

Codecov Report

Merging #1681 (6df490d) into develop (a0f080a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #1681      +/-   ##
=============================================
+ Coverage      53.94%   53.95%   +0.01%     
- Complexity      5307     5310       +3     
=============================================
  Files            555      555              
  Lines          24562    24572      +10     
  Branches        3101     3104       +3     
=============================================
+ Hits           13251    13259       +8     
- Misses         10160    10161       +1     
- Partials        1151     1152       +1     
Impacted Files Coverage Δ Complexity Δ
...om/smartdevicelink/streaming/StreamPacketizer.java 56.89% <100.00%> (ø) 12.00 <0.00> (ø)
.../managers/screen/menu/BaseVoiceCommandManager.java 65.95% <100.00%> (+4.05%) 15.00 <3.00> (+4.00)
...tdevicelink/streaming/video/RTPH264Packetizer.java 71.00% <100.00%> (ø) 28.00 <0.00> (ø)
...nk/managers/audio/AudioDecoderCompatOperation.java 75.00% <0.00%> (-4.55%) 9.00% <0.00%> (-1.00%)

@bilal-alsharifi bilal-alsharifi merged commit 4aa6a62 into develop May 10, 2021
@bilal-alsharifi bilal-alsharifi deleted the bugfix/issue_1677 branch May 10, 2021 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two voiceCommands contains the same string
2 participants