Merge "passpoint-r2: add OSU flag for WifiInfo"

This commit is contained in:
TreeHugger Robot
2019-01-07 21:21:58 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 0 deletions

View File

@@ -113,6 +113,11 @@ public class WifiInfo implements Parcelable {
private boolean mTrusted;
/**
* OSU (Online Sign Up) AP for Passpoint R2.
*/
private boolean mOsuAp;
/**
* Running total count of lost (not ACKed) transmitted unicast data packets.
* @hide
@@ -190,6 +195,7 @@ public class WifiInfo implements Parcelable {
setFrequency(-1);
setMeteredHint(false);
setEphemeral(false);
setOsuAp(false);
txBad = 0;
txSuccess = 0;
rxSuccess = 0;
@@ -219,6 +225,7 @@ public class WifiInfo implements Parcelable {
mMeteredHint = source.mMeteredHint;
mEphemeral = source.mEphemeral;
mTrusted = source.mTrusted;
mOsuAp = source.mOsuAp;
txBad = source.txBad;
txRetries = source.txRetries;
txSuccess = source.txSuccess;
@@ -411,6 +418,15 @@ public class WifiInfo implements Parcelable {
return mTrusted;
}
/** {@hide} */
public void setOsuAp(boolean osuAp) {
mOsuAp = osuAp;
}
/** {@hide} */
public boolean isOsuAp() {
return mOsuAp;
}
/** @hide */
@UnsupportedAppUsage
@@ -565,6 +581,7 @@ public class WifiInfo implements Parcelable {
dest.writeLong(rxSuccess);
dest.writeDouble(rxSuccessRate);
mSupplicantState.writeToParcel(dest, flags);
dest.writeInt(mOsuAp ? 1 : 0);
}
/** Implement the Parcelable interface {@hide} */
@@ -600,6 +617,7 @@ public class WifiInfo implements Parcelable {
info.rxSuccess = in.readLong();
info.rxSuccessRate = in.readDouble();
info.mSupplicantState = SupplicantState.CREATOR.createFromParcel(in);
info.mOsuAp = in.readInt() != 0;
return info;
}

View File

@@ -47,6 +47,7 @@ public class WifiInfoTest {
writeWifiInfo.txBad = TEST_TX_BAD;
writeWifiInfo.rxSuccess = TEST_RX_SUCCESS;
writeWifiInfo.setTrusted(true);
writeWifiInfo.setOsuAp(true);
Parcel parcel = Parcel.obtain();
writeWifiInfo.writeToParcel(parcel, 0);
@@ -60,5 +61,6 @@ public class WifiInfoTest {
assertEquals(TEST_TX_BAD, readWifiInfo.txBad);
assertEquals(TEST_RX_SUCCESS, readWifiInfo.rxSuccess);
assertTrue(readWifiInfo.isTrusted());
assertTrue(readWifiInfo.isOsuAp());
}
}