From 1b3972d7f81f65abdfade8cf3e394ac83a9c350f Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Thu, 2 Sep 2021 17:24:07 -0400 Subject: [PATCH] Create QsInfo and SbInfo boxes for MobileSignalController Simplify MobileSignalController#notifyListeners() by splitting the QS and SB portions of the method into their own *Info objects and moving those calls out to their own methods. Also adds mNetworkToIconLookup, mProviderModelBehavior, and mProviderModelSetting to the MobileSignalController logs. Test: dumpsys Bug 197851948 Change-Id: Ibdaec230c4a407d23804fb8250809cc877a7f183 Merged-In: Ibdaec230c4a407d23804fb8250809cc877a7f183 --- .../com/android/settingslib/SignalIcon.java | 8 +- .../systemui/qs/tiles/CellularTile.java | 2 +- .../systemui/qs/tiles/InternetTile.java | 6 +- .../policy/MobileSignalController.java | 172 ++++++++++-------- .../statusbar/policy/NetworkController.java | 20 +- .../statusbar/policy/CallbackHandlerTest.java | 2 +- 6 files changed, 119 insertions(+), 91 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/SignalIcon.java b/packages/SettingsLib/src/com/android/settingslib/SignalIcon.java index 383e726c69c7c..794b0eb665199 100644 --- a/packages/SettingsLib/src/com/android/settingslib/SignalIcon.java +++ b/packages/SettingsLib/src/com/android/settingslib/SignalIcon.java @@ -239,6 +239,11 @@ public class SignalIcon { return dataConnected && !carrierNetworkChangeMode && activityOut; } + /** @return true if this state should show a RAT icon in quick settings */ + public boolean showQuickSettingsRatIcon() { + return dataConnected || isDataDisabledOrNotDefault(); + } + @Override protected void toString(StringBuilder builder) { super.toString(builder); @@ -254,7 +259,8 @@ public class SignalIcon { builder.append("carrierNetworkChangeMode=").append(carrierNetworkChangeMode) .append(','); builder.append("userSetup=").append(userSetup).append(','); - builder.append("defaultDataOff=").append(defaultDataOff); + builder.append("defaultDataOff=").append(defaultDataOff).append(','); + builder.append("showQuickSettingsRatIcon=").append(showQuickSettingsRatIcon()); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index 8e886e82d352c..b1af8416e06d6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -275,7 +275,7 @@ public class CellularTile extends QSTileImpl { return; } mInfo.dataSubscriptionName = mController.getMobileDataNetworkName(); - mInfo.dataContentDescription = indicators.description != null + mInfo.dataContentDescription = indicators.qsDescription != null ? indicators.typeContentDescriptionHtml : null; mInfo.activityIn = indicators.activityIn; mInfo.activityOut = indicators.activityOut; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java index cc9e7485dcffa..530804ed09e7e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java @@ -279,9 +279,9 @@ public class InternetTile extends QSTileImpl { // Not data sim, don't display. return; } - mCellularInfo.mDataSubscriptionName = indicators.description == null - ? mController.getMobileDataNetworkName() : indicators.description; - mCellularInfo.mDataContentDescription = indicators.description != null + mCellularInfo.mDataSubscriptionName = indicators.qsDescription == null + ? mController.getMobileDataNetworkName() : indicators.qsDescription; + mCellularInfo.mDataContentDescription = indicators.qsDescription != null ? indicators.typeContentDescriptionHtml : null; mCellularInfo.mMobileSignalIconId = indicators.qsIcon.icon; mCellularInfo.mQsTypeIcon = indicators.qsType; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index 9f59b094ef138..a543c7c95d16f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -385,92 +385,82 @@ public class MobileSignalController extends SignalController, D .append(",qsIcon=").append(qsIcon == null ? "" : qsIcon.toString()) .append(",activityIn=").append(activityIn) .append(",activityOut=").append(activityOut) - .append(",description=").append(description) + .append(",qsDescription=").append(description) .append(",isTransient=").append(isTransient) .append(",statusLabel=").append(statusLabel) .append(']').toString(); @@ -100,7 +100,7 @@ public interface NetworkController extends CallbackController, D public boolean activityOut; public CharSequence typeContentDescription; public CharSequence typeContentDescriptionHtml; - public CharSequence description; + public CharSequence qsDescription; public int subId; public boolean roaming; public boolean showTriangle; @@ -108,7 +108,7 @@ public interface NetworkController extends CallbackController, D public MobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, int qsType, boolean activityIn, boolean activityOut, CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, - CharSequence description, int subId, boolean roaming, + CharSequence qsDescription, int subId, boolean roaming, boolean showTriangle) { this.statusIcon = statusIcon; this.qsIcon = qsIcon; @@ -118,7 +118,7 @@ public interface NetworkController extends CallbackController, D this.activityOut = activityOut; this.typeContentDescription = typeContentDescription; this.typeContentDescriptionHtml = typeContentDescriptionHtml; - this.description = description; + this.qsDescription = qsDescription; this.subId = subId; this.roaming = roaming; this.showTriangle = showTriangle; @@ -135,7 +135,7 @@ public interface NetworkController extends CallbackController, D .append(",activityOut=").append(activityOut) .append(",typeContentDescription=").append(typeContentDescription) .append(",typeContentDescriptionHtml=").append(typeContentDescriptionHtml) - .append(",description=").append(description) + .append(",description=").append(qsDescription) .append(",subId=").append(subId) .append(",roaming=").append(roaming) .append(",showTriangle=").append(showTriangle) @@ -183,11 +183,13 @@ public interface NetworkController extends CallbackController, D default void setCallIndicator(IconState statusIcon, int subId) {} } - public interface EmergencyListener { + /** */ + interface EmergencyListener { void setEmergencyCallsOnly(boolean emergencyOnly); } - public static class IconState { + /** */ + class IconState { public final boolean visible; public final int icon; public final String contentDescription; @@ -217,7 +219,7 @@ public interface NetworkController extends CallbackController, D * Tracks changes in access points. Allows listening for changes, scanning for new APs, * and connecting to new ones. */ - public interface AccessPointController { + interface AccessPointController { void addAccessPointCallback(AccessPointCallback callback); void removeAccessPointCallback(AccessPointCallback callback); void scanForAccessPoints(); @@ -227,7 +229,7 @@ public interface NetworkController extends CallbackController, D boolean canConfigWifi(); boolean canConfigMobileData(); - public interface AccessPointCallback { + interface AccessPointCallback { void onAccessPointsChanged(List accessPoints); void onSettingsActivityTriggered(Intent settingsIntent); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java index 73538fbc7bc54..3c55df934f76a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java @@ -141,7 +141,7 @@ public class CallbackHandlerTest extends SysuiTestCase { assertEquals(out, expected.activityOut); assertEquals(typeDescription, expected.typeContentDescription); assertEquals(typeDescriptionHtml, expected.typeContentDescriptionHtml); - assertEquals(description, expected.description); + assertEquals(description, expected.qsDescription); assertEquals(subId, expected.subId); assertTrue(expected.roaming); assertTrue(expected.showTriangle);