Skip to content

Commit 6a50d93

Browse files
HeniganHenigan
authored andcommitted
Fix uniqueness behavior
1 parent ec43049 commit 6a50d93

3 files changed

Lines changed: 1 addition & 14 deletions

File tree

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ public void onError(String error) {
154154
ChoiceSet choiceSet1 = new ChoiceSet("test", Collections.<ChoiceCell>emptyList(), choiceSetSelectionListener);
155155
assertFalse(csm.setUpChoiceSet(choiceSet1));
156156

157-
// Identical cells will not be allowed
158-
ChoiceCell cell1 = new ChoiceCell("test");
159-
ChoiceCell cell2 = new ChoiceCell("test");
160-
ChoiceSet choiceSet2 = new ChoiceSet("test", Arrays.asList(cell1, cell2), choiceSetSelectionListener);
161-
assertFalse(csm.setUpChoiceSet(choiceSet2));
162-
163157
// cells that have duplicate text will be allowed if there is another property to make them unique because a unique name will be assigned and used
164158
ChoiceCell cell3 = new ChoiceCell("test");
165159
cell3.setSecondaryText("text 1");

base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,11 @@ boolean setUpChoiceSet(ChoiceSet choiceSet) {
589589
}
590590
}
591591

592-
HashSet<ChoiceCell> uniqueChoiceCells = new HashSet<>();
593592
HashSet<String> uniqueVoiceCommands = new HashSet<>();
594593
int allVoiceCommandsCount = 0;
595594
int choiceCellWithVoiceCommandCount = 0;
596595

597596
for (ChoiceCell cell : choices) {
598-
uniqueChoiceCells.add(cell);
599597
// Not using cloned cell here because we set the clone's VoiceCommands to null for visual check only
600598
if (cell.getVoiceCommands() != null) {
601599
uniqueVoiceCommands.addAll(cell.getVoiceCommands());
@@ -604,11 +602,6 @@ boolean setUpChoiceSet(ChoiceSet choiceSet) {
604602
}
605603
}
606604

607-
if (uniqueChoiceCells.size() != choices.size()) {
608-
DebugTool.logError(TAG, "Attempted to create a choice set with a duplicate cell. Cell must have a unique value other than its primary text. The choice set will not be set.");
609-
return false;
610-
}
611-
612605
// All or none of the choices MUST have VR Commands
613606
if (choiceCellWithVoiceCommandCount > 0 && choiceCellWithVoiceCommandCount < choices.size()) {
614607
DebugTool.logError(TAG, "If using voice recognition commands, all of the choice set cells must have unique VR commands. There are " + uniqueVoiceCommands.size() + " cells with unique voice commands and " + choices.size() + " total cells. The choice set will not be set.");

base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ void makeCellsToUploadUnique() {
617617

618618
ArrayList<ChoiceCell> strippedCellsToUpload = cloneChoiceCellList(this.cellsToUpload);
619619
ArrayList<ChoiceCell> strippedLoadedCells = cloneChoiceCellList(new ArrayList<>(loadedCells));
620-
boolean supportsChoiceUniqueness = !(sdlMsgVersion.getMinorVersion() < 7 || (sdlMsgVersion.getMajorVersion() == 7 && sdlMsgVersion.getMinorVersion() == 0));
620+
boolean supportsChoiceUniqueness = !(sdlMsgVersion.getMajorVersion() < 7 || (sdlMsgVersion.getMajorVersion() == 7 && sdlMsgVersion.getMinorVersion() == 0));
621621
if (supportsChoiceUniqueness) {
622622
removeUnusedProperties(strippedCellsToUpload);
623623
removeUnusedProperties(strippedLoadedCells);

0 commit comments

Comments
 (0)