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

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

Merge "Handle CellularIdentifierDisclosure events in telephony" into main

parents cca207d5 fbe7f7f9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -13,3 +13,10 @@ flag {
  description: "Allow carriers to hide the roaming (R) icon when roaming."
  bug: "301467052"
}

flag {
  name: "enable_identifier_disclosure_transparency"
  namespace: "telephony"
  description: "Allows the framework to register for CellularIdentifierDisclosure events and emit notifications to the user about them"
  bug: "276752426"
}
+11 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ public abstract class BaseCommands implements CommandsInterface {
    protected RegistrantList mNotifyAnbrRegistrants = new RegistrantList();
    protected RegistrantList mTriggerImsDeregistrationRegistrants = new RegistrantList();
    protected RegistrantList mImeiInfoRegistrants = new RegistrantList();
    protected RegistrantList mCellularIdentifierDisclosedRegistrants = new RegistrantList();

    @UnsupportedAppUsage
    protected Registrant mGsmSmsRegistrant;
@@ -1183,4 +1184,14 @@ public abstract class BaseCommands implements CommandsInterface {
    public void registerForImeiMappingChanged(Handler h, int what, Object obj) {
        mImeiInfoRegistrants.add(h, what, obj);
    }

    @Override
    public void registerForCellularIdentifierDisclosures(Handler h, int what, Object obj) {
        mCellularIdentifierDisclosedRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForCellularIdentifierDisclosures(Handler h) {
        mCellularIdentifierDisclosedRegistrants.remove(h);
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -2927,4 +2927,17 @@ public interface CommandsInterface {
     * @param result Callback message to receive the result.
     */
    default void isSecurityAlgorithmsUpdatedEnabled(Message result) {}

    /**
     * Registers for cellular identifier disclosure events.
     */
    default void registerForCellularIdentifierDisclosures(
            @NonNull Handler h, int what, @Nullable Object obj) {}

    /**
     * Unregisters for cellular identifier disclosure events.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForCellularIdentifierDisclosures(@NonNull Handler h) {}
}
+38 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ import android.telephony.BarringInfo;
import android.telephony.CarrierConfigManager;
import android.telephony.CellBroadcastIdRange;
import android.telephony.CellIdentity;
import android.telephony.CellularIdentifierDisclosure;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.LinkCapacityEstimate;
import android.telephony.NetworkScanRequest;
@@ -116,6 +117,7 @@ import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
import com.android.internal.telephony.imsphone.ImsPhoneMmiCode;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.metrics.VoiceCallSessionStats;
import com.android.internal.telephony.security.CellularIdentifierDisclosureNotifier;
import com.android.internal.telephony.subscription.SubscriptionInfoInternal;
import com.android.internal.telephony.subscription.SubscriptionManagerService.SubscriptionManagerServiceCallback;
import com.android.internal.telephony.test.SimulatedRadioControl;
@@ -298,6 +300,8 @@ public class GsmCdmaPhone extends Phone {
    private final SubscriptionManager.OnSubscriptionsChangedListener mSubscriptionsChangedListener;
    private final CallWaitingController mCallWaitingController;

    private CellularIdentifierDisclosureNotifier mIdentifierDisclosureNotifier;

    // Set via Carrier Config
    private boolean mIsN1ModeAllowedByCarrier = true;
    // Set via a call to the method on Phone; the only caller is IMS, and all of this code will
@@ -515,6 +519,20 @@ public class GsmCdmaPhone extends Phone {
        mCIM = new CarrierInfoManager();

        mCi.registerForImeiMappingChanged(this, EVENT_IMEI_MAPPING_CHANGED, null);

        if (mFeatureFlags.enableIdentifierDisclosureTransparency()) {
            logi(
                    "enable_identifier_disclosure_transparency is on. Registering for cellular "
                            + "identifier disclosures from phone "
                            + getPhoneId());
            mIdentifierDisclosureNotifier =
                    mTelephonyComponentFactory
                            .inject(CellularIdentifierDisclosureNotifier.class.getName())
                            .makeIdentifierDisclosureNotifier();
            mCi.registerForCellularIdentifierDisclosures(
                    this, EVENT_CELL_IDENTIFIER_DISCLOSURE, null);
        }

        initializeCarrierApps();
    }

@@ -3663,6 +3681,26 @@ public class GsmCdmaPhone extends Phone {
                parseImeiInfo(msg);
                break;

            case EVENT_CELL_IDENTIFIER_DISCLOSURE:
                logd("EVENT_CELL_IDENTIFIER_DISCLOSURE phoneId = " + getPhoneId());

                ar = (AsyncResult) msg.obj;
                if (ar == null || ar.result == null || ar.exception != null) {
                    Rlog.e(
                            LOG_TAG,
                            "Failed to process cellular identifier disclosure",
                            ar.exception);
                    break;
                }

                CellularIdentifierDisclosure disclosure = (CellularIdentifierDisclosure) ar.result;
                if (mFeatureFlags.enableIdentifierDisclosureTransparency()
                        && mIdentifierDisclosureNotifier != null
                        && disclosure != null) {
                    mIdentifierDisclosureNotifier.addDisclosure(disclosure);
                }
                break;

            default:
                super.handleMessage(msg);
        }
+6 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.telephony.AnomalyReporter;
import android.telephony.BarringInfo;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.CellularIdentifierDisclosure;
import android.telephony.EmergencyRegResult;
import android.telephony.LinkCapacityEstimate;
import android.telephony.NetworkRegistrationInfo;
@@ -436,7 +437,11 @@ public class NetworkIndication extends IRadioNetworkIndication.Stub {
            mRil.unsljLogRet(RIL_UNSOL_CELLULAR_IDENTIFIER_DISCLOSED, identifierDisclsoure);
        }

        // TODO (b/276752426) notify registrants of identifier disclosure
        CellularIdentifierDisclosure disclosure =
                RILUtils.convertCellularIdentifierDisclosure(identifierDisclsoure);

        mRil.mCellularIdentifierDisclosedRegistrants.notifyRegistrants(
                new AsyncResult(null, disclosure, null));
    }

    /**
Loading