Avoid Calendar's unexpect change in snapToCycleDay()
Symptom: Calendar object's certain field is unexpectedly changed after using Calendar.add() method. Detail and sample: Following patch causes this issue. - Switch network cycle calculation to use Calendar. https://android.googlesource.com/platform/frameworks/base/+/f2bead5 Call of Calendar.add() method might make a smaller field value invariant. The smaller field means such a field of Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and so on if Calendar.MONTH field is focused. According to above, sometimes correct Calendar value won't be acquired by original code. To avoid unexpected change, it requires initialization toward each smaller field after Calendar.add() call. Solutions: Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, and Calendar.SECOND fields is set to 0 after added value to Calendar.MONTH field. Bug: 32724903 Author: Shigeki Yokomichi <shigeki.x.yokomichi@sonymobile.com> Change-Id: I7af6391653be21786b662b2f8eaad10c413733c1
Loading
Please register or sign in to comment