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

Commit b6d32aa5 authored by Nathan Harold's avatar Nathan Harold Committed by Gerrit Code Review
Browse files

Merge "Add API to Retrieve Detailed SignalStrength Info"

parents 360e2528 958846fd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42732,6 +42732,7 @@ package android.telephony {
    method public int describeContents();
    method public int getCdmaDbm();
    method public int getCdmaEcio();
    method public java.util.List<android.telephony.CellSignalStrength> getCellSignalStrengths();
    method public int getEvdoDbm();
    method public int getEvdoEcio();
    method public int getEvdoSnr();
+31 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
@@ -178,6 +180,35 @@ public class SignalStrength implements Parcelable {
        return mLte;
    }

    /**
     * Returns a List of CellSignalStrength Components of this SignalStrength Report.
     *
     * Use this API to access underlying
     * {@link android.telephony#CellSignalStrength CellSignalStrength} objects that provide more
     * granular information about the SignalStrength report. Only valid (non-empty)
     * CellSignalStrengths will be returned. The order of any returned elements is not guaranteed,
     * and the list may contain more than one instance of a CellSignalStrength type.
     *
     * @return a List of CellSignalStrength or an empty List if there are no valid measurements.
     *
     * @see android.telephony#CellSignalStrength
     * @see android.telephony#CellSignalStrengthNr
     * @see android.telephony#CellSignalStrengthLte
     * @see android.telephony#CellSignalStrengthTdscdma
     * @see android.telephony#CellSignalStrengthWcdma
     * @see android.telephony#CellSignalStrengthCdma
     * @see android.telephony#CellSignalStrengthGsm
     */
    public @NonNull List<CellSignalStrength> getCellSignalStrengths() {
        List<CellSignalStrength> cssList = new ArrayList<>(2); // Usually have 2 or fewer elems
        if (mLte.isValid()) cssList.add(mLte);
        if (mCdma.isValid()) cssList.add(mCdma);
        if (mTdscdma.isValid()) cssList.add(mTdscdma);
        if (mWcdma.isValid()) cssList.add(mWcdma);
        if (mGsm.isValid()) cssList.add(mGsm);
        return cssList;
    }

    /** @hide */
    public void updateLevel(PersistableBundle cc, ServiceState ss) {
        mLteRsrpBoost = ss.getLteEarfcnRsrpBoost();