Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d8680e1 authored by yomna's avatar yomna Committed by Yomna ~
Browse files

Fix redirect to Mobile security page

When the user first access the Mobile network security settings, they
should not open in Safety Center even if Safety Center is supported.
Until notifications are enabled for hardware security APIs, they should
open in Settings. This is because the Safety Center redirect will fail
if the Safety Source has not begun providing data to Safety Center. Also
update the relevant unit test.

Flag: EXEMPT bugfix
Bug: 373942609
Test: m & atest CellularSecurityNotificationsDividerControllerTest CellularSecurityNotificationsPreferenceControllerTest CellularSecurityEncryptionDividerControllerTest CellularSecurityPreferenceControllerTest
Change-Id: Ica87be4f1567541a6e3ccbe5dd5b674224aa1d8e
parent 9b65eafc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ public class CellularSecurityPreferenceController extends BasePreferenceControll
            return super.handlePreferenceTreeClick(preference);
        }
        boolean isSafetyCenterSupported = isSafetyCenterSupported();
        if (isSafetyCenterSupported) {
        if (isSafetyCenterSupported && areNotificationsEnabled()) {
            Intent safetyCenterIntent = new Intent(Intent.ACTION_SAFETY_CENTER);
            safetyCenterIntent.putExtra(SafetyCenterManager.EXTRA_SAFETY_SOURCES_GROUP_ID,
                    "AndroidCellularNetworkSecuritySources");
+4 −0
Original line number Diff line number Diff line
@@ -152,6 +152,10 @@ public final class CellularSecurityPreferenceControllerTest {
    public void handlePreferenceTreeClick_safetyCenterSupported_shouldRedirectToSafetyCenter() {
        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);

        doReturn(true).when(mTelephonyManager).isNullCipherNotificationsEnabled();
        doReturn(true).when(mTelephonyManager)
              .isCellularIdentifierDisclosureNotificationsEnabled();
        doReturn(true).when(mTelephonyManager).isNullCipherAndIntegrityPreferenceEnabled();
        boolean prefHandled = mController.handlePreferenceTreeClick(mPreference);

        assertThat(prefHandled).isTrue();