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

Skip to content
Commit d8ce8374 authored by Neil Fuller's avatar Neil Fuller
Browse files

Extract low level NITZ parsing logic

This change shrinks ServiceStateTracker by a
couple of hundred lines and improves
documentation and variable/field/method naming.

This change is a side-effect of work done to
understand the time / time zone detection logic
with a view to splitting it out from the rest of
the spralling ServiceStateTracker class.

It is likely possible to isolate time / time
zone logic but it will certainly involve
behavior changes. This is useful first step
to reduce the amount of code involved
without altering behavior.

NITZ parsing has been extracted into the static
NitzData.parse() method. NitzData is a state-holding
class that replaces three primitive fields on
ServiceStateTracker that store NITZ-derived data
and are always set together.

This change is a pure refactoring. No functional
changes are intended. The refactoring exposed
various unusual (probably unintended) cases that
were a consequence of using three, potentially
uninitialized, primitive fields to store saved
NITZ state rather than a reference type. Now that
the code can detect that NITZ data is not available
they become more obvious and expose cases that would
(for example) try to do time zone detection
with an offset == 0 and time == 0 and dst = false
(resulting in Africa/Abidjan being detected if it
ever runs).

Now the parsing / time zone lookup code is
separate it can be tested so tests have been
included here.

Tested with:
make google-tradefed-all FrameworksTelephonyTests
tradefed.sh run template/local_min --template:map test=FrameworksTelephonyTests

...and also, more quickly, with...

vogar --no-multidex --classpath \
    out/target/product/marlin/data/app/FrameworksTelephonyTests/FrameworksTelephonyTests.apk \
    com.android.internal.telephony.NitzDataTest

Bug: 63743683
Test: See above
Test: Booted device
Change-Id: Ie7004a7e67dff50b8271bdfe6d01111d7091dbe4
parent da3ce175
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment