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

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

Merge "Cleaned up the flag enable_identifier_disclosure_transparency_unsol_events" into main

parents 9fc9719a 695fb201
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_identifier_disclosure_transparency_unsol_events"
  namespace: "telephony"
  description: "Allows the framework to register for CellularIdentifierDisclosure events and emit notifications to the user about them"
  bug: "276752426"
}

# OWNER=cukie TARGET=24Q3
flag {
  name: "enable_modem_cipher_transparency"
+16 −26
Original line number Diff line number Diff line
@@ -538,13 +538,11 @@ public class GsmCdmaPhone extends Phone {

        mCi.registerForImeiMappingChanged(this, EVENT_IMEI_MAPPING_CHANGED, null);

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

        if (mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()) {
        logi(
                "enable_identifier_disclosure_transparency_unsol_events is on. Registering for "
                        + "cellular identifier disclosures from phone "
@@ -555,7 +553,6 @@ public class GsmCdmaPhone extends Phone {
                        .makeIdentifierDisclosureNotifier(mSafetySource);
        mCi.registerForCellularIdentifierDisclosures(
                this, EVENT_CELL_IDENTIFIER_DISCLOSURE, null);
        }

        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            logi(
@@ -3772,8 +3769,7 @@ public class GsmCdmaPhone extends Phone {
                }

                CellularIdentifierDisclosure disclosure = (CellularIdentifierDisclosure) ar.result;
                if (mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()
                        && mIdentifierDisclosureNotifier != null
                if (mIdentifierDisclosureNotifier != null
                        && disclosure != null) {
                    mIdentifierDisclosureNotifier.addDisclosure(mContext, getSubId(), disclosure);
                }
@@ -5435,16 +5431,11 @@ public class GsmCdmaPhone extends Phone {
        // The notifier is tied to handling unsolicited updates from the modem, not the
        // enable/disable API, so we only toggle the enable state if the unsol events feature
        // flag is enabled.
        if (mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()) {
        if (prefEnabled) {
            mIdentifierDisclosureNotifier.enable(mContext);
        } else {
            mIdentifierDisclosureNotifier.disable(mContext);
        }
        } else {
            logi("Not toggling enable state for disclosure notifier. Feature flag "
                    + "enable_identifier_disclosure_transparency_unsol_events is disabled");
        }

        mCi.setCellularIdentifierTransparencyEnabled(prefEnabled,
                obtainMessage(EVENT_SET_IDENTIFIER_DISCLOSURE_ENABLED_DONE));
@@ -5513,8 +5504,7 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public void refreshSafetySources(String refreshBroadcastId) {
        if (mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()
                || mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            post(() -> mSafetySource.refresh(mContext, refreshBroadcastId));
        }
    }
+1 −42
Original line number Diff line number Diff line
@@ -2543,21 +2543,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
                any(Message.class));
    }

    @Test
    public void testHandleNullCipherAndIntegrityEnabled_featureFlagOff() {
        mPhoneUT.mCi = mMockCi;
        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_CELLULAR_SECURITY,
                TelephonyManager.PROPERTY_ENABLE_NULL_CIPHER_TOGGLE, Boolean.FALSE.toString(),
                false);

        mPhoneUT.sendMessage(mPhoneUT.obtainMessage(EVENT_RADIO_AVAILABLE,
                new AsyncResult(null, new int[]{ServiceState.RIL_RADIO_TECHNOLOGY_GSM}, null)));
        processAllMessages();

        verify(mMockCi, times(0)).setNullCipherAndIntegrityEnabled(anyBoolean(),
                any(Message.class));
    }

    public void fdnCheckCleanup() {
        doReturn(false).when(mUiccCardApplication3gpp).getIccFdnAvailable();
        doReturn(false).when(mUiccCardApplication3gpp).getIccFdnEnabled();
@@ -2895,31 +2880,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    }

    @Test
    public void testCellularIdentifierDisclosureFlagOff() {
        when(mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()).thenReturn(false);

        GsmCdmaPhone phoneUT =
                new GsmCdmaPhone(
                        mContext,
                        mSimulatedCommands,
                        mNotifier,
                        true,
                        0,
                        PhoneConstants.PHONE_TYPE_GSM,
                        mTelephonyComponentFactory,
                        (c, p) -> mImsManager,
                        mFeatureFlags);
        phoneUT.mCi = mMockCi;

        verify(mMockCi, never())
                .registerForCellularIdentifierDisclosures(
                        any(Handler.class), anyInt(), any(Object.class));
    }

    @Test
    public void testCellularIdentifierDisclosureFlagOn() {
        when(mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()).thenReturn(true);

    public void testCellularIdentifierDisclosure() {
        Phone phoneUT =
                new GsmCdmaPhone(
                        mContext,
@@ -2943,7 +2904,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    public void testCellularIdentifierDisclosure_disclosureEventAddedToNotifier() {
        int phoneId = 0;
        int subId = 10;
        when(mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()).thenReturn(true);
        when(mSubscriptionManagerService.getSubId(phoneId)).thenReturn(subId);

        Phone phoneUT =
@@ -2978,7 +2938,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    public void testCellularIdentifierDisclosure_disclosureEventNull() {
        int phoneId = 4;
        int subId = 6;
        when(mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()).thenReturn(true);
        when(mSubscriptionManagerService.getSubId(phoneId)).thenReturn(subId);
        Phone phoneUT =
                new GsmCdmaPhone(
+3 −2
Original line number Diff line number Diff line
@@ -703,10 +703,11 @@ public abstract class TelephonyTest {
                .makeCellularNetworkSecuritySafetySource(any(Context.class));
        doReturn(mIdentifierDisclosureNotifier)
                .when(mTelephonyComponentFactory)
                .makeIdentifierDisclosureNotifier(any(CellularNetworkSecuritySafetySource.class));
                .makeIdentifierDisclosureNotifier(
                        nullable(CellularNetworkSecuritySafetySource.class));
        doReturn(mNullCipherNotifier)
                .when(mTelephonyComponentFactory)
                .makeNullCipherNotifier(any(CellularNetworkSecuritySafetySource.class));
                .makeNullCipherNotifier(nullable(CellularNetworkSecuritySafetySource.class));

        //mPhone
        doReturn(mContext).when(mPhone).getContext();