Remove time compensation for bad NITZ offset info
Before this commit: When an NITZ signal has been received but at the time the country was unknown, when a country code becomes known..... ...if 1) The device has had a time zone explicitly set (i.e. this isn't the first boot) 2) The most recently received NITZ signal had: a) Either an empty "isDst" field or a "false" b) A zero offset from UTC 3) The country is known not to use UTC... ...the device would assume that the NITZ offset information it is receiving is incorrect in very specific way: It assumed that the NITZ time was in local time (not UTC as per NITZ spec) AND the time zone the device was currently using was correct. It would then attempt to set the device system clock by reversing out the assumed time zone adjustment from the UTC time. If the country code became know before NITZ was received the time would not be corrected in this way. The adjustment of the system clock results in verifiable issues for users: The assumption that the time signal is in local time is incorrect and leads to incorrect system clocks on devices. The usual cause of bad NITZ signals appears to be that the local offset information has been lost somehow or that the network has made a mistake about the offset. In these cases the user ends up with a bad system clock that is offset from UTC by the inverse of the offset for their zone. After this commit: If an NITZ signal is received before or after the country code is known and the offset information looks bogus it will not be used to set the time zone. This change has the side effect of making the code more consistent and independent of the order the information was received. Note: Devices that receive NITZ information containing bad offset information will still set the system clock using the UTC information from the NITZ signal. This change is removing untested behavior so there are no existing test changes. Existing tests run as before but more have been added. Historical info: The logic being remove was copied over to NitzStateMachine from ServiceStateTracker with a tweak to adjust the NITZ signal time, not the current system clock since it seemed more logical - the original logic would potentially keep adjusting the device system clock making it more and more incorrect. The time adjustment behavior was originally introduced to frameworks/opt/telephony ServiceStateTracker in commit 1a87ab3d. Before that, the logic was present in very early versions of Android. See commit df7bbfd7c in frameworks/base for some adjustments and commit 9066cfe (the first git commit) and com/android/internal/telephony/gsm/ServiceStateTracker.java. (See usages of GMT_COUNTRY_CODES). Test: atest FrameworksTelephonyTests:com.android.internal.telephony.NitzStateMachineTest Test: atest FrameworksTelephonyTests:com.android.internal.telephony.ServiceStateTrackerTest Bug: 69593701 Bug: 78217059 Change-Id: Idb6220629d07f3bdba9a1a16ad07a92485e0ba99
Loading
Please register or sign in to comment