Skip to content
Commit 1e79aacc authored by Evan Laird's avatar Evan Laird
Browse files

[Sb refactor] Remove the concept of `isDefault`

I feel like this CL deserves some introspection as to what is going on.

INTRO

The old pipeline has two main concepts that it tracks when it comes to
knowing which subscription is special: `active` and `default`. They come
from static methods on `SubscriptionManager`: getActiveDataSubscriptionId
and getDefaultDataSubscriptionId.

The old pipeline will map from `networkType` to icon group except for
the following cases. For each subscription:

  1. When !telephonyManager.isDataConnectionAllowed (!dataEnabled) AND
     the defaultDataSubId is not the current subscription, set the
     MobileIconGroup to NOT_DEFAULT_DATA.
  2. When !dataEnabled AND this is the defaultDataSubId, set the
     MobileIconGroup to DATA_DISABLED.

Note that neither of these icon groups represent icons, they have a
resId of 0, meaning that later on when it comes time to use them, they
will _not_ show any UI on screen, nor will their content descriptions be
used. Also note that this is just system state stored in an UI view
model-like class.

THE PROBLEM

So, the question becomes: what do we do with these two mobile icon
groups in the new pipeline? Do we use the same input logic as the old
pipeline and thread these two special-case MobileIconGroups through the
MobileIconInteractor and then filter them out at the View Model? Or can
we rework the system to be smarter?

THIS CHANGE

Note that from the intro we stated that both of these cases only apply
when telephony reports `false` for `isDataConnectionAllowed`. Only
_then_ does the old pipeline do anything with these icon groups. This
means that as far as the UI is concerned, NOT_DEFAULT_DATA and
DATA_DISABLED are equivalent (showing no UI). The only time that
NOT_DEFAULT_DATA comes into play is when determining when to show the
exclamation mark.

Side note, there is a related bug in the old pipeline about checking
NOT_DEFAULT_DATA. When NetworkControllerIpml is attempting to find out
which controller is the data controller, it checks against the _active_
data subscriptio ID vs the _default_. This probably doesn't account for
a huge amount of bugs, but it's worth mentioning this problem.

With all of that out of the way, this change is rather simple: *remove
the concept of `isDefault` from the pipeline*. The only thing we need to
track is whether or not to show the data icon. The only remaining
relevant piece to track was the exclamation mark on the triangle, but
that field is covered elsewhere by a more appropriately-named field
tracking the active data.

Test: MobileIconInteractorTest
Test: MobileIconViewModelTest
Bug: 274724674
Bug: 270621876

Change-Id: I508a87e597cda5f9351053266701ebec84a0bcc3
parent 21a25876
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