This patch replace some SparseArray<Integer> with SparseIntArray, and
simplify a value lookup function by using indexOfValue().
Test: TODO
Bug: 37013369, 33298084
Bug: 38503832
(cherry picked from commit d2552aee11)
Change-Id: Ifbe4f01bad8964e6f3a6e9633415959ab5feb0af