Merge "Mark a connection as a Wifi Assistant connection based on the ephemeral flag in WifiInfo. Add this private field to WifiInfo." into mnc-dev

This commit is contained in:
Shirish Kalele
2015-06-26 21:34:22 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 3 deletions

View File

@@ -387,7 +387,7 @@ public class AccessPoint implements Comparable<AccessPoint> {
} else if (isActive()) { } else if (isActive()) {
// This is the active connection on non-passpoint network // This is the active connection on non-passpoint network
summary.append(getSummary(mContext, getDetailedState(), summary.append(getSummary(mContext, getDetailedState(),
networkId == WifiConfiguration.INVALID_NETWORK_ID)); mInfo != null && mInfo.isEphemeral()));
} else if (mConfig != null && mConfig.isPasspoint()) { } else if (mConfig != null && mConfig.isPasspoint()) {
String format = mContext.getString(R.string.available_via_passpoint); String format = mContext.getString(R.string.available_via_passpoint);
summary.append(String.format(format, mConfig.providerFriendlyName)); summary.append(String.format(format, mConfig.providerFriendlyName));
@@ -620,7 +620,8 @@ public class AccessPoint implements Comparable<AccessPoint> {
} }
public boolean isEphemeral() { public boolean isEphemeral() {
return !isSaved() && mNetworkInfo != null && mNetworkInfo.getState() != State.DISCONNECTED; return mInfo != null && mInfo.isEphemeral() &&
mNetworkInfo != null && mNetworkInfo.getState() != State.DISCONNECTED;
} }
/** Return whether the given {@link WifiInfo} is for this access point. */ /** Return whether the given {@link WifiInfo} is for this access point. */

View File

@@ -101,6 +101,8 @@ public class WifiInfo implements Parcelable {
private InetAddress mIpAddress; private InetAddress mIpAddress;
private String mMacAddress = DEFAULT_MAC_ADDRESS; private String mMacAddress = DEFAULT_MAC_ADDRESS;
private boolean mEphemeral;
/** /**
* @hide * @hide
*/ */
@@ -253,6 +255,7 @@ public class WifiInfo implements Parcelable {
setLinkSpeed(-1); setLinkSpeed(-1);
setFrequency(-1); setFrequency(-1);
setMeteredHint(false); setMeteredHint(false);
setEphemeral(false);
txBad = 0; txBad = 0;
txSuccess = 0; txSuccess = 0;
rxSuccess = 0; rxSuccess = 0;
@@ -283,6 +286,7 @@ public class WifiInfo implements Parcelable {
mIpAddress = source.mIpAddress; mIpAddress = source.mIpAddress;
mMacAddress = source.mMacAddress; mMacAddress = source.mMacAddress;
mMeteredHint = source.mMeteredHint; mMeteredHint = source.mMeteredHint;
mEphemeral = source.mEphemeral;
txBad = source.txBad; txBad = source.txBad;
txRetries = source.txRetries; txRetries = source.txRetries;
txSuccess = source.txSuccess; txSuccess = source.txSuccess;
@@ -430,6 +434,16 @@ public class WifiInfo implements Parcelable {
return mMeteredHint; return mMeteredHint;
} }
/** {@hide} */
public void setEphemeral(boolean ephemeral) {
mEphemeral = ephemeral;
}
/** {@hide} */
public boolean isEphemeral() {
return mEphemeral;
}
/** @hide */ /** @hide */
public void setNetworkId(int id) { public void setNetworkId(int id) {
mNetworkId = id; mNetworkId = id;
@@ -567,6 +581,7 @@ public class WifiInfo implements Parcelable {
dest.writeString(mBSSID); dest.writeString(mBSSID);
dest.writeString(mMacAddress); dest.writeString(mMacAddress);
dest.writeInt(mMeteredHint ? 1 : 0); dest.writeInt(mMeteredHint ? 1 : 0);
dest.writeInt(mEphemeral ? 1 : 0);
dest.writeInt(score); dest.writeInt(score);
dest.writeDouble(txSuccessRate); dest.writeDouble(txSuccessRate);
dest.writeDouble(txRetriesRate); dest.writeDouble(txRetriesRate);
@@ -597,6 +612,7 @@ public class WifiInfo implements Parcelable {
info.mBSSID = in.readString(); info.mBSSID = in.readString();
info.mMacAddress = in.readString(); info.mMacAddress = in.readString();
info.mMeteredHint = in.readInt() != 0; info.mMeteredHint = in.readInt() != 0;
info.mEphemeral = in.readInt() != 0;
info.score = in.readInt(); info.score = in.readInt();
info.txSuccessRate = in.readDouble(); info.txSuccessRate = in.readDouble();
info.txRetriesRate = in.readDouble(); info.txRetriesRate = in.readDouble();