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

Commit 06d82fb3 authored by Kai Shi's avatar Kai Shi Committed by Android (Google) Code Review
Browse files

Merge "Wifi usability: add four new fields to report the latest celluar signal strength"

parents 417059b1 dfef3839
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -4934,6 +4934,10 @@ package android.net.wifi {
  public final class WifiUsabilityStatsEntry implements android.os.Parcelable {
  public final class WifiUsabilityStatsEntry implements android.os.Parcelable {
    method public int describeContents();
    method public int describeContents();
    method public int getCellularDataNetworkType();
    method public int getCellularSignalStrengthDb();
    method public int getCellularSignalStrengthDbm();
    method public boolean getIsSameRegisteredCell();
    method public int getLinkSpeedMbps();
    method public int getLinkSpeedMbps();
    method public int getProbeElapsedTimeSinceLastUpdateMillis();
    method public int getProbeElapsedTimeSinceLastUpdateMillis();
    method public int getProbeMcsRateSinceLastUpdate();
    method public int getProbeMcsRateSinceLastUpdate();
+41 −0
Original line number Original line Diff line number Diff line
@@ -1880,6 +1880,33 @@ message WifiUsabilityStatsEntry {
    PROBE_STATUS_FAILURE = 3;
    PROBE_STATUS_FAILURE = 3;
  }
  }


  // Codes for cellular data network type
  enum CellularDataNetworkType {
    // Unknown network
    NETWORK_TYPE_UNKNOWN = 0;

    // GSM network
    NETWORK_TYPE_GSM = 1;

    // CDMA network
    NETWORK_TYPE_CDMA = 2;

    // CDMA EVDO network
    NETWORK_TYPE_EVDO_0 = 3;

    // WCDMA network
    NETWORK_TYPE_UMTS = 4;

    // TDSCDMA network
    NETWORK_TYPE_TD_SCDMA = 5;

    // LTE network
    NETWORK_TYPE_LTE = 6;

    // NR network
    NETWORK_TYPE_NR = 7;
  }

  // Absolute milliseconds from device boot when these stats were sampled
  // Absolute milliseconds from device boot when these stats were sampled
  optional int64 time_stamp_ms = 1;
  optional int64 time_stamp_ms = 1;


@@ -1971,6 +1998,20 @@ message WifiUsabilityStatsEntry {
  // Whether current entry is for the same BSSID on the same frequency compared
  // Whether current entry is for the same BSSID on the same frequency compared
  // to last entry
  // to last entry
  optional bool is_same_bssid_and_freq = 29;
  optional bool is_same_bssid_and_freq = 29;

  // Cellular data network type currently in use on the device for data transmission
  optional CellularDataNetworkType cellular_data_network_type = 30;

  // Cellular signal strength in dBm, NR: CsiRsrp, LTE: Rsrp, WCDMA/TDSCDMA: Rscp,
  // CDMA: Rssi, EVDO: Rssi, GSM: Rssi
  optional int32 cellular_signal_strength_dbm = 31;

  // Cellular signal strength in dB, NR: CsiSinr, LTE: Rsrq, WCDMA: EcNo, TDSCDMA: invalid,
  // CDMA: Ecio, EVDO: SNR, GSM: invalid */
  optional int32 cellular_signal_strength_db = 32;

  // Whether the primary registered cell of current entry is same as that of previous entry
  optional bool is_same_registered_cell = 33;
}
}


message WifiUsabilityStats {
message WifiUsabilityStats {
+46 −2
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.telephony.TelephonyManager.NetworkType;


import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
@@ -98,6 +99,10 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
    private final int mProbeMcsRateSinceLastUpdate;
    private final int mProbeMcsRateSinceLastUpdate;
    /** Rx link speed at the sample time in Mbps */
    /** Rx link speed at the sample time in Mbps */
    private final int mRxLinkSpeedMbps;
    private final int mRxLinkSpeedMbps;
    private final @NetworkType int mCellularDataNetworkType;
    private final int mCellularSignalStrengthDbm;
    private final int mCellularSignalStrengthDb;
    private final boolean mIsSameRegisteredCell;


    /** Constructor function {@hide} */
    /** Constructor function {@hide} */
    public WifiUsabilityStatsEntry(long timeStampMillis, int rssi, int linkSpeedMbps,
    public WifiUsabilityStatsEntry(long timeStampMillis, int rssi, int linkSpeedMbps,
@@ -109,7 +114,10 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
            long totalHotspot2ScanTimeMillis,
            long totalHotspot2ScanTimeMillis,
            long totalCcaBusyFreqTimeMillis, long totalRadioOnFreqTimeMillis, long totalBeaconRx,
            long totalCcaBusyFreqTimeMillis, long totalRadioOnFreqTimeMillis, long totalBeaconRx,
            @ProbeStatus int probeStatusSinceLastUpdate, int probeElapsedTimeSinceLastUpdateMillis,
            @ProbeStatus int probeStatusSinceLastUpdate, int probeElapsedTimeSinceLastUpdateMillis,
            int probeMcsRateSinceLastUpdate, int rxLinkSpeedMbps) {
            int probeMcsRateSinceLastUpdate, int rxLinkSpeedMbps,
            @NetworkType int cellularDataNetworkType,
            int cellularSignalStrengthDbm, int cellularSignalStrengthDb,
            boolean isSameRegisteredCell) {
        mTimeStampMillis = timeStampMillis;
        mTimeStampMillis = timeStampMillis;
        mRssi = rssi;
        mRssi = rssi;
        mLinkSpeedMbps = linkSpeedMbps;
        mLinkSpeedMbps = linkSpeedMbps;
@@ -133,6 +141,10 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
        mProbeElapsedTimeSinceLastUpdateMillis = probeElapsedTimeSinceLastUpdateMillis;
        mProbeElapsedTimeSinceLastUpdateMillis = probeElapsedTimeSinceLastUpdateMillis;
        mProbeMcsRateSinceLastUpdate = probeMcsRateSinceLastUpdate;
        mProbeMcsRateSinceLastUpdate = probeMcsRateSinceLastUpdate;
        mRxLinkSpeedMbps = rxLinkSpeedMbps;
        mRxLinkSpeedMbps = rxLinkSpeedMbps;
        mCellularDataNetworkType = cellularDataNetworkType;
        mCellularSignalStrengthDbm = cellularSignalStrengthDbm;
        mCellularSignalStrengthDb = cellularSignalStrengthDb;
        mIsSameRegisteredCell = isSameRegisteredCell;
    }
    }


    /** Implement the Parcelable interface */
    /** Implement the Parcelable interface */
@@ -165,6 +177,10 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
        dest.writeInt(mProbeElapsedTimeSinceLastUpdateMillis);
        dest.writeInt(mProbeElapsedTimeSinceLastUpdateMillis);
        dest.writeInt(mProbeMcsRateSinceLastUpdate);
        dest.writeInt(mProbeMcsRateSinceLastUpdate);
        dest.writeInt(mRxLinkSpeedMbps);
        dest.writeInt(mRxLinkSpeedMbps);
        dest.writeInt(mCellularDataNetworkType);
        dest.writeInt(mCellularSignalStrengthDbm);
        dest.writeInt(mCellularSignalStrengthDb);
        dest.writeBoolean(mIsSameRegisteredCell);
    }
    }


    /** Implement the Parcelable interface */
    /** Implement the Parcelable interface */
@@ -179,7 +195,9 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
                    in.readLong(), in.readLong(), in.readLong(),
                    in.readLong(), in.readLong(), in.readLong(),
                    in.readLong(), in.readLong(), in.readLong(),
                    in.readLong(), in.readLong(), in.readLong(),
                    in.readLong(), in.readLong(), in.readInt(),
                    in.readLong(), in.readLong(), in.readInt(),
                    in.readInt(), in.readInt(), in.readInt()
                    in.readInt(), in.readInt(), in.readInt(),
                    in.readInt(), in.readInt(), in.readInt(),
                    in.readBoolean()
            );
            );
        }
        }


@@ -304,4 +322,30 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
    public int getRxLinkSpeedMbps() {
    public int getRxLinkSpeedMbps() {
        return mRxLinkSpeedMbps;
        return mRxLinkSpeedMbps;
    }
    }

    /** Cellular data network type currently in use on the device for data transmission */
    @NetworkType public int getCellularDataNetworkType() {
        return mCellularDataNetworkType;
    }

    /**
     * Cellular signal strength in dBm, NR: CsiRsrp, LTE: Rsrp, WCDMA/TDSCDMA: Rscp,
     * CDMA: Rssi, EVDO: Rssi, GSM: Rssi
     */
    public int getCellularSignalStrengthDbm() {
        return mCellularSignalStrengthDbm;
    }

    /**
     * Cellular signal strength in dB, NR: CsiSinr, LTE: Rsrq, WCDMA: EcNo, TDSCDMA: invalid,
     * CDMA: Ecio, EVDO: SNR, GSM: invalid
     */
    public int getCellularSignalStrengthDb() {
        return mCellularSignalStrengthDb;
    }

    /** Whether the primary registered cell of current entry is same as that of previous entry */
    public boolean getIsSameRegisteredCell() {
        return mIsSameRegisteredCell;
    }
}
}
+7 −1
Original line number Original line Diff line number Diff line
@@ -74,7 +74,8 @@ public class WifiUsabilityStatsEntryTest {


    private static WifiUsabilityStatsEntry createResult() {
    private static WifiUsabilityStatsEntry createResult() {
        return new WifiUsabilityStatsEntry(
        return new WifiUsabilityStatsEntry(
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
                14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, true
        );
        );
    }
    }


@@ -111,5 +112,10 @@ public class WifiUsabilityStatsEntryTest {
        assertEquals(expected.getProbeMcsRateSinceLastUpdate(),
        assertEquals(expected.getProbeMcsRateSinceLastUpdate(),
                actual.getProbeMcsRateSinceLastUpdate());
                actual.getProbeMcsRateSinceLastUpdate());
        assertEquals(expected.getRxLinkSpeedMbps(), actual.getRxLinkSpeedMbps());
        assertEquals(expected.getRxLinkSpeedMbps(), actual.getRxLinkSpeedMbps());
        assertEquals(expected.getCellularDataNetworkType(), actual.getCellularDataNetworkType());
        assertEquals(expected.getCellularSignalStrengthDbm(),
                actual.getCellularSignalStrengthDbm());
        assertEquals(expected.getCellularSignalStrengthDb(), actual.getCellularSignalStrengthDb());
        assertEquals(expected.getIsSameRegisteredCell(), actual.getIsSameRegisteredCell());
    }
    }
}
}