diff --git a/packages/SystemUI/res/drawable/stat_sys_roaming_large.xml b/packages/SystemUI/res/drawable/stat_sys_roaming_large.xml new file mode 100644 index 0000000000000..1511659ea42f3 --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_roaming_large.xml @@ -0,0 +1,24 @@ + + + + diff --git a/packages/SystemUI/res/layout/mobile_signal_group.xml b/packages/SystemUI/res/layout/mobile_signal_group.xml index bfd079b59054a..5552020f22cbe 100644 --- a/packages/SystemUI/res/layout/mobile_signal_group.xml +++ b/packages/SystemUI/res/layout/mobile_signal_group.xml @@ -77,4 +77,11 @@ android:contentDescription="@string/data_connection_roaming" android:visibility="gone" /> + diff --git a/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml b/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml index 42d541e3afc9a..10d49b38ae750 100644 --- a/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml +++ b/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml @@ -85,6 +85,13 @@ android:contentDescription="@string/data_connection_roaming" android:visibility="gone" /> + diff --git a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java index 39b92dc4f6628..7d8d86fe691e4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java +++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.ColorStateList; import android.text.TextUtils; import android.util.AttributeSet; +import android.util.FeatureFlagUtils; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; @@ -65,10 +66,13 @@ public class QSCarrier extends LinearLayout { super.onFinishInflate(); mDualToneHandler = new DualToneHandler(getContext()); mMobileGroup = findViewById(R.id.mobile_combo); + if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) { + mMobileRoaming = findViewById(R.id.mobile_roaming_large); + } else { + mMobileRoaming = findViewById(R.id.mobile_roaming); + } mMobileSignal = findViewById(R.id.mobile_signal); - mMobileRoaming = findViewById(R.id.mobile_roaming); mCarrierText = findViewById(R.id.qs_carrier_text); - mMobileSignal.setImageDrawable(new SignalDrawable(mContext)); int colorForeground = Utils.getColorAttrDefaultColor(mContext, diff --git a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java index ebdcc0006dcef..77200ccaf5cb2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java @@ -71,7 +71,7 @@ public class QSCarrierGroupController { boolean activityIn, boolean activityOut, CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, CharSequence description, - boolean isWide, int subId, boolean roaming) { + boolean isWide, int subId, boolean roaming, boolean showTriangle) { int slotIndex = getSlotIndex(subId); if (slotIndex >= SIM_SLOTS) { Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex); 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 f742752d80be9..720c5dc7026f6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -268,7 +268,7 @@ public class CellularTile extends QSTileImpl { int qsType, boolean activityIn, boolean activityOut, CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, CharSequence description, - boolean isWide, int subId, boolean roaming) { + boolean isWide, int subId, boolean roaming, boolean showTriangle) { if (qsIcon == null) { // Not data sim, don't display. return; 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 15232789cc64a..5e1ca294c0e37 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java @@ -249,7 +249,7 @@ public class InternetTile extends QSTileImpl { int qsType, boolean activityIn, boolean activityOut, CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, CharSequence description, - boolean isWide, int subId, boolean roaming) { + boolean isWide, int subId, boolean roaming, boolean showTriangle) { if (DEBUG) { Log.d(TAG, "setMobileDataIndicators: " + "statusIcon = " + (statusIcon == null ? "" : statusIcon.toString()) + "," @@ -263,7 +263,8 @@ public class InternetTile extends QSTileImpl { + "description = " + description + "," + "isWide = " + isWide + "," + "subId = " + subId + "," - + "roaming = " + roaming); + + "roaming = " + roaming + "," + + "showTriangle = " + showTriangle); } if (qsIcon == null) { // Not data sim, don't display. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java index 239addd4ee1d1..d562726681f13 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java @@ -27,6 +27,7 @@ import android.content.res.ColorStateList; import android.graphics.Color; import android.graphics.Rect; import android.util.AttributeSet; +import android.util.FeatureFlagUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -64,7 +65,6 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver, LayoutInflater inflater = LayoutInflater.from(context); StatusBarMobileView v = (StatusBarMobileView) inflater.inflate(R.layout.status_bar_mobile_signal_group, null); - v.setSlot(slot); v.init(); v.setVisibleState(STATE_ICON); @@ -104,7 +104,11 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver, mMobileGroup = findViewById(R.id.mobile_group); mMobile = findViewById(R.id.mobile_signal); mMobileType = findViewById(R.id.mobile_type); - mMobileRoaming = findViewById(R.id.mobile_roaming); + if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) { + mMobileRoaming = findViewById(R.id.mobile_roaming_large); + } else { + mMobileRoaming = findViewById(R.id.mobile_roaming); + } mMobileRoamingSpace = findViewById(R.id.mobile_roaming_space); mIn = findViewById(R.id.mobile_in); mOut = findViewById(R.id.mobile_out); @@ -160,7 +164,7 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver, } else { mMobileType.setVisibility(View.GONE); } - + mMobile.setVisibility(mState.showTriangle ? View.VISIBLE : View.GONE); mMobileRoaming.setVisibility(mState.roaming ? View.VISIBLE : View.GONE); mMobileRoamingSpace.setVisibility(mState.roaming ? View.VISIBLE : View.GONE); mIn.setVisibility(mState.activityIn ? View.VISIBLE : View.GONE); @@ -191,6 +195,7 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver, } } + mMobile.setVisibility(state.showTriangle ? View.VISIBLE : View.GONE); mMobileRoaming.setVisibility(state.roaming ? View.VISIBLE : View.GONE); mMobileRoamingSpace.setVisibility(state.roaming ? View.VISIBLE : View.GONE); mIn.setVisibility(state.activityIn ? View.VISIBLE : View.GONE); @@ -200,7 +205,8 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver, needsLayout |= state.roaming != mState.roaming || state.activityIn != mState.activityIn - || state.activityOut != mState.activityOut; + || state.activityOut != mState.activityOut + || state.showTriangle != mState.showTriangle; mState = state; return needsLayout; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java index d11e8641f987f..5f90077640ec6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java @@ -221,7 +221,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba int qsType, boolean activityIn, boolean activityOut, CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, CharSequence description, - boolean isWide, int subId, boolean roaming) { + boolean isWide, int subId, boolean roaming, boolean showTriangle) { if (DEBUG) { Log.d(TAG, "setMobileDataIndicators: " + "statusIcon = " + (statusIcon == null ? "" : statusIcon.toString()) + "," @@ -235,7 +235,8 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba + "description = " + description + "," + "isWide = " + isWide + "," + "subId = " + subId + "," - + "roaming = " + roaming); + + "roaming = " + roaming + "," + + "showTriangle = " + showTriangle); } MobileIconState state = getState(subId); if (state == null) { @@ -250,6 +251,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba state.typeId = statusType; state.contentDescription = statusIcon.contentDescription; state.typeContentDescription = typeContentDescription; + state.showTriangle = showTriangle; state.roaming = roaming; state.activityIn = activityIn && mActivityEnabled; state.activityOut = activityOut && mActivityEnabled; @@ -551,6 +553,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba public int subId; public int strengthId; public int typeId; + public boolean showTriangle; public boolean roaming; public boolean needsLeadingPadding; public CharSequence typeContentDescription; @@ -569,20 +572,21 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba return false; } MobileIconState that = (MobileIconState) o; - return subId == that.subId && - strengthId == that.strengthId && - typeId == that.typeId && - roaming == that.roaming && - needsLeadingPadding == that.needsLeadingPadding && - Objects.equals(typeContentDescription, that.typeContentDescription); + return subId == that.subId + && strengthId == that.strengthId + && typeId == that.typeId + && showTriangle == that.showTriangle + && roaming == that.roaming + && needsLeadingPadding == that.needsLeadingPadding + && Objects.equals(typeContentDescription, that.typeContentDescription); } @Override public int hashCode() { return Objects - .hash(super.hashCode(), subId, strengthId, typeId, roaming, needsLeadingPadding, - typeContentDescription); + .hash(super.hashCode(), subId, strengthId, typeId, showTriangle, roaming, + needsLeadingPadding, typeContentDescription); } public MobileIconState copy() { @@ -596,6 +600,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba other.subId = subId; other.strengthId = strengthId; other.typeId = typeId; + other.showTriangle = showTriangle; other.roaming = roaming; other.needsLeadingPadding = needsLeadingPadding; other.typeContentDescription = typeContentDescription; @@ -613,8 +618,9 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba } @Override public String toString() { - return "MobileIconState(subId=" + subId + ", strengthId=" + strengthId + ", roaming=" - + roaming + ", typeId=" + typeId + ", visible=" + visible + ")"; + return "MobileIconState(subId=" + subId + ", strengthId=" + strengthId + + ", showTriangle=" + showTriangle + ", roaming=" + roaming + + ", typeId=" + typeId + ", visible=" + visible + ")"; } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java index 5e88cd5c2423c..08a4492fc15dc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java @@ -124,12 +124,13 @@ public class CallbackHandler extends Handler implements EmergencyListener, Signa final int statusType, final int qsType, final boolean activityIn, final boolean activityOut, final CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, final CharSequence description, - final boolean isWide, final int subId, boolean roaming) { + final boolean isWide, final int subId, boolean roaming, boolean showTriangle) { post(() -> { for (SignalCallback signalCluster : mSignalCallbacks) { signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType, activityIn, activityOut, typeContentDescription, - typeContentDescriptionHtml, description, isWide, subId, roaming); + typeContentDescriptionHtml, description, isWide, subId, roaming, + showTriangle); } }); } 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 2f66508dafee7..39472ded4a3f8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -284,13 +284,15 @@ public class MobileSignalController extends SignalController, D * @param isWide //TODO: unused? * @param subId subscription ID for which to update the UI * @param roaming indicates roaming + * @param showTriangle whether to show the mobile triangle the in status bar */ default void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, int qsType, boolean activityIn, boolean activityOut, CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, CharSequence description, - boolean isWide, int subId, boolean roaming) { + boolean isWide, int subId, boolean roaming, boolean showTriangle) { } default void setSubs(List subs) {} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java index 7042e2f9e1021..9669522675ac7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java @@ -150,7 +150,7 @@ public class WifiSignalController extends callback.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon, mCurrentState.activityIn, mCurrentState.activityOut, dataContentDescription, dataContentDescriptionHtml, description, icons.isWide, - mCurrentState.subId, /* roaming= */ false); + mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true); } private int getCurrentIconIdForCarrierWifi() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java index 8a412bff03ac6..b452d3a79814b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java @@ -218,7 +218,7 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest { mSignalCallback.setMobileDataIndicators( mock(NetworkController.IconState.class), mock(NetworkController.IconState.class), - 0, 0, true, true, "", "", "", true, 0, true); + 0, 0, true, true, "", "", "", true, 0, true, true); } @Test 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 ebc45f41ce617..c212cf3ee769e 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 @@ -125,7 +125,7 @@ public class CallbackHandlerTest extends SysuiTestCase { int subId = 5; boolean roaming = true; mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription, - typeDescriptionHtml, description, wide, subId, roaming); + typeDescriptionHtml, description, wide, subId, roaming, true); waitForCallbacks(); ArgumentCaptor statusArg = ArgumentCaptor.forClass(IconState.class); @@ -143,7 +143,7 @@ public class CallbackHandlerTest extends SysuiTestCase { Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(), qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(), outArg.capture(), typeContentArg.capture(), typeContentHtmlArg.capture(), - descArg.capture(), wideArg.capture(), subIdArg.capture(), eq(roaming)); + descArg.capture(), wideArg.capture(), subIdArg.capture(), eq(roaming), eq(true)); assertEquals(status, statusArg.getValue()); assertEquals(qs, qsArg.getValue()); assertEquals(type, (int) typeIconArg.getValue()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java index deabcbe520b61..da1f5d3928721 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java @@ -489,7 +489,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase { anyInt(), typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(), any(CharSequence.class), any(CharSequence.class), any(CharSequence.class), - anyBoolean(), anyInt(), anyBoolean()); + anyBoolean(), anyInt(), anyBoolean(), anyBoolean()); IconState iconState = iconArg.getValue(); int state = SignalDrawable.getState(icon, CellSignalStrength.getNumSignalStrengthLevels(), false); @@ -523,7 +523,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase { typeIconArg.capture(), anyInt(), anyBoolean(), anyBoolean(), any(CharSequence.class), any(CharSequence.class), any(), - anyBoolean(), anyInt(), eq(roaming)); + anyBoolean(), anyInt(), eq(roaming), anyBoolean()); IconState iconState = iconArg.getValue(); int state = icon == -1 ? 0 : SignalDrawable.getState(icon, CellSignalStrength.getNumSignalStrengthLevels(), @@ -544,7 +544,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase { typeIconArg.capture(), anyInt(), anyBoolean(), anyBoolean(), any(CharSequence.class), any(CharSequence.class), any(), - anyBoolean(), anyInt(), anyBoolean()); + anyBoolean(), anyInt(), anyBoolean(), anyBoolean()); IconState iconState = iconArg.getValue(); int state = SignalDrawable.getState( level, CellSignalStrength.getNumSignalStrengthLevels(), !inet); @@ -591,7 +591,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase { dataOutArg.capture(), typeContentDescriptionArg.capture(), typeContentDescriptionHtmlArg.capture(), - any(), anyBoolean(), anyInt(), anyBoolean()); + any(), anyBoolean(), anyInt(), anyBoolean(), anyBoolean()); IconState iconState = iconArg.getValue(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java index 2b82f66cb4c20..10166cb0c43f2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java @@ -134,7 +134,7 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest { // Still be on wifi though. setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_WIFI, true, true); setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false); - verifyLastMobileDataIndicators(false, DEFAULT_LEVEL, 0, true); + verifyLastMobileDataIndicators(true, DEFAULT_LEVEL, 0, true); } @Test