diff options
author | Henigan <rheniga1@MGC12Z921DLVCG.fbpld77.ford.com> | 2021-09-16 16:08:10 -0400 |
---|---|---|
committer | Henigan <rheniga1@MGC12Z921DLVCG.fbpld77.ford.com> | 2021-09-16 16:08:10 -0400 |
commit | 27184dbe65b9ebfb31f6fa4f4a8af85314394dd1 (patch) | |
tree | 3267949cbaddcb47c1eff4fb14c14e959e6f14c1 | |
parent | 83bf81c2b8f865c98b36baa10d036ec3318d1803 (diff) | |
parent | 0371f9f5bcbdcbecfd5fb643b9f8eba865de60c9 (diff) | |
download | sdl_android-bugfix/issue_1717_1718.tar.gz |
Merge branch 'bugfix/issue_1717_1718' of github.com:smartdevicelink/sdl_java_suite into bugfix/issue_1717_1718bugfix/issue_1717_1718
2 files changed, 10 insertions, 12 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperationTests.java index 2970fd2f0..0f3725f53 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperationTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperationTests.java @@ -41,7 +41,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashSet; -import java.util.List; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertFalse; diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperation.java index 730f816c8..4c9d5a3b5 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadPresentChoicesOperation.java @@ -40,7 +40,6 @@ import androidx.annotation.NonNull; import com.livio.taskmaster.Task; import com.smartdevicelink.managers.CompletionListener; import com.smartdevicelink.managers.ISdl; -import com.smartdevicelink.managers.ManagerUtility; import static com.smartdevicelink.managers.ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName; import static com.smartdevicelink.managers.ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName; import com.smartdevicelink.managers.file.FileManager; @@ -96,7 +95,7 @@ class PreloadPresentChoicesOperation extends Task { private boolean choiceError = false; private HashSet<ChoiceCell> loadedCells; private final ChoiceSet choiceSet; - //Start choiceId at 1 to ensure all HMIs handle it https://github.com/smartdevicelink/generic_hmi/commit/b292fbbec095b9ce11b520d47ec95b6fcff8e247 + // Start choiceId at 1 to ensure all HMIs handle it https://github.com/smartdevicelink/generic_hmi/commit/b292fbbec095b9ce11b520d47ec95b6fcff8e247 private static Integer choiceId = 1; private static Boolean reachedMaxIds = false; private static final int MAX_CHOICE_ID = 65535; @@ -547,12 +546,12 @@ class PreloadPresentChoicesOperation extends Task { Collections.sort(usedIds); ArrayList<Integer> sortedUsedIds = (ArrayList<Integer>) usedIds.clone(); - //Loop through the cells we need ids for. Get and assign those ids + // Loop through the cells we need ids for. Get and assign those ids for (int i = 0; i < cells.size(); i++) { int cellId = nextChoiceIdBasedOnUsedIds(sortedUsedIds); cells.get(i).setChoiceId(cellId); - //Insert the ids into the usedIds sorted array in the correct position + // Insert the ids into the usedIds sorted array in the correct position for (int j = 0; j < sortedUsedIds.size(); j++) { if (sortedUsedIds.get(j) > cellId) { sortedUsedIds.add(j, cellId); @@ -565,11 +564,11 @@ class PreloadPresentChoicesOperation extends Task { } } - //Find the next available choice is. Takes into account the loaded cells to ensure there are not duplicates + // Find the next available choice is. Takes into account the loaded cells to ensure there are not duplicates // @param usedIds The already loaded cell ids // @return The choice id between 0 - 65535, or Not Found if no cell ids were available private int nextChoiceIdBasedOnUsedIds(ArrayList<Integer> usedIds) { - //Check if we are entirely full, or if we've advanced beyond the max value, loop back + // Check if we are entirely full, or if we've advanced beyond the max value, loop back if (choiceId == MAX_CHOICE_ID) { choiceId = 1; reachedMaxIds = true; @@ -584,28 +583,28 @@ class PreloadPresentChoicesOperation extends Task { return choiceId; } - //If the last value isn't the max value, just keep grabbing towards the max value + // If the last value isn't the max value, just keep grabbing towards the max value int lastUsedId = usedIds.get(usedIds.size() - 1); if (lastUsedId < MAX_CHOICE_ID) { choiceId = lastUsedId + 1; return choiceId; } - //All our easy options are gone. Find and grab an empty slot from within the sorted list + // All our easy options are gone. Find and grab an empty slot from within the sorted list for (int i = 0; i < usedIds.size(); i++) { int loopId = usedIds.get(i); if (i != loopId) { - //This slot is open because the cell id does not match an open sorted slot + // This slot is open because the cell id does not match an open sorted slot choiceId = i; return choiceId; } } - //This *shouldn't* be possible + // This *shouldn't* be possible choiceId = MAX_CHOICE_ID; return choiceId; } else { - //We haven't looped all the way around yet, so we'll just take the current number, then advance the item + // We haven't looped all the way around yet, so we'll just take the current number, then advance the item return choiceId++; } } |