OSDN Git Service

Fix crash in time zone picker due to race condition on view updates
authorVictor Chang <vichang@google.com>
Sat, 24 Mar 2018 18:07:50 +0000 (18:07 +0000)
committerVictor Chang <vichang@google.com>
Tue, 27 Mar 2018 09:31:54 +0000 (09:31 +0000)
commit201c629fcc1ea6b40b122563406edcb433301bbb
tree5f2315565bbbf7249e0680d1f6d189d36bb0468d
parentd7ea524e819932413f690fbcc032ac0541263764
Fix crash in time zone picker due to race condition on view updates

- Can't reproduce the race condition with manual test, probably the view
  updates are fast enough that only monkey test can reproduce the issue.
- Reproduced a similar stacktrace and IndexOutOfBoundsException with
  Robolectric test by assuming that the race condition happens after
  text filtering and view updates. Try to fix the bug with this assumption
- The fix is to bind the data (data position in adapter) with ViewHolder.

Bug: 75322108
Test: m RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.datetime.timezone
Change-Id: Ie5d932bce30590b8067e042c3380911c9608872f
src/com/android/settings/datetime/timezone/BaseTimeZoneAdapter.java
src/com/android/settings/datetime/timezone/BaseTimeZoneInfoPicker.java
src/com/android/settings/datetime/timezone/BaseTimeZonePicker.java
src/com/android/settings/datetime/timezone/RegionSearchPicker.java
tests/robotests/src/com/android/settings/datetime/timezone/RegionSearchPickerTest.java