Rename LinkInfo to LinkQualityInfo
This change renames the LinkInfo objects to LinkQuailtyInfo. The API is
still hidden; but it can be accessed via reflection.
Bug: 10342372
Change-Id: Ieccea87c467ceae5d7f76298b137573f67396cd6
diff --git a/core/java/android/net/BaseNetworkStateTracker.java b/core/java/android/net/BaseNetworkStateTracker.java
index c39488e..476fefe 100644
--- a/core/java/android/net/BaseNetworkStateTracker.java
+++ b/core/java/android/net/BaseNetworkStateTracker.java
@@ -103,7 +103,7 @@
}
@Override
- public LinkInfo getLinkInfo() {
+ public LinkQualityInfo getLinkQualityInfo() {
return null;
}
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index f6a3a4a..c3ff857 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -1447,9 +1447,9 @@
* get the information about a specific network link
* @hide
*/
- public LinkInfo getLinkInfo(int networkType) {
+ public LinkQualityInfo getLinkQualityInfo(int networkType) {
try {
- LinkInfo li = mService.getLinkInfo(networkType);
+ LinkQualityInfo li = mService.getLinkQualityInfo(networkType);
return li;
} catch (RemoteException e) {
return null;
@@ -1460,9 +1460,9 @@
* get the information of currently active network link
* @hide
*/
- public LinkInfo getActiveLinkInfo() {
+ public LinkQualityInfo getActiveLinkQualityInfo() {
try {
- LinkInfo li = mService.getActiveLinkInfo();
+ LinkQualityInfo li = mService.getActiveLinkQualityInfo();
return li;
} catch (RemoteException e) {
return null;
@@ -1473,9 +1473,9 @@
* get the information of all network links
* @hide
*/
- public LinkInfo[] getAllLinkInfo() {
+ public LinkQualityInfo[] getAllLinkQualityInfo() {
try {
- LinkInfo[] li = mService.getAllLinkInfo();
+ LinkQualityInfo[] li = mService.getAllLinkQualityInfo();
return li;
} catch (RemoteException e) {
return null;
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index bf2dade..1c38314 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -16,7 +16,7 @@
package android.net;
-import android.net.LinkInfo;
+import android.net.LinkQualityInfo;
import android.net.LinkProperties;
import android.net.NetworkInfo;
import android.net.NetworkQuotaInfo;
@@ -147,10 +147,10 @@
String getMobileRedirectedProvisioningUrl();
- LinkInfo getLinkInfo(int networkType);
+ LinkQualityInfo getLinkQualityInfo(int networkType);
- LinkInfo getActiveLinkInfo();
+ LinkQualityInfo getActiveLinkQualityInfo();
- LinkInfo[] getAllLinkInfo();
+ LinkQualityInfo[] getAllLinkQualityInfo();
}
diff --git a/core/java/android/net/LinkInfo.java b/core/java/android/net/LinkInfo.java
deleted file mode 100644
index 47b8a95..0000000
--- a/core/java/android/net/LinkInfo.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Class that represents useful attributes of generic network links
- * such as the upload/download throughput or packet error rate.
- * Generally speaking, you should be dealing with instances of
- * LinkInfo subclasses, such as {@link android.net.#WifiLinkInfo}
- * or {@link android.net.#MobileLinkInfo} which provide additional
- * information.
- * @hide
- */
-public class LinkInfo implements Parcelable
-{
- public static final int UNKNOWN = -1;
-
- public static final int NORMALIZED_MIN_SIGNAL_STRENGTH = 0;
-
- public static final int NORMALIZED_MAX_SIGNAL_STRENGTH = 99;
-
- public static final int NORMALIZED_SIGNAL_STRENGTH_RANGE = NORMALIZED_MAX_SIGNAL_STRENGTH + 1;
-
- /* Network type as defined by ConnectivityManager */
- public int mNetworkType = ConnectivityManager.TYPE_NONE;
-
- public int mNormalizedSignalStrength = UNKNOWN;
-
- public long mPacketCount = UNKNOWN;
- public long mPacketErrorCount = UNKNOWN;
- public int mTheoreticalTxBandwidth = UNKNOWN;
- public int mTheoreticalRxBandwidth = UNKNOWN;
- public int mTheoreticalLatency = UNKNOWN;
-
- /* Timestamp when last sample was made available */
- public long mLastDataSampleTime = UNKNOWN;
-
- /* Sample duration in millisecond */
- public int mDataSampleDuration = UNKNOWN;
-
- public LinkInfo() {
-
- }
-
- /**
- * Implement the Parcelable interface
- * @hide
- */
- public int describeContents() {
- return 0;
- }
- /**
- * Implement the Parcelable interface.
- */
-
- protected static final int OBJECT_TYPE_LINKINFO = 1;
- protected static final int OBJECT_TYPE_WIFI_LINKINFO = 2;
- protected static final int OBJECT_TYPE_MOBILE_LINKINFO = 3;
-
- public void writeToParcel(Parcel dest, int flags) {
- writeToParcel(dest, flags, OBJECT_TYPE_LINKINFO);
- }
-
- public void writeToParcel(Parcel dest, int flags, int objectType) {
- dest.writeInt(objectType);
- dest.writeInt(mNetworkType);
- dest.writeInt(mNormalizedSignalStrength);
- dest.writeLong(mPacketCount);
- dest.writeLong(mPacketErrorCount);
- dest.writeInt(mTheoreticalTxBandwidth);
- dest.writeInt(mTheoreticalRxBandwidth);
- dest.writeInt(mTheoreticalLatency);
- dest.writeLong(mLastDataSampleTime);
- dest.writeInt(mDataSampleDuration);
- }
-
- public static final Creator<LinkInfo> CREATOR =
- new Creator<LinkInfo>() {
- public LinkInfo createFromParcel(Parcel in) {
- int objectType = in.readInt();
- if (objectType == OBJECT_TYPE_LINKINFO) {
- LinkInfo li = new LinkInfo();
- li.initializeFromParcel(in);
- return li;
- } else if (objectType == OBJECT_TYPE_WIFI_LINKINFO) {
- return WifiLinkInfo.createFromParcelBody(in);
- } else if (objectType == OBJECT_TYPE_MOBILE_LINKINFO) {
- return MobileLinkInfo.createFromParcelBody(in);
- } else {
- return null;
- }
- }
-
- public LinkInfo[] newArray(int size) {
- return new LinkInfo[size];
- }
- };
-
- protected void initializeFromParcel(Parcel in) {
- mNetworkType = in.readInt();
- mNormalizedSignalStrength = in.readInt();
- mPacketCount = in.readLong();
- mPacketErrorCount = in.readLong();
- mTheoreticalTxBandwidth = in.readInt();
- mTheoreticalRxBandwidth = in.readInt();
- mTheoreticalLatency = in.readInt();
- mLastDataSampleTime = in.readLong();
- mDataSampleDuration = in.readInt();
- }
-
-}
diff --git a/core/java/android/net/LinkInfo.aidl b/core/java/android/net/LinkQualityInfo.aidl
similarity index 95%
rename from core/java/android/net/LinkInfo.aidl
rename to core/java/android/net/LinkQualityInfo.aidl
index 716674b..5e072bf 100644
--- a/core/java/android/net/LinkInfo.aidl
+++ b/core/java/android/net/LinkQualityInfo.aidl
@@ -16,4 +16,4 @@
package android.net;
-parcelable LinkInfo;
+parcelable LinkQualityInfo;
diff --git a/core/java/android/net/LinkQualityInfo.java b/core/java/android/net/LinkQualityInfo.java
new file mode 100644
index 0000000..9c8e61d
--- /dev/null
+++ b/core/java/android/net/LinkQualityInfo.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Class that represents useful attributes of generic network links
+ * such as the upload/download throughput or packet error rate.
+ * Generally speaking, you should be dealing with instances of
+ * LinkQualityInfo subclasses, such as {@link android.net.#WifiLinkQualityInfo}
+ * or {@link android.net.#MobileLinkQualityInfo} which provide additional
+ * information.
+ * @hide
+ */
+public class LinkQualityInfo implements Parcelable {
+
+ /**
+ * Represents a value that you can use to test if an integer field is set to a good value
+ */
+ public static final int UNKNOWN_INT = Integer.MAX_VALUE;
+
+ /**
+ * Represents a value that you can use to test if a long field is set to a good value
+ */
+ public static final long UNKNOWN_LONG = Long.MAX_VALUE;
+
+ public static final int NORMALIZED_MIN_SIGNAL_STRENGTH = 0;
+
+ public static final int NORMALIZED_MAX_SIGNAL_STRENGTH = 99;
+
+ public static final int NORMALIZED_SIGNAL_STRENGTH_RANGE =
+ NORMALIZED_MAX_SIGNAL_STRENGTH - NORMALIZED_MIN_SIGNAL_STRENGTH + 1;
+
+ /* Network type as defined by ConnectivityManager */
+ private int mNetworkType = ConnectivityManager.TYPE_NONE;
+
+ private int mNormalizedSignalStrength = UNKNOWN_INT;
+
+ private long mPacketCount = UNKNOWN_LONG;
+ private long mPacketErrorCount = UNKNOWN_LONG;
+ private int mTheoreticalTxBandwidth = UNKNOWN_INT;
+ private int mTheoreticalRxBandwidth = UNKNOWN_INT;
+ private int mTheoreticalLatency = UNKNOWN_INT;
+
+ /* Timestamp when last sample was made available */
+ private long mLastDataSampleTime = UNKNOWN_LONG;
+
+ /* Sample duration in millisecond */
+ private int mDataSampleDuration = UNKNOWN_INT;
+
+ public LinkQualityInfo() {
+
+ }
+
+ /**
+ * Implement the Parcelable interface
+ * @hide
+ */
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Implement the Parcelable interface.
+ */
+
+ protected static final int OBJECT_TYPE_LINK_QUALITY_INFO = 1;
+ protected static final int OBJECT_TYPE_WIFI_LINK_QUALITY_INFO = 2;
+ protected static final int OBJECT_TYPE_MOBILE_LINK_QUALITY_INFO = 3;
+
+ /**
+ * @hide
+ */
+ public void writeToParcel(Parcel dest, int flags) {
+ writeToParcel(dest, flags, OBJECT_TYPE_LINK_QUALITY_INFO);
+ }
+
+ /**
+ * @hide
+ */
+ public void writeToParcel(Parcel dest, int flags, int objectType) {
+ dest.writeInt(objectType);
+ dest.writeInt(mNetworkType);
+ dest.writeInt(mNormalizedSignalStrength);
+ dest.writeLong(mPacketCount);
+ dest.writeLong(mPacketErrorCount);
+ dest.writeInt(mTheoreticalTxBandwidth);
+ dest.writeInt(mTheoreticalRxBandwidth);
+ dest.writeInt(mTheoreticalLatency);
+ dest.writeLong(mLastDataSampleTime);
+ dest.writeInt(mDataSampleDuration);
+ }
+
+ /**
+ * @hide
+ */
+ public static final Creator<LinkQualityInfo> CREATOR =
+ new Creator<LinkQualityInfo>() {
+ public LinkQualityInfo createFromParcel(Parcel in) {
+ int objectType = in.readInt();
+ if (objectType == OBJECT_TYPE_LINK_QUALITY_INFO) {
+ LinkQualityInfo li = new LinkQualityInfo();
+ li.initializeFromParcel(in);
+ return li;
+ } else if (objectType == OBJECT_TYPE_WIFI_LINK_QUALITY_INFO) {
+ return WifiLinkQualityInfo.createFromParcelBody(in);
+ } else if (objectType == OBJECT_TYPE_MOBILE_LINK_QUALITY_INFO) {
+ return MobileLinkQualityInfo.createFromParcelBody(in);
+ } else {
+ return null;
+ }
+ }
+
+ public LinkQualityInfo[] newArray(int size) {
+ return new LinkQualityInfo[size];
+ }
+ };
+
+ /**
+ * @hide
+ */
+ protected void initializeFromParcel(Parcel in) {
+ mNetworkType = in.readInt();
+ mNormalizedSignalStrength = in.readInt();
+ mPacketCount = in.readLong();
+ mPacketErrorCount = in.readLong();
+ mTheoreticalTxBandwidth = in.readInt();
+ mTheoreticalRxBandwidth = in.readInt();
+ mTheoreticalLatency = in.readInt();
+ mLastDataSampleTime = in.readLong();
+ mDataSampleDuration = in.readInt();
+ }
+
+ /**
+ * returns the type of network this link is connected to
+ * @return network type as defined by {@link android.net.ConnectivityManager} or
+ * {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getNetworkType() {
+ return mNetworkType;
+ }
+
+ /**
+ * @hide
+ */
+ public void setNetworkType(int networkType) {
+ mNetworkType = networkType;
+ }
+
+ /**
+ * returns the signal strength normalized across multiple types of networks
+ * @return an integer value from 0 - 99 or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getNormalizedSignalStrength() {
+ return mNormalizedSignalStrength;
+ }
+
+ /**
+ * @hide
+ */
+ public void setNormalizedSignalStrength(int normalizedSignalStrength) {
+ mNormalizedSignalStrength = normalizedSignalStrength;
+ }
+
+ /**
+ * returns the total number of packets sent or received in sample duration
+ * @return number of packets or {@link android.net.LinkQualityInfo#UNKNOWN_LONG}
+ */
+ public long getPacketCount() {
+ return mPacketCount;
+ }
+
+ /**
+ * @hide
+ */
+ public void setPacketCount(long packetCount) {
+ mPacketCount = packetCount;
+ }
+
+ /**
+ * returns the total number of packets errors encountered in sample duration
+ * @return number of errors or {@link android.net.LinkQualityInfo#UNKNOWN_LONG}
+ */
+ public long getPacketErrorCount() {
+ return mPacketErrorCount;
+ }
+
+ /**
+ * @hide
+ */
+ public void setPacketErrorCount(long packetErrorCount) {
+ mPacketErrorCount = packetErrorCount;
+ }
+
+ /**
+ * returns the theoretical upload bandwidth of this network
+ * @return bandwidth in Kbps or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getTheoreticalTxBandwidth() {
+ return mTheoreticalTxBandwidth;
+ }
+
+ /**
+ * @hide
+ */
+ public void setTheoreticalTxBandwidth(int theoreticalTxBandwidth) {
+ mTheoreticalTxBandwidth = theoreticalTxBandwidth;
+ }
+
+ /**
+ * returns the theoretical download bandwidth of this network
+ * @return bandwidth in Kbps or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getTheoreticalRxBandwidth() {
+ return mTheoreticalRxBandwidth;
+ }
+
+ /**
+ * @hide
+ */
+ public void setTheoreticalRxBandwidth(int theoreticalRxBandwidth) {
+ mTheoreticalRxBandwidth = theoreticalRxBandwidth;
+ }
+
+ /**
+ * returns the theoretical latency of this network
+ * @return latency in milliseconds or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getTheoreticalLatency() {
+ return mTheoreticalLatency;
+ }
+
+ /**
+ * @hide
+ */
+ public void setTheoreticalLatency(int theoreticalLatency) {
+ mTheoreticalLatency = theoreticalLatency;
+ }
+
+ /**
+ * returns the time stamp of the last sample
+ * @return milliseconds elapsed since start and sample time or
+ * {@link android.net.LinkQualityInfo#UNKNOWN_LONG}
+ */
+ public long getLastDataSampleTime() {
+ return mLastDataSampleTime;
+ }
+
+ /**
+ * @hide
+ */
+ public void setLastDataSampleTime(long lastDataSampleTime) {
+ mLastDataSampleTime = lastDataSampleTime;
+ }
+
+ /**
+ * returns the sample duration used
+ * @return duration in milliseconds or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getDataSampleDuration() {
+ return mDataSampleDuration;
+ }
+
+ /**
+ * @hide
+ */
+ public void setDataSampleDuration(int dataSampleDuration) {
+ mDataSampleDuration = dataSampleDuration;
+ }
+}
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index faa13b0..1cfcae1 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -80,6 +80,8 @@
private SamplingDataTracker mSamplingDataTracker = new SamplingDataTracker();
+ private static final int UNKNOWN = LinkQualityInfo.UNKNOWN_INT;
+
/**
* Create a new MobileDataStateTracker
* @param netType the ConnectivityManager network type
@@ -690,59 +692,59 @@
}
@Override
- public LinkInfo getLinkInfo() {
+ public LinkQualityInfo getLinkQualityInfo() {
if (mNetworkInfo == null || mNetworkInfo.getType() == ConnectivityManager.TYPE_NONE) {
// no data available yet; just return
return null;
}
- MobileLinkInfo li = new MobileLinkInfo();
+ MobileLinkQualityInfo li = new MobileLinkQualityInfo();
- li.mNetworkType = mNetworkInfo.getType();
+ li.setNetworkType(mNetworkInfo.getType());
- mSamplingDataTracker.setCommonLinkInfoFields(li);
+ mSamplingDataTracker.setCommonLinkQualityInfoFields(li);
if (mNetworkInfo.getSubtype() != TelephonyManager.NETWORK_TYPE_UNKNOWN) {
- li.mMobileNetworkType = mNetworkInfo.getSubtype();
+ li.setMobileNetworkType(mNetworkInfo.getSubtype());
NetworkDataEntry entry = getNetworkDataEntry(mNetworkInfo.getSubtype());
if (entry != null) {
- li.mTheoreticalRxBandwidth = entry.downloadBandwidth;
- li.mTheoreticalRxBandwidth = entry.uploadBandwidth;
- li.mTheoreticalLatency = entry.latency;
+ li.setTheoreticalRxBandwidth(entry.downloadBandwidth);
+ li.setTheoreticalRxBandwidth(entry.uploadBandwidth);
+ li.setTheoreticalLatency(entry.latency);
}
if (mSignalStrength != null) {
- li.mNormalizedSignalStrength = getNormalizedSignalStrength(
- li.mMobileNetworkType, mSignalStrength);
+ li.setNormalizedSignalStrength(getNormalizedSignalStrength(
+ li.getMobileNetworkType(), mSignalStrength));
}
}
SignalStrength ss = mSignalStrength;
if (ss != null) {
- li.mRssi = ss.getGsmSignalStrength();
- li.mGsmErrorRate = ss.getGsmBitErrorRate();
- li.mCdmaDbm = ss.getCdmaDbm();
- li.mCdmaEcio = ss.getCdmaEcio();
- li.mEvdoDbm = ss.getEvdoDbm();
- li.mEvdoEcio = ss.getEvdoEcio();
- li.mEvdoSnr = ss.getEvdoSnr();
- li.mLteSignalStrength = ss.getLteSignalStrength();
- li.mLteRsrp = ss.getLteRsrp();
- li.mLteRsrq = ss.getLteRsrq();
- li.mLteRssnr = ss.getLteRssnr();
- li.mLteCqi = ss.getLteCqi();
+ li.setRssi(ss.getGsmSignalStrength());
+ li.setGsmErrorRate(ss.getGsmBitErrorRate());
+ li.setCdmaDbm(ss.getCdmaDbm());
+ li.setCdmaEcio(ss.getCdmaEcio());
+ li.setEvdoDbm(ss.getEvdoDbm());
+ li.setEvdoEcio(ss.getEvdoEcio());
+ li.setEvdoSnr(ss.getEvdoSnr());
+ li.setLteSignalStrength(ss.getLteSignalStrength());
+ li.setLteRsrp(ss.getLteRsrp());
+ li.setLteRsrq(ss.getLteRsrq());
+ li.setLteRssnr(ss.getLteRssnr());
+ li.setLteCqi(ss.getLteCqi());
}
if (VDBG) {
- Slog.d(TAG, "Returning LinkInfo with"
- + " MobileNetworkType = " + String.valueOf(li.mMobileNetworkType)
- + " Theoretical Rx BW = " + String.valueOf(li.mTheoreticalRxBandwidth)
- + " gsm Signal Strength = " + String.valueOf(li.mRssi)
- + " cdma Signal Strength = " + String.valueOf(li.mCdmaDbm)
- + " evdo Signal Strength = " + String.valueOf(li.mEvdoDbm)
- + " Lte Signal Strength = " + String.valueOf(li.mLteSignalStrength));
+ Slog.d(TAG, "Returning LinkQualityInfo with"
+ + " MobileNetworkType = " + String.valueOf(li.getMobileNetworkType())
+ + " Theoretical Rx BW = " + String.valueOf(li.getTheoreticalRxBandwidth())
+ + " gsm Signal Strength = " + String.valueOf(li.getRssi())
+ + " cdma Signal Strength = " + String.valueOf(li.getCdmaDbm())
+ + " evdo Signal Strength = " + String.valueOf(li.getEvdoDbm())
+ + " Lte Signal Strength = " + String.valueOf(li.getLteSignalStrength()));
}
return li;
@@ -763,21 +765,21 @@
}
private static NetworkDataEntry [] mTheoreticalBWTable = new NetworkDataEntry[] {
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EDGE, 237, 118, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_GPRS, 48, 40, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_UMTS, 384, 64, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSDPA, 14400, -1, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSUPA, 14400, 5760, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSPA, 14400, 5760, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSPAP, 21000, 5760, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_CDMA, -1, -1, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_1xRTT, -1, -1, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EVDO_0, 2468, 153, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EVDO_A, 3072, 1800, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EVDO_B, 14700, 1800, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_IDEN, -1, -1, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_LTE, 100000, 50000, -1),
- new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EHRPD, -1, -1, -1),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EDGE, 237, 118, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_GPRS, 48, 40, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_UMTS, 384, 64, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSDPA, 14400, UNKNOWN, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSUPA, 14400, 5760, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSPA, 14400, 5760, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_HSPAP, 21000, 5760, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_CDMA, UNKNOWN, UNKNOWN, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_1xRTT, UNKNOWN, UNKNOWN, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EVDO_0, 2468, 153, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EVDO_A, 3072, 1800, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EVDO_B, 14700, 1800, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_IDEN, UNKNOWN, UNKNOWN, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_LTE, 100000, 50000, UNKNOWN),
+ new NetworkDataEntry(TelephonyManager.NETWORK_TYPE_EHRPD, UNKNOWN, UNKNOWN, UNKNOWN),
};
private static NetworkDataEntry getNetworkDataEntry(int networkType) {
@@ -820,10 +822,10 @@
case TelephonyManager.NETWORK_TYPE_IDEN:
case TelephonyManager.NETWORK_TYPE_EHRPD:
default:
- return LinkInfo.UNKNOWN;
+ return UNKNOWN;
}
- return (level * LinkInfo.NORMALIZED_SIGNAL_STRENGTH_RANGE) /
+ return (level * LinkQualityInfo.NORMALIZED_SIGNAL_STRENGTH_RANGE) /
SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
}
diff --git a/core/java/android/net/MobileLinkInfo.java b/core/java/android/net/MobileLinkInfo.java
deleted file mode 100644
index 2d18275..0000000
--- a/core/java/android/net/MobileLinkInfo.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.net.LinkInfo;
-
-/**
- * Class that represents useful attributes of mobile network links
- * such as the upload/download throughput or error rate etc.
- * @hide
- */
-public final class MobileLinkInfo extends LinkInfo
-{
- // Represents TelephonyManager.NetworkType
- public int mMobileNetworkType = UNKNOWN;
- public int mRssi = UNKNOWN;
- public int mGsmErrorRate = UNKNOWN;
- public int mCdmaDbm = UNKNOWN;
- public int mCdmaEcio = UNKNOWN;
- public int mEvdoDbm = UNKNOWN;
- public int mEvdoEcio = UNKNOWN;
- public int mEvdoSnr = UNKNOWN;
- public int mLteSignalStrength = UNKNOWN;
- public int mLteRsrp = UNKNOWN;
- public int mLteRsrq = UNKNOWN;
- public int mLteRssnr = UNKNOWN;
- public int mLteCqi = UNKNOWN;
-
- /**
- * Implement the Parcelable interface.
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- super.writeToParcel(dest, flags, OBJECT_TYPE_MOBILE_LINKINFO);
-
- dest.writeInt(mMobileNetworkType);
- dest.writeInt(mRssi);
- dest.writeInt(mGsmErrorRate);
- dest.writeInt(mCdmaDbm);
- dest.writeInt(mCdmaEcio);
- dest.writeInt(mEvdoDbm);
- dest.writeInt(mEvdoEcio);
- dest.writeInt(mEvdoSnr);
- dest.writeInt(mLteSignalStrength);
- dest.writeInt(mLteRsrp);
- dest.writeInt(mLteRsrq);
- dest.writeInt(mLteRssnr);
- dest.writeInt(mLteCqi);
- }
-
- /* Un-parceling helper */
- public static MobileLinkInfo createFromParcelBody(Parcel in) {
-
- MobileLinkInfo li = new MobileLinkInfo();
-
- li.initializeFromParcel(in);
-
- li.mMobileNetworkType = in.readInt();
- li.mRssi = in.readInt();
- li.mGsmErrorRate = in.readInt();
- li.mCdmaDbm = in.readInt();
- li.mCdmaEcio = in.readInt();
- li.mEvdoDbm = in.readInt();
- li.mEvdoEcio = in.readInt();
- li.mEvdoSnr = in.readInt();
- li.mLteSignalStrength = in.readInt();
- li.mLteRsrp = in.readInt();
- li.mLteRsrq = in.readInt();
- li.mLteRssnr = in.readInt();
- li.mLteCqi = in.readInt();
-
- return li;
- }
-}
diff --git a/core/java/android/net/MobileLinkQualityInfo.java b/core/java/android/net/MobileLinkQualityInfo.java
new file mode 100644
index 0000000..a01fc80
--- /dev/null
+++ b/core/java/android/net/MobileLinkQualityInfo.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net;
+
+import android.os.Parcel;
+
+/**
+ * Class that represents useful attributes of mobile network links
+ * such as the upload/download throughput or error rate etc.
+ * @hide
+ */
+public class MobileLinkQualityInfo extends LinkQualityInfo {
+ // Represents TelephonyManager.NetworkType
+ private int mMobileNetworkType = UNKNOWN_INT;
+ private int mRssi = UNKNOWN_INT;
+ private int mGsmErrorRate = UNKNOWN_INT;
+ private int mCdmaDbm = UNKNOWN_INT;
+ private int mCdmaEcio = UNKNOWN_INT;
+ private int mEvdoDbm = UNKNOWN_INT;
+ private int mEvdoEcio = UNKNOWN_INT;
+ private int mEvdoSnr = UNKNOWN_INT;
+ private int mLteSignalStrength = UNKNOWN_INT;
+ private int mLteRsrp = UNKNOWN_INT;
+ private int mLteRsrq = UNKNOWN_INT;
+ private int mLteRssnr = UNKNOWN_INT;
+ private int mLteCqi = UNKNOWN_INT;
+
+ /**
+ * Implement the Parcelable interface.
+ * @hide
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags, OBJECT_TYPE_MOBILE_LINK_QUALITY_INFO);
+
+ dest.writeInt(mMobileNetworkType);
+ dest.writeInt(mRssi);
+ dest.writeInt(mGsmErrorRate);
+ dest.writeInt(mCdmaDbm);
+ dest.writeInt(mCdmaEcio);
+ dest.writeInt(mEvdoDbm);
+ dest.writeInt(mEvdoEcio);
+ dest.writeInt(mEvdoSnr);
+ dest.writeInt(mLteSignalStrength);
+ dest.writeInt(mLteRsrp);
+ dest.writeInt(mLteRsrq);
+ dest.writeInt(mLteRssnr);
+ dest.writeInt(mLteCqi);
+ }
+
+ /* Un-parceling helper */
+ /**
+ * @hide
+ */
+ public static MobileLinkQualityInfo createFromParcelBody(Parcel in) {
+
+ MobileLinkQualityInfo li = new MobileLinkQualityInfo();
+
+ li.initializeFromParcel(in);
+
+ li.mMobileNetworkType = in.readInt();
+ li.mRssi = in.readInt();
+ li.mGsmErrorRate = in.readInt();
+ li.mCdmaDbm = in.readInt();
+ li.mCdmaEcio = in.readInt();
+ li.mEvdoDbm = in.readInt();
+ li.mEvdoEcio = in.readInt();
+ li.mEvdoSnr = in.readInt();
+ li.mLteSignalStrength = in.readInt();
+ li.mLteRsrp = in.readInt();
+ li.mLteRsrq = in.readInt();
+ li.mLteRssnr = in.readInt();
+ li.mLteCqi = in.readInt();
+
+ return li;
+ }
+
+ /**
+ * returns mobile network type as defined by {@link android.telephony.TelephonyManager}
+ * @return network type or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getMobileNetworkType() {
+ return mMobileNetworkType;
+ }
+
+ /**
+ * @hide
+ */
+ public void setMobileNetworkType(int mobileNetworkType) {
+ mMobileNetworkType = mobileNetworkType;
+ }
+
+ /**
+ * returns signal strength for GSM networks
+ * @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getRssi() {
+ return mRssi;
+ }
+
+ /**
+ * @hide
+ */
+ public void setRssi(int Rssi) {
+ mRssi = Rssi;
+ }
+
+ /**
+ * returns error rates for GSM networks
+ * @return error rate or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getGsmErrorRate() {
+ return mGsmErrorRate;
+ }
+
+ /**
+ * @hide
+ */
+ public void setGsmErrorRate(int gsmErrorRate) {
+ mGsmErrorRate = gsmErrorRate;
+ }
+
+ /**
+ * returns signal strength for CDMA networks
+ * @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getCdmaDbm() {
+ return mCdmaDbm;
+ }
+
+ /**
+ * @hide
+ */
+ public void setCdmaDbm(int cdmaDbm) {
+ mCdmaDbm = cdmaDbm;
+ }
+
+ /**
+ * returns signal to noise ratio for CDMA networks
+ * @return signal to noise ratio in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getCdmaEcio() {
+ return mCdmaEcio;
+ }
+
+ /**
+ * @hide
+ */
+ public void setCdmaEcio(int cdmaEcio) {
+ mCdmaEcio = cdmaEcio;
+ }
+
+ /**
+ * returns signal strength for EVDO networks
+ * @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getEvdoDbm() {
+ return mEvdoDbm;
+ }
+
+ /**
+ * @hide
+ */
+ public void setEvdoDbm(int evdoDbm) {
+ mEvdoDbm = evdoDbm;
+ }
+
+ /**
+ * returns signal to noise ratio for EVDO spectrum
+ * @return signal to noise ration in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getEvdoEcio() {
+ return mEvdoEcio;
+ }
+
+ /**
+ * @hide
+ */
+ public void setEvdoEcio(int evdoEcio) {
+ mEvdoEcio = evdoEcio;
+ }
+
+ /**
+ * returns end-to-end signal to noise ratio for EVDO networks
+ * @return signal to noise ration in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getEvdoSnr() {
+ return mEvdoSnr;
+ }
+
+ /**
+ * @hide
+ */
+ public void setEvdoSnr(int evdoSnr) {
+ mEvdoSnr = evdoSnr;
+ }
+
+ /**
+ * returns signal strength for LTE network
+ * @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getLteSignalStrength() {
+ return mLteSignalStrength;
+ }
+
+ /**
+ * @hide
+ */
+ public void setLteSignalStrength(int lteSignalStrength) {
+ mLteSignalStrength = lteSignalStrength;
+ }
+
+ /**
+ * returns RSRP (Reference Signal Received Power) for LTE network
+ * @return RSRP in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getLteRsrp() {
+ return mLteRsrp;
+ }
+
+ /**
+ * @hide
+ */
+ public void setLteRsrp(int lteRsrp) {
+ mLteRsrp = lteRsrp;
+ }
+
+ /**
+ * returns RSRQ (Reference Signal Received Quality) for LTE network
+ * @return RSRQ ??? or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getLteRsrq() {
+ return mLteRsrq;
+ }
+
+ /**
+ * @hide
+ */
+ public void setLteRsrq(int lteRsrq) {
+ mLteRsrq = lteRsrq;
+ }
+
+ /**
+ * returns signal to noise ratio for LTE networks
+ * @return signal to noise ration in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getLteRssnr() {
+ return mLteRssnr;
+ }
+
+ /**
+ * @hide
+ */
+ public void setLteRssnr(int lteRssnr) {
+ mLteRssnr = lteRssnr;
+ }
+
+ /**
+ * returns channel quality indicator for LTE networks
+ * @return CQI or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getLteCqi() {
+ return mLteCqi;
+ }
+
+ /**
+ * @hide
+ */
+ public void setLteCqi(int lteCqi) {
+ mLteCqi = lteCqi;
+ }
+}
diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java
index a3d7b14..1ca9255 100644
--- a/core/java/android/net/NetworkStateTracker.java
+++ b/core/java/android/net/NetworkStateTracker.java
@@ -122,7 +122,7 @@
* Get interesting information about this network link
* @return a copy of link information, null if not available
*/
- public LinkInfo getLinkInfo();
+ public LinkQualityInfo getLinkQualityInfo();
/**
* Return the system properties name associated with the tcp buffer sizes
diff --git a/core/java/android/net/SamplingDataTracker.java b/core/java/android/net/SamplingDataTracker.java
index ac24930..acd56f2 100644
--- a/core/java/android/net/SamplingDataTracker.java
+++ b/core/java/android/net/SamplingDataTracker.java
@@ -189,7 +189,7 @@
if (mBeginningSample != null && mEndingSample != null) {
return mEndingSample.mTxByteCount - mBeginningSample.mTxByteCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
}
@@ -199,7 +199,7 @@
if (mBeginningSample != null && mEndingSample != null) {
return mEndingSample.mTxPacketCount - mBeginningSample.mTxPacketCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
}
@@ -209,7 +209,7 @@
if (mBeginningSample != null && mEndingSample != null) {
return mEndingSample.mTxPacketErrorCount - mBeginningSample.mTxPacketErrorCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
}
@@ -219,7 +219,7 @@
if (mBeginningSample != null && mEndingSample != null) {
return mEndingSample.mRxByteCount - mBeginningSample.mRxByteCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
}
@@ -229,7 +229,7 @@
if (mBeginningSample != null && mEndingSample != null) {
return mEndingSample.mRxPacketCount - mBeginningSample.mRxPacketCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
}
@@ -244,7 +244,7 @@
long txPacketCount = end.mTxPacketCount - begin.mTxPacketCount;
return rxPacketCount + txPacketCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
@@ -254,7 +254,7 @@
long txPacketErrorCount = getSampledTxPacketErrorCount();
return rxPacketErrorCount + txPacketErrorCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
@@ -263,7 +263,7 @@
if (mBeginningSample != null && mEndingSample != null) {
return mEndingSample.mRxPacketErrorCount - mBeginningSample.mRxPacketErrorCount;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
}
@@ -273,7 +273,7 @@
if (mEndingSample != null) {
return mEndingSample.mTimestamp;
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_LONG;
}
}
}
@@ -283,17 +283,17 @@
if (mBeginningSample != null && mEndingSample != null) {
return (int) (mEndingSample.mTimestamp - mBeginningSample.mTimestamp);
} else {
- return LinkInfo.UNKNOWN;
+ return LinkQualityInfo.UNKNOWN_INT;
}
}
}
- public void setCommonLinkInfoFields(LinkInfo li) {
+ public void setCommonLinkQualityInfoFields(LinkQualityInfo li) {
synchronized(mSamplingDataLock) {
- li.mLastDataSampleTime = getSampleTimestamp();
- li.mDataSampleDuration = getSampleDuration();
- li.mPacketCount = getSampledPacketCount();
- li.mPacketErrorCount = getSampledPacketErrorCount();
+ li.setLastDataSampleTime(getSampleTimestamp());
+ li.setDataSampleDuration(getSampleDuration());
+ li.setPacketCount(getSampledPacketCount());
+ li.setPacketErrorCount(getSampledPacketErrorCount());
}
}
}
diff --git a/core/java/android/net/WifiLinkInfo.java b/core/java/android/net/WifiLinkInfo.java
deleted file mode 100644
index a21f1fe7..0000000
--- a/core/java/android/net/WifiLinkInfo.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.net.LinkInfo;
-
-/**
- * Class that represents useful attributes of wifi network links
- * such as the upload/download throughput or error rate etc.
- * @hide
- */
-public final class WifiLinkInfo extends LinkInfo
-{
- /**
- * Type enumerations for Wifi Network
- */
-
- /* Indicates Wifi network type such as b/g etc*/
- public int mType = UNKNOWN;
-
- public String mBssid;
-
- /* Rssi found by scans */
- public int mRssi = UNKNOWN;
-
- /* packet statistics */
- public long mTxGood = UNKNOWN;
- public long mTxBad = UNKNOWN;
-
- /**
- * Implement the Parcelable interface.
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- super.writeToParcel(dest, flags, OBJECT_TYPE_WIFI_LINKINFO);
-
- dest.writeInt(mType);
- dest.writeInt(mRssi);
- dest.writeLong(mTxGood);
- dest.writeLong(mTxBad);
-
- dest.writeString(mBssid);
- }
-
- /* Un-parceling helper */
- public static WifiLinkInfo createFromParcelBody(Parcel in) {
- WifiLinkInfo li = new WifiLinkInfo();
-
- li.initializeFromParcel(in);
-
- li.mType = in.readInt();
- li.mRssi = in.readInt();
- li.mTxGood = in.readLong();
- li.mTxBad = in.readLong();
-
- li.mBssid = in.readString();
-
- return li;
- }
-}
diff --git a/core/java/android/net/WifiLinkQualityInfo.java b/core/java/android/net/WifiLinkQualityInfo.java
new file mode 100644
index 0000000..20ec9a7
--- /dev/null
+++ b/core/java/android/net/WifiLinkQualityInfo.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net;
+
+import android.os.Parcel;
+
+/**
+ * Class that represents useful attributes of wifi network links
+ * such as the upload/download throughput or error rate etc.
+ * @hide
+ */
+public class WifiLinkQualityInfo extends LinkQualityInfo {
+
+ /* Indicates Wifi network type such as b/g etc*/
+ private int mType = UNKNOWN_INT;
+
+ private String mBssid;
+
+ /* Rssi found by scans */
+ private int mRssi = UNKNOWN_INT;
+
+ /* packet statistics */
+ private long mTxGood = UNKNOWN_LONG;
+ private long mTxBad = UNKNOWN_LONG;
+
+ /**
+ * Implement the Parcelable interface.
+ * @hide
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags, OBJECT_TYPE_WIFI_LINK_QUALITY_INFO);
+
+ dest.writeInt(mType);
+ dest.writeInt(mRssi);
+ dest.writeLong(mTxGood);
+ dest.writeLong(mTxBad);
+
+ dest.writeString(mBssid);
+ }
+
+ /* Un-parceling helper */
+ /**
+ * @hide
+ */
+ public static WifiLinkQualityInfo createFromParcelBody(Parcel in) {
+ WifiLinkQualityInfo li = new WifiLinkQualityInfo();
+
+ li.initializeFromParcel(in);
+
+ li.mType = in.readInt();
+ li.mRssi = in.readInt();
+ li.mTxGood = in.readLong();
+ li.mTxBad = in.readLong();
+
+ li.mBssid = in.readString();
+
+ return li;
+ }
+
+ /**
+ * returns Wifi network type
+ * @return network type or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getType() {
+ return mType;
+ }
+
+ /**
+ * @hide
+ */
+ public void setType(int type) {
+ mType = type;
+ }
+
+ /**
+ * returns BSSID of the access point
+ * @return the BSSID, in the form of a six-byte MAC address: {@code XX:XX:XX:XX:XX:XX} or null
+ */
+ public String getBssid() {
+ return mBssid;
+ }
+
+ /**
+ * @hide
+ */
+ public void setBssid(String bssid) {
+ mBssid = bssid;
+ }
+
+ /**
+ * returns RSSI of the network in raw form
+ * @return un-normalized RSSI or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
+ */
+ public int getRssi() {
+ return mRssi;
+ }
+
+ /**
+ * @hide
+ */
+ public void setRssi(int rssi) {
+ mRssi = rssi;
+ }
+
+ /**
+ * returns number of packets transmitted without error
+ * @return number of packets or {@link android.net.LinkQualityInfo#UNKNOWN_LONG}
+ */
+ public long getTxGood() {
+ return mTxGood;
+ }
+
+ /**
+ * @hide
+ */
+ public void setTxGood(long txGood) {
+ mTxGood = txGood;
+ }
+
+ /**
+ * returns number of transmitted packets that encountered errors
+ * @return number of packets or {@link android.net.LinkQualityInfo#UNKNOWN_LONG}
+ */
+ public long getTxBad() {
+ return mTxBad;
+ }
+
+ /**
+ * @hide
+ */
+ public void setTxBad(long txBad) {
+ mTxBad = txBad;
+ }
+}