Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index ab1c437..1a21b55 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -55,6 +55,7 @@
 import com.android.settings.datausage.DataSaverBackend;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.wifi.tether.WifiTetherPreferenceController;
+import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.RestrictedSwitchPreference;
 import com.android.settingslib.TetherUtil;
 import com.android.settingslib.search.SearchIndexable;
@@ -425,14 +426,16 @@
 
     private void updateUsbPreference() {
         boolean usbAvailable = mUsbConnected && !mMassStorageActive;
+        final RestrictedLockUtils.EnforcedAdmin enforcedAdmin =
+                checkIfUsbDataSignalingIsDisabled(mContext, UserHandle.myUserId());
 
-        if (usbAvailable) {
+        if (enforcedAdmin != null) {
+            mUsbTether.setDisabledByAdmin(enforcedAdmin);
+        } else if (usbAvailable) {
             mUsbTether.setEnabled(!mDataSaverEnabled);
         } else {
             mUsbTether.setEnabled(false);
         }
-        mUsbTether.setDisabledByAdmin(
-                checkIfUsbDataSignalingIsDisabled(mContext, UserHandle.myUserId()));
     }
 
     @VisibleForTesting
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);