Skip to content
Snippets Groups Projects
Commit 5cc0ba49 authored by Brad Lassey's avatar Brad Lassey Committed by Brad Lassey
Browse files

Rename getGain() to getVendorSpecificGain()

Bug: 315131060
Test: Tested with CTS
Change-Id: I9b0d592fc12912ae8da29472de148206e3eb6324
parent c7ef3af1
No related branches found
No related tags found
No related merge requests found
......@@ -268,9 +268,9 @@ package android.nfc.cardemulation {
ctor public PollingFrame(int, @Nullable byte[], int, int);
method public int describeContents();
method @NonNull public byte[] getData();
method public int getGain();
method public int getTimestamp();
method public int getType();
method public int getVendorSpecificGain();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.nfc.cardemulation.PollingFrame> CREATOR;
field @FlaggedApi("android.nfc.nfc_read_polling_loop") public static final int POLLING_LOOP_TYPE_A = 65; // 0x41
......
......@@ -157,7 +157,11 @@ public final class PollingFrame implements Parcelable{
mType = frame.getInt(KEY_POLLING_LOOP_TYPE);
byte[] data = frame.getByteArray(KEY_POLLING_LOOP_DATA);
mData = (data == null) ? new byte[0] : data;
mGain = frame.getByte(KEY_POLLING_LOOP_GAIN);
if (frame.containsKey(KEY_POLLING_LOOP_GAIN)) {
mGain = frame.getByte(KEY_POLLING_LOOP_GAIN);
} else {
mGain = -1;
}
mTimestamp = frame.getInt(KEY_POLLING_LOOP_TIMESTAMP);
}
......@@ -194,8 +198,9 @@ public final class PollingFrame implements Parcelable{
/**
* Returns the gain representing the field strength of the NFC field when this polling loop
* frame was observed.
* @return the gain or -1 if there is no gain measurement associated with this frame.
*/
public int getGain() {
public int getVendorSpecificGain() {
return mGain;
}
......@@ -227,7 +232,9 @@ public final class PollingFrame implements Parcelable{
public Bundle toBundle() {
Bundle frame = new Bundle();
frame.putInt(KEY_POLLING_LOOP_TYPE, getType());
frame.putByte(KEY_POLLING_LOOP_GAIN, (byte) getGain());
if (getVendorSpecificGain() != -1) {
frame.putByte(KEY_POLLING_LOOP_GAIN, (byte) getVendorSpecificGain());
}
frame.putByteArray(KEY_POLLING_LOOP_DATA, getData());
frame.putInt(KEY_POLLING_LOOP_TIMESTAMP, getTimestamp());
return frame;
......@@ -236,7 +243,7 @@ public final class PollingFrame implements Parcelable{
@Override
public String toString() {
return "PollingFrame { Type: " + (char) getType()
+ ", gain: " + getGain()
+ ", gain: " + getVendorSpecificGain()
+ ", timestamp: " + Integer.toUnsignedString(getTimestamp())
+ ", data: [" + HexFormat.ofDelimiter(" ").formatHex(getData()) + "] }";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment