From 2ff209779f62c07535d3482fc287c62f527dfa0b Mon Sep 17 00:00:00 2001 From: Chandru Date: Wed, 28 Sep 2022 11:38:15 +0000 Subject: [PATCH] Remove parameter that is always false and never used in the method. Bug: 249467771 Test: atest KeyguardUpdateMonitorTest Test: atest CarrierTextManagerTest Merged-In: Ia59a1723e8462c43ee53e66a9932eb6a451ef5ca Change-Id: Ia59a1723e8462c43ee53e66a9932eb6a451ef5ca --- .../android/keyguard/CarrierTextManager.java | 2 +- .../keyguard/KeyguardUpdateMonitor.java | 2 +- .../dialog/InternetDialogController.java | 2 +- .../policy/EmergencyCryptkeeperText.java | 2 +- .../keyguard/CarrierTextManagerTest.java | 27 +++++++++---------- .../keyguard/KeyguardUpdateMonitorTest.java | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java index 907943a9203d0..7971e84769a28 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java @@ -293,7 +293,7 @@ public class CarrierTextManager { } protected List getSubscriptionInfo() { - return mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(false); + return mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(); } protected void updateCarrierText() { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 64e5a632fdbb4..d58ba80685f54 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -620,7 +620,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab * of them based on carrier config. e.g. In this case we should only show one carrier name * on the status bar and quick settings. */ - public List getFilteredSubscriptionInfo(boolean forceReload) { + public List getFilteredSubscriptionInfo() { List subscriptions = getSubscriptionInfo(false); if (subscriptions.size() == 2) { SubscriptionInfo info1 = subscriptions.get(0); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java index 3c8775d01e2d6..9c0a087c01b8f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java @@ -197,7 +197,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi }; protected List getSubscriptionInfo() { - return mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(false); + return mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(); } @Inject diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java index f2ee85886dca5..21a83004ba84f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java @@ -107,7 +107,7 @@ public class EmergencyCryptkeeperText extends TextView { boolean allSimsMissing = true; CharSequence displayText = null; - List subs = mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(false); + List subs = mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(); final int N = subs.size(); for (int i = 0; i < N; i++) { int subId = subs.get(i).getSubscriptionId(); diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java index c2c7dde562a23..ecf7e0d46373e 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java @@ -29,7 +29,6 @@ import static junit.framework.TestCase.assertFalse; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; @@ -171,7 +170,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { reset(mCarrierTextCallback); List list = new ArrayList<>(); list.add(TEST_SUBSCRIPTION); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); when(mKeyguardUpdateMonitor.getSimState(0)).thenReturn(TelephonyManager.SIM_STATE_READY); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -191,7 +190,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { reset(mCarrierTextCallback); List list = new ArrayList<>(); list.add(TEST_SUBSCRIPTION); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); when(mKeyguardUpdateMonitor.getSimState(0)).thenReturn(TelephonyManager.SIM_STATE_READY); when(mKeyguardUpdateMonitor.getSimState(1)).thenReturn( TelephonyManager.SIM_STATE_CARD_IO_ERROR); @@ -224,7 +223,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { @Test public void testWrongSlots() { reset(mCarrierTextCallback); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn( + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn( new ArrayList<>()); when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn( TelephonyManager.SIM_STATE_CARD_IO_ERROR); @@ -238,7 +237,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { @Test public void testMoreSlotsThanSubs() { reset(mCarrierTextCallback); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn( + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn( new ArrayList<>()); // STOPSHIP(b/130246708) This line makes sure that SubscriptionManager provides the @@ -289,7 +288,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { list.add(TEST_SUBSCRIPTION); when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn( TelephonyManager.SIM_STATE_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -314,7 +313,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { list.add(TEST_SUBSCRIPTION_ROAMING); when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn( TelephonyManager.SIM_STATE_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -339,7 +338,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { list.add(TEST_SUBSCRIPTION_NULL); when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn( TelephonyManager.SIM_STATE_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -364,7 +363,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { list.add(TEST_SUBSCRIPTION_NULL); when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn( TelephonyManager.SIM_STATE_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mockWifi(); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -396,7 +395,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { @Test public void testCreateInfo_noSubscriptions() { reset(mCarrierTextCallback); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn( + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn( new ArrayList<>()); ArgumentCaptor captor = @@ -421,7 +420,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { list.add(TEST_SUBSCRIPTION); when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn( TelephonyManager.SIM_STATE_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -446,7 +445,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { when(mKeyguardUpdateMonitor.getSimState(anyInt())) .thenReturn(TelephonyManager.SIM_STATE_READY) .thenReturn(TelephonyManager.SIM_STATE_NOT_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -471,7 +470,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { when(mKeyguardUpdateMonitor.getSimState(anyInt())) .thenReturn(TelephonyManager.SIM_STATE_NOT_READY) .thenReturn(TelephonyManager.SIM_STATE_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); @@ -498,7 +497,7 @@ public class CarrierTextManagerTest extends SysuiTestCase { .thenReturn(TelephonyManager.SIM_STATE_READY) .thenReturn(TelephonyManager.SIM_STATE_NOT_READY) .thenReturn(TelephonyManager.SIM_STATE_READY); - when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(anyBoolean())).thenReturn(list); + when(mKeyguardUpdateMonitor.getFilteredSubscriptionInfo()).thenReturn(list); mKeyguardUpdateMonitor.mServiceStates = new HashMap<>(); ArgumentCaptor captor = diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java index 63729e3252098..784e7ddb6d06f 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java @@ -905,7 +905,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mTestableLooper.processAllMessages(); List listToVerify = mKeyguardUpdateMonitor - .getFilteredSubscriptionInfo(false); + .getFilteredSubscriptionInfo(); assertThat(listToVerify.size()).isEqualTo(1); assertThat(listToVerify.get(0)).isEqualTo(TEST_SUBSCRIPTION_2); }