History log of /frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/NitzDataTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a0f09cee0f6328ea104b9ef965a387b4a4652e8a 17-Dec-2017 Neil Fuller <nfuller@google.com> Move time zone lookup logic

Move time zone lookup logic into a separate TimeZoneLookupHelper which
can be independently tested and improved. Tests for all methods there
have been added / migrated & improved.

This also allows the lookup behavior to be mocked for NitzStateMachineTest
which has been adjusted accordingly. An additional test has been added
to demonstrate.

TimeStampedValue has been moved to a top-level class under util so
it can be used more widely and from tests.

Test: atest FrameworksTelephonyTests
Bug: 63743683
Change-Id: I2ff15b1355d5ba690198c5943bcb0faed17d8210
/frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/NitzDataTest.java
d8ce837499725b7eac7c5405d8fbf6c7cc27b774 10-Nov-2017 Neil Fuller <nfuller@google.com> 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
/frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/NitzDataTest.java