From b8f0bd20fd0aa6dee44ea49da3bb8fb8045b6714 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Tue, 12 Oct 2021 15:08:33 -0400 Subject: [PATCH] Remove instance fields from MobileSignalController MobileSignalController (MSC) was storing a few fields as instance members on itself, and thus would lose that historical information and make it so logs could not give the full picture of what the state was in the past This change makes a couple of changes to make things simpler: 1. Move all telephony data onto the MobileState object, making it so the full decision-making state object is stored at every historical level 2. Attach MobileState and MobileStatus directly so MobileState reads its fields directly from the update 3. Log only the used fields from ServiceState and SignalStrength Things are in a much better state here, but the next step should be to formalize the difference between the fields that get set directly from MobileStatus, and the ones that are updated in MSC#updateTelephony Test: atest SystemUITests Bug: 197851948 Change-Id: Ia35a13ee36b8e41b9ca86506de56f98de4891006 --- .../connectivity/MobileSignalController.java | 105 ++++++--------- .../statusbar/connectivity/MobileState.kt | 125 +++++++++++++++--- 2 files changed, 150 insertions(+), 80 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java index ddb3efe66a800..9ae7ea2bdded9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java @@ -33,7 +33,6 @@ import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; -import android.telephony.TelephonyDisplayInfo; import android.telephony.TelephonyManager; import android.telephony.ims.ImsException; import android.telephony.ims.ImsMmTelManager; @@ -47,7 +46,6 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.settingslib.AccessibilityContentDescriptions; import com.android.settingslib.SignalIcon.MobileIconGroup; -import com.android.settingslib.Utils; import com.android.settingslib.graph.SignalDrawable; import com.android.settingslib.mobile.MobileMappings.Config; import com.android.settingslib.mobile.MobileStatusTracker; @@ -89,15 +87,6 @@ public class MobileSignalController extends SignalController mNetworkToIconLookup; - // Since some pieces of the phone state are interdependent we store it locally, - // this could potentially become part of MobileState for simplification/complication - // of code. - private int mDataState = TelephonyManager.DATA_DISCONNECTED; - private TelephonyDisplayInfo mTelephonyDisplayInfo = - new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN, - TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE); - private ServiceState mServiceState; - private SignalStrength mSignalStrength; private int mLastLevel; private MobileIconGroup mDefaultIcons; private Config mConfig; @@ -464,16 +453,8 @@ public class MobileSignalController extends SignalController