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

Commit ffd2956a authored by Pengquan Meng's avatar Pengquan Meng Committed by Gerrit Code Review
Browse files

Merge "Add signal strength converter"

parents 60da40d1 0d4a7ac6
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -1134,6 +1134,15 @@ public class RIL extends BaseCommands implements CommandsInterface {

            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                android.hardware.radio.V1_4.IRadio radioProxy14 =
                        (android.hardware.radio.V1_4.IRadio) radioProxy;
                try {
                    radioProxy14.getSignalStrength_1_4(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "getSignalStrength_1_4", e);
                }
            } else {
                try {
                    radioProxy.getSignalStrength(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
@@ -1141,6 +1150,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                }
            }
        }
    }

    @Override
    public void getVoiceRegistrationState(Message result) {
+17 −0
Original line number Diff line number Diff line
@@ -270,6 +270,23 @@ public class RadioIndication extends IRadioIndication.Stub {
        }
    }

    /**
     * Indicates the current signal strength of the camped or primary serving cell.
     */
    public void currentSignalStrength_1_4(int indicationType,
            android.hardware.radio.V1_4.SignalStrength signalStrength) {

        mRil.processIndication(indicationType);

        SignalStrength ss = new SignalStrength(signalStrength);

        if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, ss);

        if (mRil.mSignalStrengthRegistrant != null) {
            mRil.mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult(null, ss, null));
        }
    }

    /**
     * Indicates current physical channel configuration.
     */
+23 −0
Original line number Diff line number Diff line
@@ -283,6 +283,15 @@ public class RadioResponse extends IRadioResponse.Stub {
            android.hardware.radio.V1_2.SignalStrength signalStrength) {
        responseSignalStrength_1_2(responseInfo, signalStrength);
    }
     /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param signalStrength Current signal strength of camped/connected cells
     */
    public void getSignalStrengthResponse_1_4(
            RadioResponseInfo responseInfo,
            android.hardware.radio.V1_4.SignalStrength signalStrength) {
        responseSignalStrength_1_4(responseInfo, signalStrength);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
@@ -1888,6 +1897,20 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
    }

    private void responseSignalStrength_1_4(
            RadioResponseInfo responseInfo,
            android.hardware.radio.V1_4.SignalStrength signalStrength) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            SignalStrength ret = new SignalStrength(signalStrength);
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
        }
    }

    private void responseSms(RadioResponseInfo responseInfo, SendSmsResult sms) {
        RILRequest rr = mRil.processResponse(responseInfo);

+5 −2
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.telephony.CellInfoGsm;
import android.telephony.CellSignalStrengthCdma;
import android.telephony.CellSignalStrengthGsm;
import android.telephony.CellSignalStrengthLte;
import android.telephony.CellSignalStrengthNr;
import android.telephony.CellSignalStrengthTdscdma;
import android.telephony.CellSignalStrengthWcdma;
import android.telephony.IccOpenLogicalChannelResponse;
@@ -880,7 +881,8 @@ public class SimulatedCommands extends BaseCommands
                    new CellSignalStrengthGsm(20, 0, CellInfo.UNAVAILABLE),
                    new CellSignalStrengthWcdma(),
                    new CellSignalStrengthTdscdma(),
                    new CellSignalStrengthLte());
                    new CellSignalStrengthLte(),
                    new CellSignalStrengthNr());
        }
        resultSuccess(result, mSignalStrength);
    }
@@ -2160,7 +2162,8 @@ public class SimulatedCommands extends BaseCommands
                    new CellSignalStrengthGsm(20, 0, CellInfo.UNAVAILABLE),
                    new CellSignalStrengthWcdma(),
                    new CellSignalStrengthTdscdma(),
                    new CellSignalStrengthLte());
                    new CellSignalStrengthLte(),
                    new CellSignalStrengthNr());
        }

        if (mSignalStrengthRegistrant != null) {
+11 −5
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma;
import android.telephony.CellSignalStrengthGsm;
import android.telephony.CellSignalStrengthLte;
import android.telephony.CellSignalStrengthNr;
import android.telephony.CellSignalStrengthTdscdma;
import android.telephony.CellSignalStrengthWcdma;
import android.telephony.INetworkService;
@@ -508,7 +509,8 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                new CellSignalStrengthGsm(-53, 0, SignalStrength.INVALID),
                new CellSignalStrengthWcdma(),
                new CellSignalStrengthTdscdma(),
                new CellSignalStrengthLte());
                new CellSignalStrengthLte(),
                new CellSignalStrengthNr());

        sendSignalStrength(ss);
        assertEquals(sst.getSignalStrength(), ss);
@@ -522,7 +524,8 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                new CellSignalStrengthWcdma(),
                new CellSignalStrengthTdscdma(),
                new CellSignalStrengthLte(
                        -110, -114, -5, 0, SignalStrength.INVALID, SignalStrength.INVALID));
                        -110, -114, -5, 0, SignalStrength.INVALID, SignalStrength.INVALID),
                new CellSignalStrengthNr());

        sendSignalStrength(ss);
        assertEquals(sst.getSignalStrength(), ss);
@@ -535,7 +538,8 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                new CellSignalStrengthGsm(),
                new CellSignalStrengthWcdma(),
                new CellSignalStrengthTdscdma(),
                new CellSignalStrengthLte());
                new CellSignalStrengthLte(),
                new CellSignalStrengthNr());

        sendSignalStrength(ss);
        assertEquals(sst.getSignalStrength(), ss);
@@ -566,7 +570,8 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                        -5, /* rsrq */
                        0, /* rssnr */
                        SignalStrength.INVALID, /* cqi */
                        SignalStrength.INVALID /* ta */));
                        SignalStrength.INVALID /* ta */),
                new CellSignalStrengthNr());

        mBundle.putBoolean(CarrierConfigManager.KEY_USE_ONLY_RSRP_FOR_LTE_SIGNAL_BAR_BOOL,
                true);
@@ -603,7 +608,8 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                new CellSignalStrengthGsm(),
                new CellSignalStrengthWcdma(-79, 0, -85, -5),
                new CellSignalStrengthTdscdma(),
                new CellSignalStrengthLte());
                new CellSignalStrengthLte(),
                new CellSignalStrengthNr());

        mSimulatedCommands.setSignalStrength(ss);
        mSimulatedCommands.notifySignalStrength();
Loading