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

Commit 9debc3b6 authored by Gil Cukierman's avatar Gil Cukierman
Browse files

Split id disclosure flags

Create a new flag to guard only the implementation of handling id disclosure events from the modem. Keep the previous flag guarding the API. This allows us to ramp the API flag sooner than the underlying implementation.

Bug: 318729999

Change-Id: I2707ac8c5c5d0632beb8e34818d9bdbb5a2496c5
Test: atest FrameworksTelephonyTests
parent 28f776ec
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,13 @@ flag {
flag {
  name: "enable_identifier_disclosure_transparency"
  namespace: "telephony"
  description: "Guards APIs for enabling and disabling identifier disclosure transparency"
  bug: "276752426"
}

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"
}
+15 −7
Original line number Diff line number Diff line
@@ -521,10 +521,10 @@ public class GsmCdmaPhone extends Phone {

        mCi.registerForImeiMappingChanged(this, EVENT_IMEI_MAPPING_CHANGED, null);

        if (mFeatureFlags.enableIdentifierDisclosureTransparency()) {
        if (mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()) {
            logi(
                    "enable_identifier_disclosure_transparency is on. Registering for cellular "
                            + "identifier disclosures from phone "
                    "enable_identifier_disclosure_transparency_unsol_events is on. Registering for "
                            + "cellular identifier disclosures from phone "
                            + getPhoneId());
            mIdentifierDisclosureNotifier =
                    mTelephonyComponentFactory
@@ -3689,7 +3689,7 @@ public class GsmCdmaPhone extends Phone {
                }

                CellularIdentifierDisclosure disclosure = (CellularIdentifierDisclosure) ar.result;
                if (mFeatureFlags.enableIdentifierDisclosureTransparency()
                if (mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()
                        && mIdentifierDisclosureNotifier != null
                        && disclosure != null) {
                    mIdentifierDisclosureNotifier.addDisclosure(disclosure);
@@ -5310,16 +5310,24 @@ public class GsmCdmaPhone extends Phone {
    public void handleIdentifierDisclosureNotificationPreferenceChange() {
        if (!mFeatureFlags.enableIdentifierDisclosureTransparency()) {
            logi("Not handling identifier disclosure preference change. Feature flag "
                    + "ENABLE_IDENTIFIER_DISCLOSURE_TRANSPARENCY disabled");
                    + "enable_identifier_disclosure_transparency disabled");
            return;
        }
        boolean prefEnabled = getIdentifierDisclosureNotificationsPreferenceEnabled();

        // 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();
          } else {
            mIdentifierDisclosureNotifier.disable();
          }
        } 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));
+4 −4
Original line number Diff line number Diff line
@@ -2788,7 +2788,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

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

        GsmCdmaPhone phoneUT =
                new GsmCdmaPhone(
@@ -2810,7 +2810,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

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

        Phone phoneUT =
                new GsmCdmaPhone(
@@ -2833,7 +2833,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

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

        Phone phoneUT =
                new GsmCdmaPhone(
@@ -2864,7 +2864,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

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

        Phone phoneUT =
                new GsmCdmaPhone(