Align time zone + other country detection logic
This commit contains several changes to simplify country detection logic and make it consistent for time zone detection and other use cases: 1) Change Ie3ec6768ffe924dd0be3e91a64dac32dacebe50b had removed some of the behavior that had led to time zone detection country detection being handled separately, i.e. time zone detection never wanted to use the country derived from the SIM. Apparently it was causing problems for other usecases as well and was removed. 2) Change I17ad7cd7691e02d65714ca727b0e8c4def220e42 introduced handling for when the radio was off. This is logic that should probably also have been applied to the time zone detection country detection logic too but wasn't probably contributing to bug 227047106. Bug 227047106 meant that a country code was passed to the time zone detection logic rather than it making a handleCountryUnknown() call. 3) The code that first tries to obtain the country from the operator numeric did not use the MCC+MNC country lookup code. This was probably an oversight. 4) The code that tries to obtain the country from the nearby cell towers would only consider the MCC+MNC combination for time zone detection purposes. This change switches to using the MCC+MNC lookup for all cases. The MCC+MNC country code lookup in (3) and (4) only matches a small number of combinations today (see telephonylookup.xml in system/timezone for the special cases). When there no match is found using the MCC+MNC combination, the code will fall back to using the MCC, retaining the prior behavior in the majority of cases. After these changes, the logic for country code detection for time zone and for other purposes are more similar: the only difference remaining is the MCC 001 (test cell) handling to keep various TA tests associated with time zone detection working. Test: atest ./tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java Bug: 227047106 Change-Id: I2e11747d2cbbc59591e1f6b63bec969144bfe6f9
Loading
Please register or sign in to comment