summaryrefslogtreecommitdiff
path: root/wifi/java/android/net/wifi/WifiInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'wifi/java/android/net/wifi/WifiInfo.java')
-rw-r--r--wifi/java/android/net/wifi/WifiInfo.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index 18bda9b60fec..7175567f5973 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -25,8 +25,10 @@ import android.net.NetworkInfo.DetailedState;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.SubscriptionManager;
import android.text.TextUtils;
+import com.android.modules.utils.build.SdkLevel;
import com.android.net.module.util.Inet4AddressUtils;
import java.net.Inet4Address;
@@ -169,6 +171,11 @@ public class WifiInfo implements Parcelable {
private boolean mOemPrivate;
/**
+ * Whether the network is a carrier merged network.
+ */
+ private boolean mCarrierMerged;
+
+ /**
* OSU (Online Sign Up) AP for Passpoint R2.
*/
private boolean mOsuAp;
@@ -190,6 +197,11 @@ public class WifiInfo implements Parcelable {
private String mRequestingPackageName;
/**
+ * Identify which Telephony subscription provides this network.
+ */
+ private int mSubscriptionId;
+
+ /**
* Running total count of lost (not ACKed) transmitted unicast data packets.
* @hide
*/
@@ -319,6 +331,7 @@ public class WifiInfo implements Parcelable {
mRssi = INVALID_RSSI;
mLinkSpeed = LINK_SPEED_UNKNOWN;
mFrequency = -1;
+ mSubscriptionId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
/** @hide */
@@ -339,11 +352,13 @@ public class WifiInfo implements Parcelable {
setTrusted(false);
setOemPaid(false);
setOemPrivate(false);
+ setCarrierMerged(false);
setOsuAp(false);
setRequestingPackageName(null);
setFQDN(null);
setProviderFriendlyName(null);
setPasspointUniqueId(null);
+ setSubscriptionId(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
setHe8ssCapableAp(false);
setVhtMax8SpatialStreamsSupport(false);
txBad = 0;
@@ -379,11 +394,13 @@ public class WifiInfo implements Parcelable {
mTrusted = source.mTrusted;
mOemPaid = source.mOemPaid;
mOemPrivate = source.mOemPrivate;
+ mCarrierMerged = source.mCarrierMerged;
mRequestingPackageName =
source.mRequestingPackageName;
mOsuAp = source.mOsuAp;
mFqdn = source.mFqdn;
mProviderFriendlyName = source.mProviderFriendlyName;
+ mSubscriptionId = source.mSubscriptionId;
mVhtMax8SpatialStreamsSupport = source.mVhtMax8SpatialStreamsSupport;
mHe8ssCapableAp = source.mHe8ssCapableAp;
txBad = source.txBad;
@@ -761,6 +778,9 @@ public class WifiInfo implements Parcelable {
*/
@SystemApi
public boolean isOemPaid() {
+ if (!SdkLevel.isAtLeastS()) {
+ throw new UnsupportedOperationException();
+ }
return mOemPaid;
}
@@ -776,9 +796,33 @@ public class WifiInfo implements Parcelable {
*/
@SystemApi
public boolean isOemPrivate() {
+ if (!SdkLevel.isAtLeastS()) {
+ throw new UnsupportedOperationException();
+ }
return mOemPrivate;
}
+ /**
+ * {@hide}
+ */
+ public void setCarrierMerged(boolean carrierMerged) {
+ mCarrierMerged = carrierMerged;
+ }
+
+ /**
+ * Returns true if the current Wifi network is a carrier merged network, false otherwise.
+ * @see WifiNetworkSuggestion.Builder#setCarrierMerged(boolean).
+ * {@hide}
+ */
+ @SystemApi
+ public boolean isCarrierMerged() {
+ if (!SdkLevel.isAtLeastS()) {
+ throw new UnsupportedOperationException();
+ }
+ return mCarrierMerged;
+ }
+
+
/** {@hide} */
public void setOsuAp(boolean osuAp) {
mOsuAp = osuAp;
@@ -847,6 +891,28 @@ public class WifiInfo implements Parcelable {
return mRequestingPackageName;
}
+ /** {@hide} */
+ public void setSubscriptionId(int subId) {
+ mSubscriptionId = subId;
+ }
+
+ /**
+ * If this network is provisioned by a carrier, returns subscription Id corresponding to the
+ * associated SIM on the device. If this network is not provisioned by a carrier, returns
+ * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID}
+ *
+ * @see WifiNetworkSuggestion.Builder#setSubscriptionId(int)
+ * @see android.telephony.SubscriptionInfo#getSubscriptionId()
+ * {@hide}
+ */
+ @SystemApi
+ public int getSubscriptionId() {
+ if (!SdkLevel.isAtLeastS()) {
+ throw new UnsupportedOperationException();
+ }
+ return mSubscriptionId;
+ }
+
/** @hide */
@UnsupportedAppUsage
@@ -1040,6 +1106,7 @@ public class WifiInfo implements Parcelable {
dest.writeInt(mTrusted ? 1 : 0);
dest.writeInt(mOemPaid ? 1 : 0);
dest.writeInt(mOemPrivate ? 1 : 0);
+ dest.writeInt(mCarrierMerged ? 1 : 0);
dest.writeInt(score);
dest.writeLong(txSuccess);
dest.writeDouble(mSuccessfulTxPacketsPerSecond);
@@ -1060,6 +1127,7 @@ public class WifiInfo implements Parcelable {
dest.writeInt(mMaxSupportedTxLinkSpeed);
dest.writeInt(mMaxSupportedRxLinkSpeed);
dest.writeString(mPasspointUniqueId);
+ dest.writeInt(mSubscriptionId);
}
/** Implement the Parcelable interface {@hide} */
@@ -1089,6 +1157,7 @@ public class WifiInfo implements Parcelable {
info.mTrusted = in.readInt() != 0;
info.mOemPaid = in.readInt() != 0;
info.mOemPrivate = in.readInt() != 0;
+ info.mCarrierMerged = in.readInt() != 0;
info.score = in.readInt();
info.txSuccess = in.readLong();
info.mSuccessfulTxPacketsPerSecond = in.readDouble();
@@ -1109,6 +1178,7 @@ public class WifiInfo implements Parcelable {
info.mMaxSupportedTxLinkSpeed = in.readInt();
info.mMaxSupportedRxLinkSpeed = in.readInt();
info.mPasspointUniqueId = in.readString();
+ info.mSubscriptionId = in.readInt();
return info;
}