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

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

Merge "IWLAN API review changes"

parents 17cb9d37 a7a8c570
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -104,11 +104,11 @@ public class CellularNetworkService extends NetworkService {

                            try {
                                if (DBG) {
                                    log("Calling callback.onGetNetworkRegistrationInfoComplete."
                                    log("Calling onRequestNetworkRegistrationInfoComplete."
                                            + "resultCode = " + resultCode
                                            + ", netState = " + netState);
                                }
                                callback.onGetNetworkRegistrationInfoComplete(
                                callback.onRequestNetworkRegistrationInfoComplete(
                                         resultCode, netState);
                            } catch (Exception e) {
                                loge("Exception: " + e);
@@ -464,8 +464,8 @@ public class CellularNetworkService extends NetworkService {
        }

        @Override
        public void getNetworkRegistrationInfo(int domain, NetworkServiceCallback callback) {
            if (DBG) log("getNetworkRegistrationInfo for domain " + domain);
        public void requestNetworkRegistrationInfo(int domain, NetworkServiceCallback callback) {
            if (DBG) log("requestNetworkRegistrationInfo for domain " + domain);
            Message message = null;

            if (domain == NetworkRegistrationInfo.DOMAIN_CS) {
@@ -477,8 +477,8 @@ public class CellularNetworkService extends NetworkService {
                mCallbackMap.put(message, callback);
                mPhone.mCi.getDataRegistrationState(message);
            } else {
                loge("getNetworkRegistrationInfo invalid domain " + domain);
                callback.onGetNetworkRegistrationInfoComplete(
                loge("requestNetworkRegistrationInfo invalid domain " + domain);
                callback.onRequestNetworkRegistrationInfoComplete(
                        NetworkServiceCallback.RESULT_ERROR_INVALID_ARG, null);
            }
        }
+7 −7
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ public class NetworkRegistrationManager extends Handler {

    private final Map<NetworkRegStateCallback, Message> mCallbackTable = new Hashtable();

    public void getNetworkRegistrationInfo(@NetworkRegistrationInfo.Domain int domain,
    public void requestNetworkRegistrationInfo(@NetworkRegistrationInfo.Domain int domain,
                                               Message onCompleteMessage) {
        if (onCompleteMessage == null) return;

@@ -154,9 +154,9 @@ public class NetworkRegistrationManager extends Handler {
        NetworkRegStateCallback callback = new NetworkRegStateCallback();
        try {
            mCallbackTable.put(callback, onCompleteMessage);
            mINetworkService.getNetworkRegistrationInfo(mPhone.getPhoneId(), domain, callback);
            mINetworkService.requestNetworkRegistrationInfo(mPhone.getPhoneId(), domain, callback);
        } catch (RemoteException e) {
            loge("getNetworkRegistrationInfo RemoteException " + e);
            loge("requestNetworkRegistrationInfo RemoteException " + e);
            mCallbackTable.remove(callback);
            onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, e);
            onCompleteMessage.sendToTarget();
@@ -213,9 +213,9 @@ public class NetworkRegistrationManager extends Handler {

    private class NetworkRegStateCallback extends INetworkServiceCallback.Stub {
        @Override
        public void onGetNetworkRegistrationInfoComplete(
        public void onRequestNetworkRegistrationInfoComplete(
                int result, NetworkRegistrationInfo state) {
            logd("onGetNetworkRegistrationInfoComplete result "
            logd("onRequestNetworkRegistrationInfoComplete result "
                    + result + " state " + state);
            Message onCompleteMessage = mCallbackTable.remove(this);
            if (onCompleteMessage != null) {
@@ -257,7 +257,7 @@ public class NetworkRegistrationManager extends Handler {
            mPhone.getContext().unbindService(mServiceConnection);
        }

        Intent intent = new Intent(NetworkService.NETWORK_SERVICE_INTERFACE);
        Intent intent = new Intent(NetworkService.SERVICE_INTERFACE);
        intent.setPackage(getPackageName());

        try {
+37 −20
Original line number Diff line number Diff line
@@ -1388,22 +1388,22 @@ public class RIL extends BaseCommands implements CommandsInterface {

        dpi.profileId = dp.getProfileId();
        dpi.apn = dp.getApn();
        dpi.protocol = ApnSetting.getProtocolStringFromInt(dp.getProtocol());
        dpi.roamingProtocol = ApnSetting.getProtocolStringFromInt(dp.getRoamingProtocol());
        dpi.protocol = ApnSetting.getProtocolStringFromInt(dp.getProtocolType());
        dpi.roamingProtocol = ApnSetting.getProtocolStringFromInt(dp.getRoamingProtocolType());
        dpi.authType = dp.getAuthType();
        dpi.user = dp.getUserName();
        dpi.password = dp.getPassword();
        dpi.type = dp.getType();
        dpi.maxConnsTime = dp.getMaxConnsTime();
        dpi.maxConns = dp.getMaxConns();
        dpi.maxConnsTime = dp.getMaxConnectionsTime();
        dpi.maxConns = dp.getMaxConnections();
        dpi.waitTime = dp.getWaitTime();
        dpi.enabled = dp.isEnabled();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmap();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmask();
        // Shift by 1 bit due to the discrepancy between
        // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of
        // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX.
        dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
                dp.getBearerBitmap()) << 1;
                dp.getBearerBitmask()) << 1;
        dpi.mtu = dp.getMtu();
        dpi.mvnoType = MvnoType.NONE;
        dpi.mvnoMatchData = "";
@@ -1422,22 +1422,22 @@ public class RIL extends BaseCommands implements CommandsInterface {
                new android.hardware.radio.V1_4.DataProfileInfo();

        dpi.apn = dp.getApn();
        dpi.protocol = dp.getProtocol();
        dpi.roamingProtocol = dp.getRoamingProtocol();
        dpi.protocol = dp.getProtocolType();
        dpi.roamingProtocol = dp.getRoamingProtocolType();
        dpi.authType = dp.getAuthType();
        dpi.user = dp.getUserName();
        dpi.password = dp.getPassword();
        dpi.type = dp.getType();
        dpi.maxConnsTime = dp.getMaxConnsTime();
        dpi.maxConns = dp.getMaxConns();
        dpi.maxConnsTime = dp.getMaxConnectionsTime();
        dpi.maxConns = dp.getMaxConnections();
        dpi.waitTime = dp.getWaitTime();
        dpi.enabled = dp.isEnabled();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmap();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmask();
        // Shift by 1 bit due to the discrepancy between
        // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of
        // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX.
        dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
                dp.getBearerBitmap()) << 1;
                dp.getBearerBitmask()) << 1;
        dpi.mtu = dp.getMtu();
        dpi.persistent = dp.isPersistent();
        dpi.preferred = dp.isPreferred();
@@ -5901,17 +5901,17 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public static DataCallResponse convertDataCallResult(Object dcResult) {
        if (dcResult == null) return null;

        int status, suggestedRetryTime, cid, active, mtu;
        int cause, suggestedRetryTime, cid, active, mtu;
        String ifname;
        int protocolType;
        String[] addresses = null;
        String[] dnses = null;
        String[] gateways = null;
        List<String> pcscfs;
        String[] pcscfs = null;
        if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) {
            final android.hardware.radio.V1_0.SetupDataCallResult result =
                    (android.hardware.radio.V1_0.SetupDataCallResult) dcResult;
            status = result.status;
            cause = result.status;
            suggestedRetryTime = result.suggestedRetryTime;
            cid = result.cid;
            active = result.active;
@@ -5926,12 +5926,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
            if (!TextUtils.isEmpty(result.gateways)) {
                gateways = result.gateways.split("\\s+");
            }
            pcscfs = new ArrayList<>(Arrays.asList(result.pcscf.trim().split("\\s+")));
            if (!TextUtils.isEmpty(result.pcscf)) {
                pcscfs = result.pcscf.split("\\s+");
            }
            mtu = result.mtu;
        } else if (dcResult instanceof android.hardware.radio.V1_4.SetupDataCallResult) {
            final android.hardware.radio.V1_4.SetupDataCallResult result =
                    (android.hardware.radio.V1_4.SetupDataCallResult) dcResult;
            status = result.cause;
            cause = result.cause;
            suggestedRetryTime = result.suggestedRetryTime;
            cid = result.cid;
            active = result.active;
@@ -5940,7 +5942,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            addresses = result.addresses.stream().toArray(String[]::new);
            dnses = result.dnses.stream().toArray(String[]::new);
            gateways = result.gateways.stream().toArray(String[]::new);
            pcscfs = result.pcscf;
            pcscfs = result.pcscf.stream().toArray(String[]::new);
            mtu = result.mtu;
        } else {
            Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult);
@@ -6002,8 +6004,23 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }
        }

        return new DataCallResponse(status, suggestedRetryTime, cid, active, protocolType, ifname,
                laList, dnsList, gatewayList, pcscfs, mtu);
        // Process gateway
        List<InetAddress> pcscfList = new ArrayList<>();
        if (pcscfs != null) {
            for (String pcscf : pcscfs) {
                pcscf = pcscf.trim();
                InetAddress ia;
                try {
                    ia = NetworkUtils.numericToInetAddress(pcscf);
                    pcscfList.add(ia);
                } catch (IllegalArgumentException e) {
                    Rlog.e(RILJ_LOG_TAG, "Unknown pcscf: " + pcscf, e);
                }
            }
        }

        return new DataCallResponse(cause, suggestedRetryTime, cid, active, protocolType, ifname,
                laList, dnsList, gatewayList, pcscfList, mtu);
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -1258,7 +1258,7 @@ public class ServiceStateTracker extends Handler {

                if (ar.exception == null) {
                    mRegStateManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                            .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS,
                            .requestNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS,
                            obtainMessage(EVENT_GET_LOC_DONE, null));
                }
                break;
@@ -2981,19 +2981,19 @@ public class ServiceStateTracker extends Handler {

                mPollingContext[0]++;
                mRegStateManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                        .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                        .requestNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                                obtainMessage(EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION,
                                        mPollingContext));

                mPollingContext[0]++;
                mRegStateManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                        .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS,
                        .requestNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS,
                        obtainMessage(EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, mPollingContext));

                if (mRegStateManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN) != null) {
                    mPollingContext[0]++;
                    mRegStateManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
                            .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                            .requestNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                                    obtainMessage(EVENT_POLL_STATE_PS_IWLAN_REGISTRATION,
                                            mPollingContext));
                }
+2 −2
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ public class AccessNetworksManager extends Handler {

            try {
                service.linkToDeath(mDeathRecipient, 0 /* flags */);
                mIQualifiedNetworksService.createNetworkAvailabilityUpdater(mPhone.getPhoneId(),
                mIQualifiedNetworksService.createNetworkAvailabilityProvider(mPhone.getPhoneId(),
                        new QualifiedNetworksServiceCallback());
            } catch (RemoteException e) {
                mDeathRecipient.binderDied();
@@ -255,7 +255,7 @@ public class AccessNetworksManager extends Handler {
                && mIQualifiedNetworksService.asBinder().isBinderAlive()) {
            // Remove the network availability updater and then unbind the service.
            try {
                mIQualifiedNetworksService.removeNetworkAvailabilityUpdater(mPhone.getPhoneId());
                mIQualifiedNetworksService.removeNetworkAvailabilityProvider(mPhone.getPhoneId());
            } catch (RemoteException e) {
                loge("Cannot remove network availability updater. " + e);
            }
Loading