[Provider Model] Add cutout for signal icon if the mobile data is disabled

Bug: 198233143
Test: manual, atest ProviderModelSliceHelperTest and SubscriptionsPreferenceControllerTest
Change-Id: I8714c9ff4c0c3aa5bad51ad5d41207d50ccca8ef
Merged-In: I3caefc7e1ca10dadcad114273edf35d9309502e1
(cherry picked from commit 3f46c5f685447b750cbd8515fe12085a95739c84)
Merged-In:I8714c9ff4c0c3aa5bad51ad5d41207d50ccca8ef
diff --git a/src/com/android/settings/network/ProviderModelSliceHelper.java b/src/com/android/settings/network/ProviderModelSliceHelper.java
index 32a475a..d264fd6 100644
--- a/src/com/android/settings/network/ProviderModelSliceHelper.java
+++ b/src/com/android/settings/network/ProviderModelSliceHelper.java
@@ -140,7 +140,7 @@
             numLevels += 1;
         }
         return MobileNetworkUtils.getSignalStrengthIcon(mContext, level, numLevels,
-                NO_CELL_DATA_TYPE_ICON, false);
+                NO_CELL_DATA_TYPE_ICON, !mTelephonyManager.isDataEnabled());
     }
 
     /**
diff --git a/src/com/android/settings/network/SubscriptionsPreferenceController.java b/src/com/android/settings/network/SubscriptionsPreferenceController.java
index 8e9e946..36c55e2 100644
--- a/src/com/android/settings/network/SubscriptionsPreferenceController.java
+++ b/src/com/android/settings/network/SubscriptionsPreferenceController.java
@@ -311,7 +311,8 @@
             numLevels += 1;
         }
 
-        Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels, false);
+        Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels,
+                !mTelephonyManager.isDataEnabled());
         final boolean isActiveCellularNetwork =
                 mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext);
         if (isActiveCellularNetwork || (mWifiPickerTrackerHelper != null)
diff --git a/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java b/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java
index 7d43230..d06426d 100644
--- a/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java
+++ b/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java
@@ -224,8 +224,9 @@
     public void getMobileDrawable_noCarrierData_getMobileDrawable() throws Throwable {
         mockConnections(false, ServiceState.STATE_OUT_OF_SERVICE, "",
                 false, true);
-        when(mConnectivityManager.getActiveNetwork()).thenReturn(null);
         Drawable expectDrawable = mock(Drawable.class);
+        when(mConnectivityManager.getActiveNetwork()).thenReturn(null);
+        when(mTelephonyManager.isDataEnabled()).thenReturn(false);
 
         assertThat(mProviderModelSliceHelper.getMobileDrawable(expectDrawable)).isEqualTo(
                 expectDrawable);
@@ -236,8 +237,9 @@
             throws Throwable {
         mockConnections(true, ServiceState.STATE_IN_SERVICE, "", true,
                 true);
-        addNetworkTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
         Drawable drawable = mock(Drawable.class);
+        addNetworkTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
+        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
 
         assertThat(mProviderModelSliceHelper.getMobileDrawable(drawable)).isEqualTo(
                 mDrawableWithSignalStrength);
@@ -252,6 +254,7 @@
                 true);
         Drawable drawable = mock(Drawable.class);
         addNetworkTransportType(NetworkCapabilities.TRANSPORT_WIFI);
+        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
 
         assertThat(mProviderModelSliceHelper.getMobileDrawable(drawable)).isEqualTo(
                 mDrawableWithSignalStrength);
diff --git a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
index cb78d19..7cffb76 100644
--- a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
@@ -665,6 +665,7 @@
         doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         Drawable icon = mock(Drawable.class);
+        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
         doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
         setupGetIconConditions(sub.get(0).getSubscriptionId(), true, true,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -683,6 +684,7 @@
         doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         Drawable icon = mock(Drawable.class);
+        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
         doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
         setupGetIconConditions(subId, false, true,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -701,7 +703,8 @@
         doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         Drawable icon = mock(Drawable.class);
-        doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
+        when(mTelephonyManager.isDataEnabled()).thenReturn(false);
+        doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(true));
 
         setupGetIconConditions(subId, false, false,
                 false, ServiceState.STATE_IN_SERVICE);