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

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

Merge "Split id disclosure flags" into main

parents 8d59880b 9debc3b6
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
@@ -524,10 +524,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
@@ -3703,7 +3703,7 @@ public class GsmCdmaPhone extends Phone {
                }

                CellularIdentifierDisclosure disclosure = (CellularIdentifierDisclosure) ar.result;
                if (mFeatureFlags.enableIdentifierDisclosureTransparency()
                if (mFeatureFlags.enableIdentifierDisclosureTransparencyUnsolEvents()
                        && mIdentifierDisclosureNotifier != null
                        && disclosure != null) {
                    mIdentifierDisclosureNotifier.addDisclosure(disclosure);
@@ -5333,16 +5333,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
@@ -2789,7 +2789,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

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

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

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

        Phone phoneUT =
                new GsmCdmaPhone(
@@ -2834,7 +2834,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(
@@ -2865,7 +2865,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(