Bluetooth Quality Report: fix methods naming
Fix string conversion methods naming.
Bug: 271325701
Test: atest CtsBluetoothTestCases
Change-Id: Ie6629c35dab47c6b2adb1989fd1b030060a4d38f
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index 5f37ba4..0914175 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -776,9 +776,9 @@
method public int getLmpVersion();
method public int getManufacturerId();
method public int getQualityReportId();
- method @NonNull public String getQualityReportIdString();
method @Nullable public String getRemoteAddress();
method @Nullable public String getRemoteName();
+ method @NonNull public static String qualityReportIdToString(int);
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothQualityReport> CREATOR;
field public static final int QUALITY_REPORT_ID_A2DP_CHOPPY = 3; // 0x3
@@ -789,11 +789,11 @@
}
public static final class BluetoothQualityReport.BqrCommon implements android.os.Parcelable {
+ method @NonNull public static String connectionRoleToString(int);
method public int getAfhSelectUnidealChannelCount();
method public int getCalFailedItemCount();
method public int getConnectionHandle();
method public int getConnectionRole();
- method @NonNull public String getConnectionRoleString();
method public long getFlowOffCount();
method public long getLastFlowOnTimestamp();
method public long getLastTxAckTimestamp();
@@ -802,7 +802,6 @@
method public long getNoRxCount();
method public long getOverflowCount();
method public int getPacketType();
- method @Nullable public String getPacketTypeString();
method public long getPiconetClock();
method public long getRetransmissionCount();
method public int getRssi();
@@ -810,6 +809,7 @@
method public int getTxPowerLevel();
method public long getUnderflowCount();
method public int getUnusedAfhChannelCount();
+ method @Nullable public static String packetTypeToString(int);
method public void writeToParcel(@NonNull android.os.Parcel, int);
field public static final int CONNECTION_ROLE_CENTRAL = 0; // 0x0
field public static final int CONNECTION_ROLE_PERIPHERAL = 1; // 0x1
@@ -817,7 +817,7 @@
}
public static final class BluetoothQualityReport.BqrConnectFail implements android.os.Parcelable {
- method @NonNull public String getConnectFailIdString(int);
+ method @NonNull public static String connectFailIdToString(int);
method public int getFailReason();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field public static final int CONNECT_FAIL_ID_ACL_ALREADY_EXIST = 11; // 0xb
@@ -833,18 +833,18 @@
method public long getArrivalTime();
method public int getGlitchCount();
method public int getLinkQuality();
- method @Nullable public String getLinkQualityString();
method public int getRxCxmDenials();
method public long getScheduleTime();
method public int getTxCxmDenials();
+ method @Nullable public static String linkQualityToString(int);
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothQualityReport.BqrVsA2dpChoppy> CREATOR;
}
public static final class BluetoothQualityReport.BqrVsLsto implements android.os.Parcelable {
+ method @Nullable public static String connStateToString(int);
method public long getBasebandStats();
method public int getConnState();
- method @Nullable public String getConnStateString();
method public int getCxmDenials();
method public long getLastTxAckTimestamp();
method public long getNativeClock();
@@ -856,8 +856,8 @@
}
public static final class BluetoothQualityReport.BqrVsScoChoppy implements android.os.Parcelable {
+ method @Nullable public static String airFormatToString(int);
method public int getAirFormat();
- method @Nullable public String getAirFormatString();
method public int getGlitchCount();
method public int getGoodRxFrameCount();
method public int getInstanceCount();
diff --git a/framework/java/android/bluetooth/BluetoothQualityReport.java b/framework/java/android/bluetooth/BluetoothQualityReport.java
index b271327..e687515 100644
--- a/framework/java/android/bluetooth/BluetoothQualityReport.java
+++ b/framework/java/android/bluetooth/BluetoothQualityReport.java
@@ -191,7 +191,7 @@
mValue = val;
}
- public static String getName(int val) {
+ public static String toString(int val) {
for (ConnState state : sAllStates) {
if (state.mValue == val) {
return state.toString();
@@ -308,8 +308,8 @@
* @hide
*/
@SystemApi
- public @NonNull String getQualityReportIdString() {
- return mBqrCommon.getQualityReportIdString();
+ public static @NonNull String qualityReportIdToString(@QualityReportId int id) {
+ return BqrCommon.qualityReportIdToString(id);
}
/**
@@ -552,7 +552,7 @@
* Sets the Remote Device Address (big-endian) attribute for the new instance of {@link
* BluetoothQualityReport}.
*
- * @param remoteAddr The Remote Device Address (big-endian) attribute
+ * @param remoteAddr the Remote Device Address (big-endian) attribute
* @hide
*/
@NonNull
@@ -566,7 +566,7 @@
* Sets the Link Manager Protocol Version attribute for the new instance of {@link
* BluetoothQualityReport}.
*
- * @param lmpVer The Link Manager Protocol Version attribute
+ * @param lmpVer the Link Manager Protocol Version attribute
* @hide
*/
@NonNull
@@ -580,7 +580,7 @@
* Sets the Link Manager Protocol SubVersion attribute for the new instance of {@link
* BluetoothQualityReport}.
*
- * @param lmpSubVer The Link Manager Protocol SubVersion attribute
+ * @param lmpSubVer the Link Manager Protocol SubVersion attribute
* @hide
*/
@NonNull
@@ -594,7 +594,7 @@
* Sets the Manufacturer Id attribute for the new instance of {@link
* BluetoothQualityReport}.
*
- * @param manufacturerId The Manufacturer Id attribute
+ * @param manufacturerId the Manufacturer Id attribute
* @hide
*/
@NonNull
@@ -608,7 +608,7 @@
* Sets the Remote Device Name attribute for the new instance of {@link
* BluetoothQualityReport}.
*
- * @param remoteName The Remote Device Name attribute
+ * @param remoteName the Remote Device Name attribute
* @hide
*/
@NonNull
@@ -622,7 +622,7 @@
* Sets the Bluetooth Class of Remote Device attribute for the new instance of {@link
* BluetoothQualityReport}.
*
- * @param bluetoothClass The Remote Class of Device attribute
+ * @param bluetoothClass the Remote Class of Device attribute
* @hide
*/
@NonNull
@@ -768,8 +768,8 @@
return mQualityReportId;
}
- String getQualityReportIdString() {
- switch (mQualityReportId) {
+ static String qualityReportIdToString(@QualityReportId int id) {
+ switch (id) {
case QUALITY_REPORT_ID_MONITOR:
return "Quality monitor";
case QUALITY_REPORT_ID_APPROACH_LSTO:
@@ -799,12 +799,13 @@
/**
* Get the string of packet type.
*
+ * @param packetType packet type of the connection
* @return the string of packet type
* @hide
*/
@SystemApi
- public @Nullable String getPacketTypeString() {
- PacketType type = PacketType.fromOrdinal(mPacketType);
+ public static @Nullable String packetTypeToString(int packetType) {
+ PacketType type = PacketType.fromOrdinal(packetType);
return type.toString();
}
@@ -860,17 +861,18 @@
/**
* Get the connection Role of the connection, "Central" or "Peripheral".
*
+ * @param connectionRole connection Role of the connection
* @return the connection Role String
* @hide
*/
@SystemApi
- public @NonNull String getConnectionRoleString() {
- if (mConnectionRole == CONNECTION_ROLE_CENTRAL) {
+ public static @NonNull String connectionRoleToString(int connectionRole) {
+ if (connectionRole == CONNECTION_ROLE_CENTRAL) {
return "Central";
- } else if (mConnectionRole == CONNECTION_ROLE_PERIPHERAL) {
+ } else if (connectionRole == CONNECTION_ROLE_PERIPHERAL) {
return "Peripheral";
} else {
- return "INVALID:" + mConnectionRole;
+ return "INVALID:" + connectionRole;
}
}
@@ -1120,12 +1122,12 @@
str =
" BqrCommon: {\n"
+ " mQualityReportId: "
- + getQualityReportIdString()
+ + qualityReportIdToString(getQualityReportId())
+ "("
+ String.format("0x%02X", mQualityReportId)
+ ")"
+ ", mPacketType: "
- + getPacketTypeString()
+ + packetTypeToString(mPacketType)
+ "("
+ String.format("0x%02X", mPacketType)
+ ")"
@@ -1241,12 +1243,13 @@
/**
* Get the string of conn state of sco.
*
+ * @param connectionState connection state of sco
* @return the string of conn state
* @hide
*/
@SystemApi
- public @Nullable String getConnStateString() {
- return ConnState.getName(mConnState);
+ public static @Nullable String connStateToString(int connectionState) {
+ return ConnState.toString(connectionState);
}
/**
@@ -1380,7 +1383,7 @@
str =
" BqrVsLsto: {\n"
+ " mConnState: "
- + getConnStateString()
+ + connStateToString(getConnState())
+ "("
+ String.format("0x%02X", mConnState)
+ ")"
@@ -1529,12 +1532,13 @@
/**
* Get the string of link quality for the current connection.
*
+ * @param linkQuality link quality for the current connection
* @return the string of link quality
* @hide
*/
@SystemApi
- public @Nullable String getLinkQualityString() {
- LinkQuality q = LinkQuality.fromOrdinal(mLinkQuality);
+ public static @Nullable String linkQualityToString(int linkQuality) {
+ LinkQuality q = LinkQuality.fromOrdinal(linkQuality);
return q.toString();
}
@@ -1603,7 +1607,7 @@
+ ", mAclTxQueueLength: "
+ mAclTxQueueLength
+ ", mLinkQuality: "
- + getLinkQualityString()
+ + linkQualityToString(mLinkQuality)
+ "("
+ String.format("0x%02X", mLinkQuality)
+ ")"
@@ -1741,12 +1745,13 @@
/**
* Get the string of air mode.
*
+ * @param airFormat the value of Air Mode parameter in Synchronous Connection Complete event
* @return the string of air mode
* @hide
*/
@SystemApi
- public @Nullable String getAirFormatString() {
- AirMode m = AirMode.fromOrdinal(mAirFormat);
+ public static @Nullable String airFormatToString(int airFormat) {
+ AirMode m = AirMode.fromOrdinal(airFormat);
return m.toString();
}
@@ -1974,7 +1979,7 @@
+ ", mWindowEsco: "
+ mWindowEsco
+ ", mAirFormat: "
- + getAirFormatString()
+ + airFormatToString(mAirFormat)
+ "("
+ String.format("0x%02X", mAirFormat)
+ ")"
@@ -2138,11 +2143,12 @@
/**
* Get the string of the Connect Fail ID.
*
+ * @param id the connect fail reason
* @return the string of the id
* @hide
*/
@SystemApi
- public @NonNull String getConnectFailIdString(@ConnectFailId int id) {
+ public static @NonNull String connectFailIdToString(@ConnectFailId int id) {
switch (id) {
case CONNECT_FAIL_ID_NO_ERROR:
return "No error";
@@ -2172,7 +2178,7 @@
str =
" BqrConnectFail: {\n"
+ " mFailReason: "
- + getConnectFailIdString(mFailReason)
+ + connectFailIdToString(mFailReason)
+ " ("
+ String.format("0x%02X", mFailReason)
+ ")"