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

Commit 887b822b authored by Jack Yu's avatar Jack Yu Committed by Android (Google) Code Review
Browse files

Merge "Removed the flag enable_modem_cipher_transparency_unsol_events" into main

parents 72c0ad94 a73c7371
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
package: "com.android.internal.telephony.flags"
container: "system"

# OWNER=cukie TARGET=24Q3
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"
}

# OWNER=songferngwang TARGET=24Q3
flag {
  name: "hide_prefer_3g_item"
+17 −34
Original line number Diff line number Diff line
@@ -538,10 +538,8 @@ public class GsmCdmaPhone extends Phone {

        mCi.registerForImeiMappingChanged(this, EVENT_IMEI_MAPPING_CHANGED, null);

        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            mSafetySource =
                    mTelephonyComponentFactory.makeCellularNetworkSecuritySafetySource(mContext);
        }
        mSafetySource = mTelephonyComponentFactory
                .makeCellularNetworkSecuritySafetySource(mContext);

        logi(
                "enable_identifier_disclosure_transparency_unsol_events is on. Registering for "
@@ -554,7 +552,6 @@ public class GsmCdmaPhone extends Phone {
        mCi.registerForCellularIdentifierDisclosures(
                this, EVENT_CELL_IDENTIFIER_DISCLOSURE, null);

        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
        logi(
                "enable_modem_cipher_transparency_unsol_events is on. Registering for security "
                        + "algorithm updates from phone "
@@ -565,7 +562,6 @@ public class GsmCdmaPhone extends Phone {
                        .makeNullCipherNotifier(mSafetySource);
        mCi.registerForSecurityAlgorithmUpdates(
                this, EVENT_SECURITY_ALGORITHM_UPDATE, null);
        }

        initializeCarrierApps();
    }
@@ -3794,8 +3790,7 @@ public class GsmCdmaPhone extends Phone {
                ar = (AsyncResult) msg.obj;
                SecurityAlgorithmUpdate update = (SecurityAlgorithmUpdate) ar.result;

                if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()
                        && mNullCipherNotifier != null) {
                if (mNullCipherNotifier != null) {
                    mNullCipherNotifier.onSecurityAlgorithmUpdate(mContext, getPhoneId(),
                            getSubId(), update);
                }
@@ -5447,17 +5442,11 @@ public class GsmCdmaPhone extends Phone {

        // The notifier is tied to handling unsolicited updates from the modem, not the
        // enable/disable API.
        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
        if (prefEnabled) {
            mNullCipherNotifier.enable(mContext);
        } else {
            mNullCipherNotifier.disable(mContext);
        }
        } 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));
@@ -5468,10 +5457,6 @@ public class GsmCdmaPhone extends Phone {
     */
    @VisibleForTesting
    public void updateNullCipherNotifier() {
        if (!mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            return;
        }

        SubscriptionInfoInternal subInfo = mSubscriptionManagerService
                .getSubscriptionInfoInternal(getSubId());
        boolean active = false;
@@ -5499,10 +5484,8 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public void refreshSafetySources(String refreshBroadcastId) {
        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
        post(() -> mSafetySource.refresh(mContext, refreshBroadcastId));
    }
    }

    /**
     * @return The sms dispatchers controller
+1 −21
Original line number Diff line number Diff line
@@ -2994,8 +2994,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

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

        Phone phoneUT = makeNewPhoneUT();

        verify(mMockCi, times(1))
@@ -3007,7 +3005,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testSecurityAlgorithm_updateAddedToNotifier() {
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);
        Phone phoneUT = makeNewPhoneUT();
        SecurityAlgorithmUpdate update =
                new SecurityAlgorithmUpdate(
@@ -3026,23 +3023,8 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
                .onSecurityAlgorithmUpdate(eq(mContext), eq(0), eq(0), eq(update));
    }

    @Test
    public void testUpdateNullCipherNotifier_flagDisabled() {
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(false);
        Phone phoneUT = makeNewPhoneUT();
        phoneUT.sendMessage(
                mPhoneUT.obtainMessage(
                        Phone.EVENT_SUBSCRIPTIONS_CHANGED,
                        new AsyncResult(null, null, null)));
        processAllMessages();

        verify(mNullCipherNotifier, never()).setSubscriptionMapping(any(), anyInt(), anyInt());
    }

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

        int subId = 10;
        SubscriptionInfoInternal subInfo = new SubscriptionInfoInternal.Builder().setSimSlotIndex(
                0).setId(subId).build();
@@ -3063,7 +3045,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testUpdateNullCipherNotifier_inactiveSubscription() {
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);
        int subId = 1;
        SubscriptionInfoInternal subInfo = new SubscriptionInfoInternal.Builder().setSimSlotIndex(
                -1).setId(subId).build();
@@ -3110,7 +3091,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNullCipherNotification_preferenceEnabled() {
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);
        GsmCdmaPhone phoneUT = makeNewPhoneUT();

        setNullCipherNotificationPreferenceEnabled(true);
@@ -3123,7 +3103,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNullCipherNotification_preferenceDisabled() {
        when(mFeatureFlags.enableModemCipherTransparencyUnsolEvents()).thenReturn(true);
        Mockito.reset(mNullCipherNotifier);
        GsmCdmaPhone phoneUT = makeNewPhoneUT();

        setNullCipherNotificationPreferenceEnabled(false);