From 35803a3b036bd5e1d8d3b6a911bfe3a4af5feecc Mon Sep 17 00:00:00 2001 From: Zoey Chen Date: Tue, 31 Aug 2021 15:50:49 +0800 Subject: [PATCH] [Provider Model] Add a cutout for signal icon if the mobilde data is disabled Screenshot: https://screenshot.googleplex.com/57wPkj9pq9hP5WA.png Bug: 198233143 Test: manual, atest SubscriptionsPreferenceControllerTest Change-Id: I3caefc7e1ca10dadcad114273edf35d9309502e1 --- .../settings/network/SubscriptionsPreferenceController.java | 3 ++- .../network/SubscriptionsPreferenceControllerTest.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/network/SubscriptionsPreferenceController.java b/src/com/android/settings/network/SubscriptionsPreferenceController.java index 8e9e946820c..36c55e2805e 100644 --- a/src/com/android/settings/network/SubscriptionsPreferenceController.java +++ b/src/com/android/settings/network/SubscriptionsPreferenceController.java @@ -311,7 +311,8 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl 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/SubscriptionsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java index cb78d19714c..7cffb76f983 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 @@ public class SubscriptionsPreferenceControllerTest { 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 @@ public class SubscriptionsPreferenceControllerTest { 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 @@ public class SubscriptionsPreferenceControllerTest { 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);