Bluetooth Framework support new BQR parameter for Android Bluetooth Metric
- Add QUALITY_REPORT_ID_ENERGY_MONITOR in BluetoothQualityReport class
for support BQR energy monitor
- Add QUALITY_REPORT_ID_RF_STATS in BluetoothQualityReport class for
support BQR RF stats
- Add new parameters in BqrCommon class for support new BQR parameters
- Add BqrEnergyMonitor classs for support BQR energy monitor event.
Bug: 358472003
Bug: 360807101
Bug: 364517559
Bug: 344812145
Flag: com.android.bluetooth.flags.support_bluetooth_quality_report_v6
Test: m com.google.android.btservices
Test: manually verified
(cherry picked from https://android-review.googlesource.com/q/commit:6668def0e10fdd44a9be5cc76dd2b3b5b6d6733f)
Merged-In: I7762ac9b70c828a384a5d6f5548274fb3e1f6b7d
Change-Id: I7762ac9b70c828a384a5d6f5548274fb3e1f6b7d
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index ba384ff..2f80051 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -894,7 +894,9 @@
field public static final int QUALITY_REPORT_ID_A2DP_CHOPPY = 3; // 0x3
field public static final int QUALITY_REPORT_ID_APPROACH_LSTO = 2; // 0x2
field public static final int QUALITY_REPORT_ID_CONN_FAIL = 8; // 0x8
+ field @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public static final int QUALITY_REPORT_ID_ENERGY_MONITOR = 6; // 0x6
field public static final int QUALITY_REPORT_ID_MONITOR = 1; // 0x1
+ field @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public static final int QUALITY_REPORT_ID_RF_STATS = 9; // 0x9
field public static final int QUALITY_REPORT_ID_SCO_CHOPPY = 4; // 0x4
}
@@ -903,8 +905,10 @@
method public int describeContents();
method public int getAfhSelectUnidealChannelCount();
method public int getCalFailedItemCount();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public int getCoexInfoMask();
method public int getConnectionHandle();
method public int getConnectionRole();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public long getCrcErrorPackets();
method public long getFlowOffCount();
method public long getLastFlowOnTimestamp();
method public long getLastTxAckTimestamp();
@@ -916,8 +920,14 @@
method public long getPiconetClock();
method public long getRetransmissionCount();
method public int getRssi();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public long getRxDupPackets();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public long getRxUnRecvPackets();
method public int getSnr();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public long getTxFlushPackets();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public long getTxLastSubeventPackets();
method public int getTxPowerLevel();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public long getTxTotalPackets();
+ method @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public long getTxUnackPackets();
method public long getUnderflowCount();
method public int getUnusedAfhChannelCount();
method @Nullable public static String packetTypeToString(int);
@@ -940,6 +950,61 @@
field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothQualityReport.BqrConnectFail> CREATOR;
}
+ @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public static final class BluetoothQualityReport.BqrEnergyMonitor implements android.os.Parcelable {
+ method public int describeContents();
+ method public long getActiveStateEnterCount();
+ method public long getActiveStateTotalTimeMillis();
+ method public int getAverageCurrentConsumptionMicroamps();
+ method public int getBredrAverageTxPowerLeveldBm();
+ method public long getBredrRxStateEnterCount();
+ method public long getBredrRxTotalTimeMillis();
+ method public long getBredrTxStateEnterCount();
+ method public long getBredrTxTotalTimeMillis();
+ method public long getIdleStateEnterCount();
+ method public long getIdleStateTotalTimeMillis();
+ method public int getLeAverageTxPowerLeveldBm();
+ method public long getLeRxStateEnterCount();
+ method public long getLeRxTotalTimeMillis();
+ method public long getLeTsTotalTimeMillis();
+ method public long getLeTxStateEnterCount();
+ method public long getPowerDataTotalTimeMillis();
+ method public long getRxDualChainActiveDurationMillis();
+ method public long getRxSingleChainActiveDurationMillis();
+ method public long getTxExternalPaDualChainActiveDurationMillis();
+ method public long getTxExternalPaSingleChainActiveDurationMillis();
+ method public long getTxInternalPaDualChainActiveDurationMillis();
+ method public long getTxInternalPaSingleChainActiveDurationMillis();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothQualityReport.BqrEnergyMonitor> CREATOR;
+ }
+
+ @FlaggedApi("com.android.bluetooth.flags.support_bluetooth_quality_report_v6") public static final class BluetoothQualityReport.BqrRfStats implements android.os.Parcelable {
+ method public int describeContents();
+ method public int getExtensionInfo();
+ method public long getPacketsWithRssi50To55dBm();
+ method public long getPacketsWithRssi55To60dBm();
+ method public long getPacketsWithRssi60To65dBm();
+ method public long getPacketsWithRssi65To70dBm();
+ method public long getPacketsWithRssi70To75dBm();
+ method public long getPacketsWithRssi75To80dBm();
+ method public long getPacketsWithRssi80To85dBm();
+ method public long getPacketsWithRssi85To90dBm();
+ method public long getPacketsWithRssiAboveMinus50dBm();
+ method public long getPacketsWithRssiBelowMinus90dBm();
+ method public long getPacketsWithRssiDelta2To5dBm();
+ method public long getPacketsWithRssiDelta5To8dBm();
+ method public long getPacketsWithRssiDelta8To11dBm();
+ method public long getPacketsWithRssiDeltaAbove11dBm();
+ method public long getPacketsWithRssiDeltaBelow2dBm();
+ method public long getPerformanceDurationMillis();
+ method public long getTxPowerExternalPaBeamformingCount();
+ method public long getTxPowerExternalPaDiversityCount();
+ method public long getTxPowerInternalPaBeamformingCount();
+ method public long getTxPowerInternalPaDiversityCount();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothQualityReport.BqrRfStats> CREATOR;
+ }
+
public static final class BluetoothQualityReport.BqrVsA2dpChoppy implements android.os.Parcelable {
method public int describeContents();
method public int getAclTxQueueLength();
diff --git a/framework/java/android/bluetooth/BluetoothQualityReport.java b/framework/java/android/bluetooth/BluetoothQualityReport.java
index c1b38de..b3dae7d 100644
--- a/framework/java/android/bluetooth/BluetoothQualityReport.java
+++ b/framework/java/android/bluetooth/BluetoothQualityReport.java
@@ -17,6 +17,8 @@
package android.bluetooth;
+import android.annotation.DurationMillisLong;
+import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -25,6 +27,8 @@
import android.os.Parcelable;
import android.util.Log;
+import com.android.bluetooth.flags.Flags;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.ByteBuffer;
@@ -52,6 +56,10 @@
* <li>For Connect fail event, you can call {@link #getBqrCommon} to get a {@link
* BluetoothQualityReport.BqrCommon} object, and call {@link #getBqrEvent} to get a {@link
* BluetoothQualityReport.BqrConnectFail} object.
+ * <li>For Energy monitor event, you can call {@link #getBqrEvent} to get a {@link
+ * BluetoothQualityReport.BqrEnergyMonitor} object.
+ * <li>For RF stats event, you can call {@link #getBqrEvent} to get a {@link
+ * BluetoothQualityReport.BqrRfStats} object.
* </ul>
*
* @hide
@@ -88,6 +96,24 @@
*/
@SystemApi public static final int QUALITY_REPORT_ID_SCO_CHOPPY = 0x04;
+ // Report ID 0x05 is reserved for Root inflammation event,
+ // which indicates a fatal error in the Bluetooth HAL or controller.
+ // This event requires a Bluetooth stack restart and is not passed
+ // to the framework. It is not explicitly defined as a System API
+ // because it is handled internally within the Bluetooth stack.
+
+ /**
+ * Quality report ID: Energy Monitor.
+ *
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public static final int QUALITY_REPORT_ID_ENERGY_MONITOR = 0x06;
+
+ // Report ID 0x07 is reserved for LE Audio Choppy events. This ID will be used
+ // in a future version to indicate instances of choppy audio playback
+ // experienced with LE Audio connections. It is currently not handled.
/**
* Quality report ID: Connect Fail.
*
@@ -95,6 +121,15 @@
*/
@SystemApi public static final int QUALITY_REPORT_ID_CONN_FAIL = 0x08;
+ /**
+ * Quality report ID: RF Stats.
+ *
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public static final int QUALITY_REPORT_ID_RF_STATS = 0x09;
+
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(
@@ -104,7 +139,9 @@
QUALITY_REPORT_ID_APPROACH_LSTO,
QUALITY_REPORT_ID_A2DP_CHOPPY,
QUALITY_REPORT_ID_SCO_CHOPPY,
+ QUALITY_REPORT_ID_ENERGY_MONITOR,
QUALITY_REPORT_ID_CONN_FAIL,
+ QUALITY_REPORT_ID_RF_STATS,
})
public @interface QualityReportId {}
@@ -120,6 +157,8 @@
private BqrVsA2dpChoppy mBqrVsA2dpChoppy;
private BqrVsScoChoppy mBqrVsScoChoppy;
private BqrConnectFail mBqrConnectFail;
+ private BqrEnergyMonitor mBqrEnergyMonitor;
+ private BqrRfStats mBqrRfStats;
enum PacketType {
INVALID,
@@ -235,6 +274,12 @@
}
}
+ /**
+ * Constructs a {@link BluetoothQualityReport} from raw byte data.
+ *
+ * <p>This constructor is intended for testing and internal use. It should not be used directly
+ * in application code.
+ */
private BluetoothQualityReport(
String remoteAddr,
int lmpVer,
@@ -264,6 +309,15 @@
} else if (id == QUALITY_REPORT_ID_CONN_FAIL) {
mBqrConnectFail = new BqrConnectFail(rawData, vsPartOffset);
} else {
+ if (Flags.supportBluetoothQualityReportV6()) {
+ if (id == QUALITY_REPORT_ID_ENERGY_MONITOR) {
+ mBqrEnergyMonitor = new BqrEnergyMonitor(rawData, 1);
+ return;
+ } else if (id == QUALITY_REPORT_ID_RF_STATS) {
+ mBqrRfStats = new BqrRfStats(rawData, 1);
+ return;
+ }
+ }
throw new IllegalArgumentException(TAG + ": unknown quality report id:" + id);
}
}
@@ -287,6 +341,14 @@
} else if (id == QUALITY_REPORT_ID_CONN_FAIL) {
mBqrConnectFail = new BqrConnectFail(in);
}
+
+ if (Flags.supportBluetoothQualityReportV6()) {
+ if (id == QUALITY_REPORT_ID_ENERGY_MONITOR) {
+ mBqrEnergyMonitor = new BqrEnergyMonitor(in);
+ } else if (id == QUALITY_REPORT_ID_RF_STATS) {
+ mBqrRfStats = new BqrRfStats(in);
+ }
+ }
}
/**
@@ -407,7 +469,17 @@
if (mBqrCommon == null) {
return null;
}
- switch (mBqrCommon.getQualityReportId()) {
+ int id = mBqrCommon.getQualityReportId();
+
+ if (Flags.supportBluetoothQualityReportV6()) {
+ if (id == QUALITY_REPORT_ID_ENERGY_MONITOR) {
+ return mBqrEnergyMonitor;
+ } else if (id == QUALITY_REPORT_ID_RF_STATS) {
+ return mBqrRfStats;
+ }
+ }
+
+ switch (id) {
case QUALITY_REPORT_ID_MONITOR:
return mBqrCommon;
case QUALITY_REPORT_ID_APPROACH_LSTO:
@@ -436,12 +508,7 @@
}
};
- /**
- * Describe contents.
- *
- * @return 0
- * @hide
- */
+ @Override
public int describeContents() {
return 0;
}
@@ -471,6 +538,14 @@
} else if (id == QUALITY_REPORT_ID_CONN_FAIL) {
mBqrConnectFail.writeToParcel(out, flags);
}
+
+ if (Flags.supportBluetoothQualityReportV6()) {
+ if (id == QUALITY_REPORT_ID_ENERGY_MONITOR) {
+ mBqrEnergyMonitor.writeToParcel(out, flags);
+ } else if (id == QUALITY_REPORT_ID_RF_STATS) {
+ mBqrRfStats.writeToParcel(out, flags);
+ }
+ }
}
/** BluetoothQualityReport to String. */
@@ -503,6 +578,14 @@
str = str + "}";
}
+ if (Flags.supportBluetoothQualityReportV6()) {
+ if (id == QUALITY_REPORT_ID_ENERGY_MONITOR) {
+ str = str + mBqrEnergyMonitor + "\n}";
+ } else if (id == QUALITY_REPORT_ID_RF_STATS) {
+ str = str + mBqrRfStats + "\n}";
+ }
+ }
+
return str;
}
@@ -658,7 +741,7 @@
@SystemApi
public static final class BqrCommon implements Parcelable {
private static final String TAG = BluetoothQualityReport.TAG + ".BqrCommon";
- static final int BQR_COMMON_LEN = 55;
+ static final int BQR_COMMON_LEN = 85;
private @QualityReportId int mQualityReportId;
private int mPacketType;
@@ -681,8 +764,25 @@
private long mUnderflowCount;
private String mAddr;
private int mCalFailedItemCount;
+ private long mTxTotalPackets;
+ private long mTxUnackPackets;
+ private long mTxFlushPackets;
+ private long mTxLastSubeventPackets;
+ private long mCrcErrorPackets;
+ private long mRxDupPackets;
+ private long mRxUnRecvPackets;
+ private int mCoexInfoMask;
private BqrCommon(byte[] rawData, int offset) {
+
+ mQualityReportId = rawData[0] & 0xFF;
+ if (Flags.supportBluetoothQualityReportV6()) {
+ if ((mQualityReportId == QUALITY_REPORT_ID_ENERGY_MONITOR)
+ || (mQualityReportId == QUALITY_REPORT_ID_RF_STATS)) {
+ return;
+ }
+ }
+
if (rawData == null || rawData.length < offset + BQR_COMMON_LEN) {
throw new IllegalArgumentException(TAG + ": BQR raw data length is abnormal.");
}
@@ -691,7 +791,7 @@
ByteBuffer.wrap(rawData, offset, rawData.length - offset).asReadOnlyBuffer();
bqrBuf.order(ByteOrder.LITTLE_ENDIAN);
- mQualityReportId = bqrBuf.get() & 0xFF;
+ bqrBuf.get();
mPacketType = bqrBuf.get() & 0xFF;
mConnectionHandle = bqrBuf.getShort() & 0xFFFF;
mConnectionRole = bqrBuf.get() & 0xFF;
@@ -722,6 +822,14 @@
bqrBuf.get(currentOffset + 0));
bqrBuf.position(currentOffset + 6);
mCalFailedItemCount = bqrBuf.get() & 0xFF;
+ mTxTotalPackets = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxUnackPackets = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxFlushPackets = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxLastSubeventPackets = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mCrcErrorPackets = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRxDupPackets = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRxUnRecvPackets = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mCoexInfoMask = bqrBuf.getShort() & 0xFFFF;
}
private BqrCommon(Parcel in) {
@@ -746,6 +854,14 @@
mUnderflowCount = in.readLong();
mAddr = in.readString();
mCalFailedItemCount = in.readInt();
+ mTxTotalPackets = in.readLong();
+ mTxUnackPackets = in.readLong();
+ mTxFlushPackets = in.readLong();
+ mTxLastSubeventPackets = in.readLong();
+ mCrcErrorPackets = in.readLong();
+ mRxDupPackets = in.readLong();
+ mRxUnRecvPackets = in.readLong();
+ mCoexInfoMask = in.readInt();
}
@QualityReportId
@@ -754,6 +870,15 @@
}
static String qualityReportIdToString(@QualityReportId int id) {
+
+ if (Flags.supportBluetoothQualityReportV6()) {
+ if (QUALITY_REPORT_ID_ENERGY_MONITOR == id) {
+ return "Energy Monitor";
+ } else if (QUALITY_REPORT_ID_RF_STATS == id) {
+ return "RF Stats";
+ }
+ }
+
switch (id) {
case QUALITY_REPORT_ID_MONITOR:
return "Quality monitor";
@@ -1039,11 +1164,105 @@
}
/**
- * Describe contents.
+ * Gets the total number of packets transmitted.
*
- * @return 0
+ * @return the total number of transmitted packets
* @hide
*/
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public long getTxTotalPackets() {
+ return mTxTotalPackets;
+ }
+
+ /**
+ * Gets the number of transmitted packets that did not receive an acknowledgment.
+ *
+ * @return the number of unacknowledged packets
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public long getTxUnackPackets() {
+ return mTxUnackPackets;
+ }
+
+ /**
+ * Gets the number of packets that were not sent out by their flush point.
+ *
+ * @return the number of packets not sent due to flush
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public long getTxFlushPackets() {
+ return mTxFlushPackets;
+ }
+
+ /**
+ * Gets the number of CIS (Connected Isochronous Stream) Data PDUs transmitted by the Link
+ * Layer in the last subevent of a CIS event.
+ *
+ * @return the number of CIS Data PDUs transmitted in the last subevent
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public long getTxLastSubeventPackets() {
+ return mTxLastSubeventPackets;
+ }
+
+ /**
+ * Gets the number of received packets with CRC (Cyclic Redundancy Check) errors since the
+ * last event.
+ *
+ * @return the number of packets received with CRC errors
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public long getCrcErrorPackets() {
+ return mCrcErrorPackets;
+ }
+
+ /**
+ * Gets the number of duplicate (retransmitted) packets received since the last event.
+ *
+ * @return the number of duplicate packets received
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public long getRxDupPackets() {
+ return mRxDupPackets;
+ }
+
+ /**
+ * Gets the number of unreceived packets. This value corresponds to the parameter of the LE
+ * Read ISO Link Quality command.
+ *
+ * @return the number of unreceived packets
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public long getRxUnRecvPackets() {
+ return mRxUnRecvPackets;
+ }
+
+ /**
+ * Gets the coexistence information mask.
+ *
+ * @return the coexistence information mask value
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public int getCoexInfoMask() {
+ return mCoexInfoMask;
+ }
+
+ @Override
public int describeContents() {
return 0;
}
@@ -1077,6 +1296,14 @@
dest.writeLong(mUnderflowCount);
BluetoothUtils.writeStringToParcel(dest, mAddr);
dest.writeInt(mCalFailedItemCount);
+ dest.writeLong(mTxTotalPackets);
+ dest.writeLong(mTxUnackPackets);
+ dest.writeLong(mTxFlushPackets);
+ dest.writeLong(mTxLastSubeventPackets);
+ dest.writeLong(mCrcErrorPackets);
+ dest.writeLong(mRxDupPackets);
+ dest.writeLong(mRxUnRecvPackets);
+ dest.writeInt(mCoexInfoMask);
}
/** @hide */
@@ -1152,6 +1379,23 @@
+ mAddr
+ ", mCalFailedItemCount: "
+ mCalFailedItemCount
+ + ",\n"
+ + " mTxTotalPackets: "
+ + mTxTotalPackets
+ + ", mTxUnackPackets: "
+ + mTxUnackPackets
+ + ", mTxFlushPackets: "
+ + mTxFlushPackets
+ + ", mTxLastSubeventPackets: "
+ + mTxLastSubeventPackets
+ + ", mCrcErrorPackets: "
+ + mCrcErrorPackets
+ + ", mRxDupPackets: "
+ + mRxDupPackets
+ + ", mRxUnRecvPackets: "
+ + mRxUnRecvPackets
+ + ", mCoexInfoMask: "
+ + mCoexInfoMask
+ "\n }";
return str;
@@ -1307,12 +1551,7 @@
return mLastTxAckTimestamp;
}
- /**
- * Describe contents.
- *
- * @return 0
- * @hide
- */
+ @Override
public int describeContents() {
return 0;
}
@@ -1515,12 +1754,7 @@
return q.toString();
}
- /**
- * Describe contents.
- *
- * @return 0
- * @hide
- */
+ @Override
public int describeContents() {
return 0;
}
@@ -1877,12 +2111,7 @@
return mGoodRxFrameCount;
}
- /**
- * Describe contents.
- *
- * @return 0
- * @hide
- */
+ @Override
public int describeContents() {
return 0;
}
@@ -2069,12 +2298,7 @@
return mFailReason;
}
- /**
- * Describe contents.
- *
- * @return 0
- * @hide
- */
+ @Override
public int describeContents() {
return 0;
}
@@ -2145,4 +2369,914 @@
return str;
}
}
+
+ /**
+ * This class provides APIs to access the Energy Monitoring events from the Bluetooth Quality
+ * Report. It includes detailed information about the energy consumption of various Bluetooth
+ * operations, such as transmit and receive times for both BR/EDR and LE connections, as well as
+ * time spent in different power states.
+ *
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public static final class BqrEnergyMonitor implements Parcelable {
+ private static final String TAG = BluetoothQualityReport.TAG + ".BqrEnergyMonitor";
+
+ private int mAvgCurrentConsume;
+ private long mIdleTotalTime;
+ private long mIdleStateEnterCount;
+ private long mActiveTotalTime;
+ private long mActiveStateEnterCount;
+ private long mBredrTxTotalTime;
+ private long mBredrTxStateEnterCount;
+ private int mBredrTxAvgPowerLevel;
+ private long mBredrRxTotalTime;
+ private long mBredrRxStateEnterCount;
+ private long mLeTxTotalTime;
+ private long mLeTxStateEnterCount;
+ private int mLeTxAvgPowerLevel;
+ private long mLeRxTotalTime;
+ private long mLeRxStateEnterCount;
+ private long mReportTotalTime;
+ private long mRxActiveOneChainTime;
+ private long mRxActiveTwoChainTime;
+ private long mTxiPaActiveOneChainTime;
+ private long mTxiPaActiveTwoChainTime;
+ private long mTxePaActiveOneChainTime;
+ private long mTxePaActiveTwoChainTime;
+
+ private BqrEnergyMonitor(byte[] rawData, int offset) {
+ if (rawData == null || rawData.length <= offset) {
+ throw new IllegalArgumentException(
+ TAG + ": BQR EnergyMonitor raw data length is abnormal.");
+ }
+
+ ByteBuffer bqrBuf =
+ ByteBuffer.wrap(rawData, offset, rawData.length - offset).asReadOnlyBuffer();
+ bqrBuf.order(ByteOrder.LITTLE_ENDIAN);
+
+ mAvgCurrentConsume = bqrBuf.getShort() & 0xFFFF;
+ mIdleTotalTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mIdleStateEnterCount = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mActiveTotalTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mActiveStateEnterCount = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mBredrTxTotalTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mBredrTxStateEnterCount = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mBredrTxAvgPowerLevel = bqrBuf.get() & 0xFF;
+ mBredrRxTotalTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mBredrRxStateEnterCount = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mLeTxTotalTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mLeTxStateEnterCount = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mLeTxAvgPowerLevel = bqrBuf.get() & 0xFF;
+ mLeRxTotalTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mLeRxStateEnterCount = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mReportTotalTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRxActiveOneChainTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRxActiveTwoChainTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxiPaActiveOneChainTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxiPaActiveTwoChainTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxePaActiveOneChainTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxePaActiveTwoChainTime = bqrBuf.getInt() & 0xFFFFFFFFL;
+ }
+
+ private BqrEnergyMonitor(Parcel in) {
+ mAvgCurrentConsume = in.readInt();
+ mIdleTotalTime = in.readLong();
+ mIdleStateEnterCount = in.readLong();
+ mActiveTotalTime = in.readLong();
+ mActiveStateEnterCount = in.readLong();
+ mBredrTxTotalTime = in.readLong();
+ mBredrTxStateEnterCount = in.readLong();
+ mBredrTxAvgPowerLevel = in.readInt();
+ mBredrRxTotalTime = in.readLong();
+ mBredrRxStateEnterCount = in.readLong();
+ mLeTxTotalTime = in.readLong();
+ mLeTxStateEnterCount = in.readLong();
+ mLeTxAvgPowerLevel = in.readInt();
+ mLeRxTotalTime = in.readLong();
+ mLeRxStateEnterCount = in.readLong();
+ mReportTotalTime = in.readLong();
+ mRxActiveOneChainTime = in.readLong();
+ mRxActiveTwoChainTime = in.readLong();
+ mTxiPaActiveOneChainTime = in.readLong();
+ mTxiPaActiveTwoChainTime = in.readLong();
+ mTxePaActiveOneChainTime = in.readLong();
+ mTxePaActiveTwoChainTime = in.readLong();
+ }
+
+ /**
+ * Gets the average current consumption of all activities consumed by the controller in
+ * microamps.
+ *
+ * @return the average current consumption in microamps
+ * @hide
+ */
+ @SystemApi
+ public int getAverageCurrentConsumptionMicroamps() {
+ return mAvgCurrentConsume;
+ }
+
+ /**
+ * Gets the total time the controller has spent in the idle state (low power states, sleep)
+ * in milliseconds.
+ *
+ * @return the total time in the idle state in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getIdleStateTotalTimeMillis() {
+ return mIdleTotalTime;
+ }
+
+ /**
+ * Gets the number of times the controller has entered the idle state.
+ *
+ * @return the number of times the controller has entered the idle state
+ * @hide
+ */
+ @SystemApi
+ public long getIdleStateEnterCount() {
+ return mIdleStateEnterCount;
+ }
+
+ /**
+ * Gets the total time the controller has spent in the active state (inquiring, paging,
+ * ACL/SCO/eSCO/BIS/CIS traffic, processing any task) in milliseconds.
+ *
+ * @return the total time in the active state in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getActiveStateTotalTimeMillis() {
+ return mActiveTotalTime;
+ }
+
+ /**
+ * Gets the number of times the controller has entered the active state.
+ *
+ * @return the number of times the controller has entered the active state
+ * @hide
+ */
+ @SystemApi
+ public long getActiveStateEnterCount() {
+ return mActiveStateEnterCount;
+ }
+
+ /**
+ * Gets the total time the controller has spent transmitting BR/EDR data (ACL/SCO/eSCO
+ * traffic) in milliseconds.
+ *
+ * @return the total time spent in the BR/EDR transmit state in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getBredrTxTotalTimeMillis() {
+ return mBredrTxTotalTime;
+ }
+
+ /**
+ * Gets the number of times the controller has entered the BR/EDR transmit state.
+ *
+ * @return the number of times the controller has entered the BR/EDR transmit state
+ * @hide
+ */
+ @SystemApi
+ public long getBredrTxStateEnterCount() {
+ return mBredrTxStateEnterCount;
+ }
+
+ /**
+ * Gets the average transmit power level of all BR/EDR links in dBm.
+ *
+ * @return the average transmit power level of all BR/EDR links in dBm
+ * @hide
+ */
+ @SystemApi
+ public int getBredrAverageTxPowerLeveldBm() {
+ return mBredrTxAvgPowerLevel;
+ }
+
+ /**
+ * Gets the total time the controller has spent receiving BR/EDR data (ACL/SCO/eSCO traffic)
+ * in milliseconds.
+ *
+ * @return the total time spent in the BR/EDR receive state in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getBredrRxTotalTimeMillis() {
+ return mBredrRxTotalTime;
+ }
+
+ /**
+ * Gets the number of times the controller has entered the BR/EDR receive state.
+ *
+ * @return the number of times the controller has entered the BR/EDR receive state
+ * @hide
+ */
+ @SystemApi
+ public long getBredrRxStateEnterCount() {
+ return mBredrRxStateEnterCount;
+ }
+
+ /**
+ * Gets the total time the controller has spent transmitting LE data (ACL/BIS/CIS or LE
+ * advertising traffic) in milliseconds.
+ *
+ * @return the total time spent in the LE transmit state in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getLeTsTotalTimeMillis() {
+ return mLeTxTotalTime;
+ }
+
+ /**
+ * Gets the number of times the controller has entered the LE transmit state.
+ *
+ * @return the number of times the controller has entered the LE transmit state
+ * @hide
+ */
+ @SystemApi
+ public long getLeTxStateEnterCount() {
+ return mLeTxStateEnterCount;
+ }
+
+ /**
+ * Gets the average transmit power level of all LE links in dBm.
+ *
+ * @return the average transmit power level of all LE links in dBm
+ * @hide
+ */
+ @SystemApi
+ public int getLeAverageTxPowerLeveldBm() {
+ return mLeTxAvgPowerLevel;
+ }
+
+ /**
+ * Gets the total time the controller has spent receiving LE data (ACL/BIS/CIS or LE
+ * scanning traffic) in milliseconds.
+ *
+ * @return the total time spent in the LE receive state in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getLeRxTotalTimeMillis() {
+ return mLeRxTotalTime;
+ }
+
+ /**
+ * Gets the number of times the controller has entered the LE receive state.
+ *
+ * @return the number of times the controller has entered the LE receive state
+ * @hide
+ */
+ @SystemApi
+ public long getLeRxStateEnterCount() {
+ return mLeRxStateEnterCount;
+ }
+
+ /**
+ * Gets the total time duration over which power-related information has been collected in
+ * milliseconds.
+ *
+ * @return the total time duration for power data collection in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getPowerDataTotalTimeMillis() {
+ return mReportTotalTime;
+ }
+
+ /**
+ * Gets the time duration of the receiver being active with one antenna chain in
+ * milliseconds.
+ *
+ * @return the time duration of single-chain receiver activity in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getRxSingleChainActiveDurationMillis() {
+ return mRxActiveOneChainTime;
+ }
+
+ /**
+ * Gets the time duration of the receiver being active with two antenna chains in
+ * milliseconds.
+ *
+ * @return the time duration of dual-chain receiver activity in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getRxDualChainActiveDurationMillis() {
+ return mRxActiveTwoChainTime;
+ }
+
+ /**
+ * Gets the time duration of the internal transmitter being active with one antenna chain in
+ * milliseconds.
+ *
+ * @return the time duration of single-chain internal transmitter activity in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getTxInternalPaSingleChainActiveDurationMillis() {
+ return mTxiPaActiveOneChainTime;
+ }
+
+ /**
+ * Gets the time duration of the internal transmitter being active with two antenna chains
+ * in milliseconds.
+ *
+ * @return the time duration of dual-chain internal transmitter activity in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getTxInternalPaDualChainActiveDurationMillis() {
+ return mTxiPaActiveTwoChainTime;
+ }
+
+ /**
+ * Gets the time duration of the external transmitter being active with one antenna chain in
+ * milliseconds.
+ *
+ * @return the time duration of single-chain external transmitter activity in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getTxExternalPaSingleChainActiveDurationMillis() {
+ return mTxePaActiveOneChainTime;
+ }
+
+ /**
+ * Gets the time duration of the external transmitter being active with two antenna chains
+ * in milliseconds.
+ *
+ * @return the time duration of dual-chain external transmitter activity in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getTxExternalPaDualChainActiveDurationMillis() {
+ return mTxePaActiveTwoChainTime;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Write BqrEnergyMonitor to parcel.
+ *
+ * @hide
+ */
+ @SystemApi
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeInt(mAvgCurrentConsume);
+ dest.writeLong(mIdleTotalTime);
+ dest.writeLong(mIdleStateEnterCount);
+ dest.writeLong(mActiveTotalTime);
+ dest.writeLong(mActiveStateEnterCount);
+ dest.writeLong(mBredrTxTotalTime);
+ dest.writeLong(mBredrTxStateEnterCount);
+ dest.writeInt(mBredrTxAvgPowerLevel);
+ dest.writeLong(mBredrRxTotalTime);
+ dest.writeLong(mBredrRxStateEnterCount);
+ dest.writeLong(mLeTxTotalTime);
+ dest.writeLong(mLeTxStateEnterCount);
+ dest.writeInt(mLeTxAvgPowerLevel);
+ dest.writeLong(mLeRxTotalTime);
+ dest.writeLong(mLeRxStateEnterCount);
+ dest.writeLong(mReportTotalTime);
+ dest.writeLong(mRxActiveOneChainTime);
+ dest.writeLong(mRxActiveTwoChainTime);
+ dest.writeLong(mTxiPaActiveOneChainTime);
+ dest.writeLong(mTxiPaActiveTwoChainTime);
+ dest.writeLong(mTxePaActiveOneChainTime);
+ dest.writeLong(mTxePaActiveTwoChainTime);
+ }
+
+ /** @hide */
+ @SystemApi
+ public static final @NonNull Parcelable.Creator<BqrEnergyMonitor> CREATOR =
+ new Parcelable.Creator<BqrEnergyMonitor>() {
+ public BqrEnergyMonitor createFromParcel(Parcel in) {
+ return new BqrEnergyMonitor(in);
+ }
+
+ public BqrEnergyMonitor[] newArray(int size) {
+ return new BqrEnergyMonitor[size];
+ }
+ };
+
+ /** BqrVsLsto to String. */
+ @Override
+ @NonNull
+ public String toString() {
+ return " BqrEnergyMonitor: {\n"
+ + " AvgCurrentConsume: "
+ + mAvgCurrentConsume
+ + ", mIdleTotalTime: "
+ + mIdleTotalTime
+ + ", mIdleStateEnterCount: "
+ + mIdleStateEnterCount
+ + ", mActiveTotalTime: "
+ + mActiveTotalTime
+ + ", mActiveStateEnterCount: "
+ + mActiveStateEnterCount
+ + ",\n"
+ + " mBredrTxTotalTime: "
+ + mBredrTxTotalTime
+ + ", mBredrTxStateEnterCount: "
+ + mBredrTxStateEnterCount
+ + ", mBredrTxAvgPowerLevel: "
+ + mBredrTxAvgPowerLevel
+ + ", mBredrRxTotalTime: "
+ + mBredrRxTotalTime
+ + ", mBredrRxStateEnterCount: "
+ + mBredrRxStateEnterCount
+ + ", mLeTxTotalTime: "
+ + mLeTxTotalTime
+ + ", mLeTxStateEnterCount: "
+ + mLeTxStateEnterCount
+ + ", mLeTxAvgPowerLevel: "
+ + mLeTxAvgPowerLevel
+ + ", mLeRxTotalTime: "
+ + mLeRxTotalTime
+ + ", mLeRxStateEnterCount: "
+ + mLeRxStateEnterCount
+ + ", mReportTotalTime: "
+ + mReportTotalTime
+ + ", mRxActiveOneChainTime: "
+ + mRxActiveOneChainTime
+ + ", mRxActiveTwoChainTime: "
+ + mRxActiveTwoChainTime
+ + ", mTxiPaActiveOneChainTime: "
+ + mTxiPaActiveOneChainTime
+ + ", mTxiPaActiveTwoChainTime: "
+ + mTxiPaActiveTwoChainTime
+ + ", mTxePaActiveOneChainTime: "
+ + mTxePaActiveOneChainTime
+ + ", mTxePaActiveTwoChainTime: "
+ + mTxePaActiveTwoChainTime
+ + "\n }";
+ }
+ }
+
+ /**
+ * This class provides APIs to access RF statistics events from the Bluetooth Quality Report. It
+ * includes detailed information about received signal strength (RSSI) across different antenna
+ * chains, transmit power levels, and packet counts for various transmission and reception
+ * scenarios. This data can be used to analyze RF performance and identify potential issues in
+ * Bluetooth connections.
+ *
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_SUPPORT_BLUETOOTH_QUALITY_REPORT_V6)
+ @SystemApi
+ public static final class BqrRfStats implements Parcelable {
+ private static final String TAG = BluetoothQualityReport.TAG + ".BqrRfStats";
+
+ private int mExtensionInfo;
+ private long mReportTimePeriod;
+ private long mTxPoweriPaBf;
+ private long mTxPowerePaBf;
+ private long mTxPoweriPaDiv;
+ private long mTxPowerePaDiv;
+ private long mRssiChainOver50;
+ private long mRssiChain50To55;
+ private long mRssiChain55To60;
+ private long mRssiChain60To65;
+ private long mRssiChain65To70;
+ private long mRssiChain70To75;
+ private long mRssiChain75To80;
+ private long mRssiChain80To85;
+ private long mRssiChain85To90;
+ private long mRssiChainUnder90;
+ private long mRssiDeltaUnder2;
+ private long mRssiDelta2To5;
+ private long mRssiDelta5To8;
+ private long mRssiDelta8To11;
+ private long mRssiDeltaOver11;
+
+ private BqrRfStats(byte[] rawData, int offset) {
+ if (rawData == null || rawData.length <= offset) {
+ throw new IllegalArgumentException(
+ TAG + ": BQR RF Stats raw data length is abnormal.");
+ }
+
+ ByteBuffer bqrBuf =
+ ByteBuffer.wrap(rawData, offset, rawData.length - offset).asReadOnlyBuffer();
+ bqrBuf.order(ByteOrder.LITTLE_ENDIAN);
+
+ mExtensionInfo = bqrBuf.get() & 0xFF;
+ mReportTimePeriod = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxPoweriPaBf = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxPowerePaBf = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxPoweriPaDiv = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mTxPowerePaDiv = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChainOver50 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain50To55 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain55To60 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain60To65 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain65To70 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain70To75 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain75To80 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain80To85 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChain85To90 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiChainUnder90 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiDeltaUnder2 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiDelta2To5 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiDelta5To8 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiDelta8To11 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ mRssiDeltaOver11 = bqrBuf.getInt() & 0xFFFFFFFFL;
+ }
+
+ private BqrRfStats(Parcel in) {
+ mExtensionInfo = in.readInt();
+ mReportTimePeriod = in.readLong();
+ mTxPoweriPaBf = in.readLong();
+ mTxPowerePaBf = in.readLong();
+ mTxPoweriPaDiv = in.readLong();
+ mTxPowerePaDiv = in.readLong();
+ mRssiChainOver50 = in.readLong();
+ mRssiChain50To55 = in.readLong();
+ mRssiChain55To60 = in.readLong();
+ mRssiChain60To65 = in.readLong();
+ mRssiChain65To70 = in.readLong();
+ mRssiChain70To75 = in.readLong();
+ mRssiChain75To80 = in.readLong();
+ mRssiChain80To85 = in.readLong();
+ mRssiChain85To90 = in.readLong();
+ mRssiChainUnder90 = in.readLong();
+ mRssiDeltaUnder2 = in.readLong();
+ mRssiDelta2To5 = in.readLong();
+ mRssiDelta5To8 = in.readLong();
+ mRssiDelta8To11 = in.readLong();
+ mRssiDeltaOver11 = in.readLong();
+ }
+
+ /**
+ * Gets the extension Info for the RF stats event.
+ *
+ * @return the extension information for the RF stats event
+ * @hide
+ */
+ @SystemApi
+ public int getExtensionInfo() {
+ return mExtensionInfo;
+ }
+
+ /**
+ * Gets the time duration over which performance information has been collected in
+ * milliseconds.
+ *
+ * @return the time duration for performance data collection in milliseconds
+ * @hide
+ */
+ @SystemApi
+ @DurationMillisLong
+ public long getPerformanceDurationMillis() {
+ return mReportTimePeriod;
+ }
+
+ /**
+ * Gets the packet count for transmissions using internal PA (iPA) beamforming.
+ *
+ * @return the packet count for iPA beamforming transmissions
+ * @hide
+ */
+ @SystemApi
+ public long getTxPowerInternalPaBeamformingCount() {
+ return mTxPoweriPaBf;
+ }
+
+ /**
+ * Gets the packet count for transmissions using external PA (ePA) beamforming.
+ *
+ * @return the packet count for ePA beamforming transmissions
+ * @hide
+ */
+ @SystemApi
+ public long getTxPowerExternalPaBeamformingCount() {
+ return mTxPowerePaBf;
+ }
+
+ /**
+ * Gets the packet count for transmissions using internal PA (iPA) diversity.
+ *
+ * @return the packet count for iPA diversity transmissions
+ * @hide
+ */
+ @SystemApi
+ public long getTxPowerInternalPaDiversityCount() {
+ return mTxPoweriPaDiv;
+ }
+
+ /**
+ * Gets the packet count for transmissions using external PA (ePA) diversity.
+ *
+ * @return the packet count for ePA diversity transmissions
+ * @hide
+ */
+ @SystemApi
+ public long getTxPowerExternalPaDiversityCount() {
+ return mTxPowerePaDiv;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI (Received Signal Strength
+ * Indicator) greater than -50 dBm on any antenna chain.
+ *
+ * @return the packet count for RSSI stronger than -50 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssiAboveMinus50dBm() {
+ return mRssiChainOver50;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -50 dBm and -55 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -50 dBm and -55 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi50To55dBm() {
+ return mRssiChain50To55;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -55 dBm and -60 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -55 dBm and -60 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi55To60dBm() {
+ return mRssiChain55To60;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -60 dBm and -65 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -60 dBm and -65 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi60To65dBm() {
+ return mRssiChain60To65;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -65 dBm and -70 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -65 dBm and -70 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi65To70dBm() {
+ return mRssiChain65To70;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -70 dBm and -75 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -70 dBm and -75 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi70To75dBm() {
+ return mRssiChain70To75;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -75 dBm and -80 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -75 dBm and -80 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi75To80dBm() {
+ return mRssiChain75To80;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -80 dBm and -85 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -80 dBm and -85 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi80To85dBm() {
+ return mRssiChain80To85;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI between -85 dBm and -90 dBm on
+ * any antenna chain.
+ *
+ * @return the packet count for RSSI between -85 dBm and -90 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssi85To90dBm() {
+ return mRssiChain85To90;
+ }
+
+ /**
+ * Gets the packet count for received signals with an RSSI (Received Signal Strength
+ * Indicator) weaker than -90 dBm on any antenna chain.
+ *
+ * @return the packet count for RSSI weaker than -90 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssiBelowMinus90dBm() {
+ return mRssiChainUnder90;
+ }
+
+ /**
+ * Gets the packet count where the difference in RSSI between antenna chains is less than 2
+ * dBm.
+ *
+ * @return the packet count for RSSI delta less than 2 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssiDeltaBelow2dBm() {
+ return mRssiDeltaUnder2;
+ }
+
+ /**
+ * Gets the packet count where the difference in RSSI between antenna chains is between 2
+ * dBm and 5 dBm.
+ *
+ * @return the packet count for RSSI delta between 2 dBm and 5 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssiDelta2To5dBm() {
+ return mRssiDelta2To5;
+ }
+
+ /**
+ * Gets the packet count where the difference in RSSI between antenna chains is between 5
+ * dBm and 8 dBm.
+ *
+ * @return the packet count for RSSI delta between 5 dBm and 8 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssiDelta5To8dBm() {
+ return mRssiDelta5To8;
+ }
+
+ /**
+ * Gets the packet count where the difference in RSSI between antenna chains is greater than
+ * 11 dBm.
+ *
+ * @return the packet count for RSSI delta greater than 11 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssiDelta8To11dBm() {
+ return mRssiDelta8To11;
+ }
+
+ /**
+ * Get the Packet counter of RSSI delta are larger than 11 dBm
+ *
+ * @return the packet counter of RSSI delta are larger than 11 dBm
+ * @hide
+ */
+ @SystemApi
+ public long getPacketsWithRssiDeltaAbove11dBm() {
+ return mRssiDeltaOver11;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Write BqrRfStats to parcel.
+ *
+ * @hide
+ */
+ @SystemApi
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeInt(mExtensionInfo);
+ dest.writeLong(mReportTimePeriod);
+ dest.writeLong(mTxPoweriPaBf);
+ dest.writeLong(mTxPowerePaBf);
+ dest.writeLong(mTxPoweriPaDiv);
+ dest.writeLong(mTxPowerePaDiv);
+ dest.writeLong(mRssiChainOver50);
+ dest.writeLong(mRssiChain50To55);
+ dest.writeLong(mRssiChain55To60);
+ dest.writeLong(mRssiChain60To65);
+ dest.writeLong(mRssiChain65To70);
+ dest.writeLong(mRssiChain70To75);
+ dest.writeLong(mRssiChain75To80);
+ dest.writeLong(mRssiChain80To85);
+ dest.writeLong(mRssiChain85To90);
+ dest.writeLong(mRssiChainUnder90);
+ dest.writeLong(mRssiDeltaUnder2);
+ dest.writeLong(mRssiDelta2To5);
+ dest.writeLong(mRssiDelta5To8);
+ dest.writeLong(mRssiDelta8To11);
+ dest.writeLong(mRssiDeltaOver11);
+ }
+
+ /** @hide */
+ @SystemApi
+ public static final @NonNull Parcelable.Creator<BqrRfStats> CREATOR =
+ new Parcelable.Creator<BqrRfStats>() {
+ public BqrRfStats createFromParcel(Parcel in) {
+ return new BqrRfStats(in);
+ }
+
+ public BqrRfStats[] newArray(int size) {
+ return new BqrRfStats[size];
+ }
+ };
+
+ /** BqrVsLsto to String. */
+ @Override
+ @NonNull
+ public String toString() {
+ return " BqrRfStats: {\n"
+ + " mExtensionInfo: "
+ + mExtensionInfo
+ + ", mReportTimePeriod: "
+ + mReportTimePeriod
+ + ", mTxPoweriPaBf: "
+ + mTxPoweriPaBf
+ + ", mTxPowerePaBf: "
+ + mTxPowerePaBf
+ + ", mTxPoweriPaDiv: "
+ + mTxPoweriPaDiv
+ + ", mTxPowerePaDiv: "
+ + mTxPowerePaDiv
+ + ",\n"
+ + " mRssiChainOver50: "
+ + mRssiChainOver50
+ + ", mRssiChain50To55: "
+ + mRssiChain50To55
+ + ", mRssiChain55To60: "
+ + mRssiChain55To60
+ + ", mRssiChain60To65: "
+ + mRssiChain60To65
+ + ", mRssiChain65To70: "
+ + mRssiChain65To70
+ + ", mRssiChain70To75: "
+ + mRssiChain70To75
+ + ", mRssiChain75To80: "
+ + mRssiChain75To80
+ + ", mRssiChain80To85: "
+ + mRssiChain80To85
+ + ", mRssiChain85To90: "
+ + mRssiChain85To90
+ + ", mRssiChainUnder90: "
+ + mRssiChainUnder90
+ + ",\n"
+ + " mRssiDeltaUnder2: "
+ + mRssiDeltaUnder2
+ + ", mRssiDelta2To5: "
+ + mRssiDelta2To5
+ + ", mRssiDelta5To8: "
+ + mRssiDelta5To8
+ + ", mRssiDelta8To11: "
+ + mRssiDelta8To11
+ + ", mRssiDeltaOver11: "
+ + mRssiDeltaOver11
+ + "\n }";
+ }
+ }
}