Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +5 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT; import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN; import static android.os.BatteryManager.CHARGING_POLICY_DEFAULT; import static android.telephony.SubscriptionManager.PROFILE_CLASS_PROVISIONING; import static android.telephony.SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_ADAPTIVE_AUTH_REQUEST; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT; Loading Loading @@ -689,13 +690,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab * @return List of SubscriptionInfo records, maybe empty but never null. * * Note that this method will filter out any subscription which is PROFILE_CLASS_PROVISIONING * and REMOTE SIMs. REMOTE SIMs use an invalid slot index (-1). */ public List<SubscriptionInfo> getSubscriptionInfo(boolean forceReload) { List<SubscriptionInfo> sil = mSubscriptionInfo; if (sil == null || forceReload) { mSubscriptionInfo = mSubscriptionManager.getCompleteActiveSubscriptionInfoList() .stream() .filter(subInfo -> subInfo.getProfileClass() != PROFILE_CLASS_PROVISIONING) .filter(subInfo -> subInfo.getProfileClass() != PROFILE_CLASS_PROVISIONING && subInfo.getSubscriptionType() != SUBSCRIPTION_TYPE_REMOTE_SIM) .toList(); } Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +23 −0 Original line number Diff line number Diff line Loading @@ -218,6 +218,9 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { TEST_CARRIER, TEST_CARRIER, NAME_SOURCE_CARRIER_ID, 0xFFFFFF, "", DATA_ROAMING_DISABLE, null, null, null, null, false, null, "", false, TEST_GROUP_UUID, TEST_CARRIER_ID, PROFILE_CLASS_PROVISIONING); private static final SubscriptionInfo TEST_REMOTE_SIM = new SubscriptionInfo.Builder(TEST_SUBSCRIPTION) .setType(SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM).build(); private static final int FINGERPRINT_SENSOR_ID = 1; private KosmosJavaAdapter mKosmos; @Mock Loading Loading @@ -1374,6 +1377,26 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.getSubscriptionInfo(true)).hasSize(1); } @Test public void testActiveSubscriptionList_filtersRemoteSim() { List<SubscriptionInfo> list = new ArrayList<>(); list.add(TEST_REMOTE_SIM); when(mSubscriptionManager.getCompleteActiveSubscriptionInfoList()).thenReturn(list); mKeyguardUpdateMonitor.mSubscriptionListener.onSubscriptionsChanged(); assertThat(mKeyguardUpdateMonitor.getSubscriptionInfo(true)).isEmpty(); SubscriptionInfo.Builder b = new SubscriptionInfo.Builder(TEST_REMOTE_SIM); b.setType(SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); SubscriptionInfo validInfo = b.build(); list.clear(); list.add(validInfo); mKeyguardUpdateMonitor.mSubscriptionListener.onSubscriptionsChanged(); assertThat(mKeyguardUpdateMonitor.getSubscriptionInfo(true)).hasSize(1); } @Test public void testActiveSubscriptionList_filtersProvisioningNetworks_untilValid() { List<SubscriptionInfo> list = new ArrayList<>(); Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +5 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT; import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN; import static android.os.BatteryManager.CHARGING_POLICY_DEFAULT; import static android.telephony.SubscriptionManager.PROFILE_CLASS_PROVISIONING; import static android.telephony.SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_ADAPTIVE_AUTH_REQUEST; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT; Loading Loading @@ -689,13 +690,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab * @return List of SubscriptionInfo records, maybe empty but never null. * * Note that this method will filter out any subscription which is PROFILE_CLASS_PROVISIONING * and REMOTE SIMs. REMOTE SIMs use an invalid slot index (-1). */ public List<SubscriptionInfo> getSubscriptionInfo(boolean forceReload) { List<SubscriptionInfo> sil = mSubscriptionInfo; if (sil == null || forceReload) { mSubscriptionInfo = mSubscriptionManager.getCompleteActiveSubscriptionInfoList() .stream() .filter(subInfo -> subInfo.getProfileClass() != PROFILE_CLASS_PROVISIONING) .filter(subInfo -> subInfo.getProfileClass() != PROFILE_CLASS_PROVISIONING && subInfo.getSubscriptionType() != SUBSCRIPTION_TYPE_REMOTE_SIM) .toList(); } Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +23 −0 Original line number Diff line number Diff line Loading @@ -218,6 +218,9 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { TEST_CARRIER, TEST_CARRIER, NAME_SOURCE_CARRIER_ID, 0xFFFFFF, "", DATA_ROAMING_DISABLE, null, null, null, null, false, null, "", false, TEST_GROUP_UUID, TEST_CARRIER_ID, PROFILE_CLASS_PROVISIONING); private static final SubscriptionInfo TEST_REMOTE_SIM = new SubscriptionInfo.Builder(TEST_SUBSCRIPTION) .setType(SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM).build(); private static final int FINGERPRINT_SENSOR_ID = 1; private KosmosJavaAdapter mKosmos; @Mock Loading Loading @@ -1374,6 +1377,26 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.getSubscriptionInfo(true)).hasSize(1); } @Test public void testActiveSubscriptionList_filtersRemoteSim() { List<SubscriptionInfo> list = new ArrayList<>(); list.add(TEST_REMOTE_SIM); when(mSubscriptionManager.getCompleteActiveSubscriptionInfoList()).thenReturn(list); mKeyguardUpdateMonitor.mSubscriptionListener.onSubscriptionsChanged(); assertThat(mKeyguardUpdateMonitor.getSubscriptionInfo(true)).isEmpty(); SubscriptionInfo.Builder b = new SubscriptionInfo.Builder(TEST_REMOTE_SIM); b.setType(SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); SubscriptionInfo validInfo = b.build(); list.clear(); list.add(validInfo); mKeyguardUpdateMonitor.mSubscriptionListener.onSubscriptionsChanged(); assertThat(mKeyguardUpdateMonitor.getSubscriptionInfo(true)).hasSize(1); } @Test public void testActiveSubscriptionList_filtersProvisioningNetworks_untilValid() { List<SubscriptionInfo> list = new ArrayList<>(); Loading