Avoid ANR of TetherPreferenceController

Off load the following work from main thread,
- Calculate title
- Calculate summery

This also helps improve the latency.

Also migrate to registerTetheringEventCallback() since
TetheringManager.ACTION_TETHER_STATE_CHANGED is deprecated.

Fix: 311848767
Test: manual - on Network & internet page and turn on / off tethering
Test: unit tests
Change-Id: I6ee182b41ef51f691ea31938142be1a41faf5573
This commit is contained in:
Chaohui Wang
2023-11-28 18:57:04 +08:00
parent 6a3a3e2ac7
commit 880068d23a
8 changed files with 461 additions and 524 deletions

View File

@@ -98,7 +98,6 @@ public class NetworkDashboardFragment extends DashboardFragment implements
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new MobileNetworkSummaryController(context, lifecycle, lifecycleOwner));
controllers.add(new TetherPreferenceController(context, lifecycle));
controllers.add(vpnPreferenceController);
if (internetPreferenceController != null) {
controllers.add(internetPreferenceController);