Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0219defc authored by Gary Dezern's avatar Gary Dezern Committed by Gary D
Browse files

fix automatic timezone failing on some GSM networks



in the code that parses the NITZ string, someone made the assumption that if
any data follows the DST flag, it must be be the android emulator appending
an actual timezone string in "Area!Location" format.  However, it seems that
some carriers or perhaps in some locations, the carrier sends an additional
field in the NITZ string.  For example, this is a string from AT&T:

12/07/01,09:37:43-16,01,310

The extra field is "310" above.  This patch will only assume that the field
in question is a textual timezone if and only if it contains an exclamation
point.  Otherwise, the extra field is ignored and the timezone is parsed
as it should be.

Change-Id: I6cc4278027a6de5545d76b803f5359923e60878a
Signed-off-by: default avatarGary Dezern <garyd9@gmail.com>
parent 9ba2de56
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1356,8 +1356,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            // As a special extension, the Android emulator appends the name of
            // the host computer's timezone to the nitz string. this is zoneinfo
            // timezone name of the form Area!Location or Area!Location!SubLocation
            // so we need to convert the ! into /
            if (nitzSubs.length >= 9) {
            // so we need to convert the ! into /.  If there's no "!", then maybe
            // the carrier is appending something extra (as AT&T does) and it
            // should be ignored
            if ((nitzSubs.length >= 9) && (nitzSubs[8].indexOf('!') != -1)) {
                String  tzname = nitzSubs[8].replace('!','/');
                zone = TimeZone.getTimeZone( tzname );
            }