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

Commit 5c097139 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

base: Remove sending IMSI/MSISDN to SUPL server

- Both are sent only for devices with simcard
 IMSI - Subscriber Id
 MSISDN - Line/Phone Number
parent 370a7be2
Loading
Loading
Loading
Loading
+5 −35
Original line number Diff line number Diff line
@@ -1716,41 +1716,11 @@ public class GnssLocationProvider extends AbstractLocationProvider implements

    @Override
    public void onRequestSetID(@GnssNative.AGpsCallbacks.AgpsSetIdFlags int flags) {
        TelephonyManager phone = (TelephonyManager)
                mContext.getSystemService(Context.TELEPHONY_SERVICE);
        int type = AGPS_SETID_TYPE_NONE;
        String setId = null;
        final Boolean isEmergency = mNIHandler.getInEmergency();

        // Unless we are in an emergency, do not provide sensitive subscriber information
        // to SUPL servers.
        if (!isEmergency) {
            mGnssNative.setAgpsSetId(type, "");
            return;
        }

        int subId = SubscriptionManager.getDefaultDataSubscriptionId();
        if (isEmergency && mNetworkConnectivityHandler.getActiveSubId() >= 0) {
            subId = mNetworkConnectivityHandler.getActiveSubId();
        }
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
            phone = phone.createForSubscriptionId(subId);
        }
        if ((flags & AGPS_REQUEST_SETID_IMSI) == AGPS_REQUEST_SETID_IMSI) {
            setId = phone.getSubscriberId();
            if (setId != null) {
                // This means the framework has the SIM card.
                type = AGPS_SETID_TYPE_IMSI;
            }
        } else if ((flags & AGPS_REQUEST_SETID_MSISDN) == AGPS_REQUEST_SETID_MSISDN) {
            setId = phone.getLine1Number();
            if (setId != null) {
                // This means the framework has the SIM card.
                type = AGPS_SETID_TYPE_MSISDN;
            }
        }

        mGnssNative.setAgpsSetId(type, (setId == null) ? "" : setId);
        // Dont send IMSI or Phone number to SUPL server
        // Fine on devices with/without SIM cards
        final int type = AGPS_SETID_TYPE_NONE;
        final String setId = "";
        mGnssNative.setAgpsSetId(type, setId);
    }

    @Override