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

Commit 24a7cca6 authored by Gil Cukierman's avatar Gil Cukierman Committed by Android (Google) Code Review
Browse files

Merge "Split modem cipher transparency flags" into main

parents eb249d09 abb95e23
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -31,6 +31,13 @@ flag {
flag {
  name: "enable_modem_cipher_transparency"
  namespace: "telephony"
  description: "Guards APIs for enabling and disabling modem cipher transparency."
  bug: "283336425"
}

flag {
  name: "enable_modem_cipher_transparency_unsol_events"
  namespace: "telephony"
  description: "Allows the framework to register for SecurityAlgorithmChanged events and emit notifications to the user when a device is using null ciphers."
  bug: "283336425"
}
+18 −7
Original line number Diff line number Diff line
@@ -538,9 +538,11 @@ public class GsmCdmaPhone extends Phone {
                    this, EVENT_CELL_IDENTIFIER_DISCLOSURE, null);
        }

        if (mFeatureFlags.enableModemCipherTransparency()) {
            logi("enable_modem_cipher_transparency is on. Registering for security algorithm "
                    + "updates from phone " + getPhoneId());
        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            logi(
                    "enable_modem_cipher_transparency_unsol_events is on. Registering for security "
                            + "algorithm updates from phone "
                            + getPhoneId());
            mNullCipherNotifier =
                    mTelephonyComponentFactory
                            .inject(NullCipherNotifier.class.getName())
@@ -3720,7 +3722,8 @@ public class GsmCdmaPhone extends Phone {

            case EVENT_SECURITY_ALGORITHM_UPDATE:
                logd("EVENT_SECURITY_ALGORITHM_UPDATE phoneId = " + getPhoneId());
                if (mFeatureFlags.enableModemCipherTransparency() && mNullCipherNotifier != null) {
                if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()
                        && mNullCipherNotifier != null) {
                    ar = (AsyncResult) msg.obj;
                    SecurityAlgorithmUpdate update = (SecurityAlgorithmUpdate) ar.result;
                    mNullCipherNotifier.onSecurityAlgorithmUpdate(getPhoneId(), update);
@@ -5373,11 +5376,19 @@ public class GsmCdmaPhone extends Phone {
        }
        boolean prefEnabled = getNullCipherNotificationsPreferenceEnabled();

        // The notifier is tied to handling unsolicited updates from the modem, not the
        // enable/disable API.
        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            if (prefEnabled) {
                mNullCipherNotifier.enable();
            } else {
                mNullCipherNotifier.disable();
            }
        } else {
            logi(
                    "Not toggling enable state for cipher notifier. Feature flag "
                            + "enable_modem_cipher_transparency_unsol_events is disabled.");
        }

        mCi.setSecurityAlgorithmsUpdatedEnabled(prefEnabled,
                obtainMessage(EVENT_SET_SECURITY_ALGORITHMS_UPDATED_ENABLED_DONE));
+4 −2
Original line number Diff line number Diff line
@@ -2947,7 +2947,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testSecurityAlgorithmUpdateFlagOn() {
        when(mFeatureFlags.enableModemCipherTransparency()).thenReturn(true);
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);

        Phone phoneUT = makeNewPhoneUT();

@@ -2960,7 +2960,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testSecurityAlgorithm_updateAddedToNotifier() {
        when(mFeatureFlags.enableModemCipherTransparency()).thenReturn(true);
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);
        Phone phoneUT = makeNewPhoneUT();
        SecurityAlgorithmUpdate update =
                new SecurityAlgorithmUpdate(
@@ -3022,6 +3022,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    @Test
    public void testNullCipherNotification_preferenceEnabled() {
        when(mFeatureFlags.enableModemCipherTransparency()).thenReturn(true);
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);
        GsmCdmaPhone phoneUT = makeNewPhoneUT();

        setNullCipherNotificationPreferenceEnabled(true);
@@ -3035,6 +3036,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    @Test
    public void testNullCipherNotification_preferenceDisabled() {
        when(mFeatureFlags.enableModemCipherTransparency()).thenReturn(true);
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);
        GsmCdmaPhone phoneUT = makeNewPhoneUT();

        setNullCipherNotificationPreferenceEnabled(false);