diff options
Diffstat (limited to 'wifi/java')
12 files changed, 254 insertions, 227 deletions
diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/DeviceInfo.aidl b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetwork.aidl index 35d5c15a161b..f9c4829c8f93 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/DeviceInfo.aidl +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetwork.aidl @@ -16,4 +16,4 @@ package android.net.wifi.sharedconnectivity.app; -parcelable DeviceInfo;
\ No newline at end of file +parcelable HotspotNetwork; diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetwork.java b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetwork.java index 7b591d3a45bd..5cf19fb90195 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetwork.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetwork.java @@ -33,14 +33,14 @@ import java.util.Objects; import java.util.Set; /** - * A data class representing an Instant Tether network. + * A data class representing a hotspot network. * This class is used in IPC calls between the implementer of {@link SharedConnectivityService} and * the consumers of {@link com.android.wifitrackerlib}. * * @hide */ @SystemApi -public final class TetherNetwork implements Parcelable { +public final class HotspotNetwork implements Parcelable { /** * Remote device is connected to the internet via an unknown connection. */ @@ -71,33 +71,44 @@ public final class TetherNetwork implements Parcelable { NETWORK_TYPE_WIFI, NETWORK_TYPE_ETHERNET }) - public @interface NetworkType {} + public @interface NetworkType { + } private final long mDeviceId; - private final DeviceInfo mDeviceInfo; - @NetworkType private final int mNetworkType; + private final NetworkProviderInfo mNetworkProviderInfo; + @NetworkType + private final int mNetworkType; private final String mNetworkName; - @Nullable private final String mHotspotSsid; - @Nullable private final String mHotspotBssid; - @Nullable @SecurityType private final ArraySet<Integer> mHotspotSecurityTypes; + @Nullable + private final String mHotspotSsid; + @Nullable + private final String mHotspotBssid; + @Nullable + @SecurityType + private final ArraySet<Integer> mHotspotSecurityTypes; /** - * Builder class for {@link TetherNetwork}. + * Builder class for {@link HotspotNetwork}. */ public static final class Builder { private long mDeviceId = -1; - private DeviceInfo mDeviceInfo; - @NetworkType private int mNetworkType; + private NetworkProviderInfo mNetworkProviderInfo; + @NetworkType + private int mNetworkType; private String mNetworkName; - @Nullable private String mHotspotSsid; - @Nullable private String mHotspotBssid; - @Nullable @SecurityType private final ArraySet<Integer> mHotspotSecurityTypes = + @Nullable + private String mHotspotSsid; + @Nullable + private String mHotspotBssid; + @Nullable + @SecurityType + private final ArraySet<Integer> mHotspotSecurityTypes = new ArraySet<>(); /** * Set the remote device ID. * - * @param deviceId Locally unique ID for this Instant Tether network. + * @param deviceId Locally unique ID for this Hotspot network. * @return Returns the Builder object. */ @NonNull @@ -109,12 +120,12 @@ public final class TetherNetwork implements Parcelable { /** * Sets information about the device providing connectivity. * - * @param deviceInfo The device information object. + * @param networkProviderInfo The device information object. * @return Returns the Builder object. */ @NonNull - public Builder setDeviceInfo(@NonNull DeviceInfo deviceInfo) { - mDeviceInfo = deviceInfo; + public Builder setNetworkProviderInfo(@NonNull NetworkProviderInfo networkProviderInfo) { + mNetworkProviderInfo = networkProviderInfo; return this; } @@ -125,7 +136,7 @@ public final class TetherNetwork implements Parcelable { * @return Returns the Builder object. */ @NonNull - public Builder setNetworkType(@NetworkType int networkType) { + public Builder setHostNetworkType(@NetworkType int networkType) { mNetworkType = networkType; return this; } @@ -179,15 +190,15 @@ public final class TetherNetwork implements Parcelable { } /** - * Builds the {@link TetherNetwork} object. + * Builds the {@link HotspotNetwork} object. * - * @return Returns the built {@link TetherNetwork} object. + * @return Returns the built {@link HotspotNetwork} object. */ @NonNull - public TetherNetwork build() { - return new TetherNetwork( + public HotspotNetwork build() { + return new HotspotNetwork( mDeviceId, - mDeviceInfo, + mNetworkProviderInfo, mNetworkType, mNetworkName, mHotspotSsid, @@ -209,9 +220,9 @@ public final class TetherNetwork implements Parcelable { } } - private TetherNetwork( + private HotspotNetwork( long deviceId, - DeviceInfo deviceInfo, + NetworkProviderInfo networkProviderInfo, @NetworkType int networkType, @NonNull String networkName, @Nullable String hotspotSsid, @@ -221,7 +232,7 @@ public final class TetherNetwork implements Parcelable { networkType, networkName); mDeviceId = deviceId; - mDeviceInfo = deviceInfo; + mNetworkProviderInfo = networkProviderInfo; mNetworkType = networkType; mNetworkName = networkName; mHotspotSsid = hotspotSsid; @@ -232,7 +243,7 @@ public final class TetherNetwork implements Parcelable { /** * Gets the remote device ID. * - * @return Returns the locally unique ID for this Instant Tether network. + * @return Returns the locally unique ID for this Hotspot network. */ public long getDeviceId() { return mDeviceId; @@ -241,11 +252,11 @@ public final class TetherNetwork implements Parcelable { /** * Gets information about the device providing connectivity. * - * @return Returns the information of the device providing the Instant Tether network. + * @return Returns the information of the device providing the Hotspot network. */ @NonNull - public DeviceInfo getDeviceInfo() { - return mDeviceInfo; + public NetworkProviderInfo getNetworkProviderInfo() { + return mNetworkProviderInfo; } /** @@ -254,7 +265,7 @@ public final class TetherNetwork implements Parcelable { * @return Returns the network type as represented by IntDef {@link NetworkType}. */ @NetworkType - public int getNetworkType() { + public int getHostNetworkType() { return mNetworkType; } @@ -301,11 +312,11 @@ public final class TetherNetwork implements Parcelable { @Override public boolean equals(Object obj) { - if (!(obj instanceof TetherNetwork)) return false; - TetherNetwork other = (TetherNetwork) obj; + if (!(obj instanceof HotspotNetwork)) return false; + HotspotNetwork other = (HotspotNetwork) obj; return mDeviceId == other.getDeviceId() - && Objects.equals(mDeviceInfo, other.getDeviceInfo()) - && mNetworkType == other.getNetworkType() + && Objects.equals(mNetworkProviderInfo, other.getNetworkProviderInfo()) + && mNetworkType == other.getHostNetworkType() && Objects.equals(mNetworkName, other.getNetworkName()) && Objects.equals(mHotspotSsid, other.getHotspotSsid()) && Objects.equals(mHotspotBssid, other.getHotspotBssid()) @@ -314,8 +325,8 @@ public final class TetherNetwork implements Parcelable { @Override public int hashCode() { - return Objects.hash(mDeviceId, mDeviceInfo, mNetworkName, mHotspotSsid, mHotspotBssid, - mHotspotSecurityTypes); + return Objects.hash(mDeviceId, mNetworkProviderInfo, mNetworkName, mHotspotSsid, + mHotspotBssid, mHotspotSecurityTypes); } @Override @@ -326,7 +337,7 @@ public final class TetherNetwork implements Parcelable { @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeLong(mDeviceId); - mDeviceInfo.writeToParcel(dest, flags); + mNetworkProviderInfo.writeToParcel(dest, flags); dest.writeInt(mNetworkType); dest.writeString(mNetworkName); dest.writeString(mHotspotSsid); @@ -335,36 +346,36 @@ public final class TetherNetwork implements Parcelable { } /** - * Creates a {@link TetherNetwork} object from a parcel. + * Creates a {@link HotspotNetwork} object from a parcel. * * @hide */ @NonNull - public static TetherNetwork readFromParcel(@NonNull Parcel in) { - return new TetherNetwork(in.readLong(), DeviceInfo.readFromParcel(in), + public static HotspotNetwork readFromParcel(@NonNull Parcel in) { + return new HotspotNetwork(in.readLong(), NetworkProviderInfo.readFromParcel(in), in.readInt(), in.readString(), in.readString(), in.readString(), (ArraySet<Integer>) in.readArraySet(null)); } @NonNull - public static final Creator<TetherNetwork> CREATOR = new Creator<>() { + public static final Creator<HotspotNetwork> CREATOR = new Creator<>() { @Override - public TetherNetwork createFromParcel(Parcel in) { + public HotspotNetwork createFromParcel(Parcel in) { return readFromParcel(in); } @Override - public TetherNetwork[] newArray(int size) { - return new TetherNetwork[size]; + public HotspotNetwork[] newArray(int size) { + return new HotspotNetwork[size]; } }; @Override public String toString() { - return new StringBuilder("TetherNetwork[") + return new StringBuilder("HotspotNetwork[") .append("deviceId=").append(mDeviceId) .append(", networkType=").append(mNetworkType) - .append(", deviceInfo=").append(mDeviceInfo.toString()) + .append(", networkProviderInfo=").append(mNetworkProviderInfo.toString()) .append(", networkName=").append(mNetworkName) .append(", hotspotSsid=").append(mHotspotSsid) .append(", hotspotBssid=").append(mHotspotBssid) diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetworkConnectionStatus.aidl b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetworkConnectionStatus.aidl index c677a6c508ad..d32d15e7c058 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetworkConnectionStatus.aidl +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetworkConnectionStatus.aidl @@ -16,4 +16,4 @@ package android.net.wifi.sharedconnectivity.app; -parcelable TetherNetworkConnectionStatus; +parcelable HotspotNetworkConnectionStatus; diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetworkConnectionStatus.java b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetworkConnectionStatus.java index 3cf44ed3ed32..7a5022329c98 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetworkConnectionStatus.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/HotspotNetworkConnectionStatus.java @@ -28,23 +28,23 @@ import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** - * The status of a connection to an instant tether network after the client called - * {@link SharedConnectivityManager#connectTetherNetwork}. + * The status of a connection to a hotspot network after the client called + * {@link SharedConnectivityManager#connectHotspotNetwork}. * * @hide */ @SystemApi -public final class TetherNetworkConnectionStatus implements Parcelable { +public final class HotspotNetworkConnectionStatus implements Parcelable { /** * Connection status is unknown. */ - public static final int CONNECTION_STATUS_UNKNOWN = 0; + public static final int CONNECTION_STATUS_UNKNOWN = 0; /** * The connection is being initiated. */ - public static final int CONNECTION_STATUS_ENABLING_HOTSPOT = 1; + public static final int CONNECTION_STATUS_ENABLING_HOTSPOT = 1; /** * Device providing the hotspot failed to initiate it. @@ -102,22 +102,23 @@ public final class TetherNetworkConnectionStatus implements Parcelable { CONNECTION_STATUS_ENABLING_HOTSPOT_TIMEOUT, CONNECTION_STATUS_CONNECT_TO_HOTSPOT_FAILED, }) - public @interface ConnectionStatus {} + public @interface ConnectionStatus { + } - @ConnectionStatus private final int mStatus; - private final TetherNetwork mTetherNetwork; + @ConnectionStatus + private final int mStatus; + private final HotspotNetwork mHotspotNetwork; private final Bundle mExtras; /** - * Builder class for {@link TetherNetworkConnectionStatus}. + * Builder class for {@link HotspotNetworkConnectionStatus}. */ public static final class Builder { - @ConnectionStatus private int mStatus; - private TetherNetwork mTetherNetwork; + @ConnectionStatus + private int mStatus; + private HotspotNetwork mHotspotNetwork; private Bundle mExtras; - public Builder() {} - /** * Sets the status of the connection * @@ -130,13 +131,13 @@ public final class TetherNetworkConnectionStatus implements Parcelable { } /** - * Sets the {@link TetherNetwork} object of the connection. + * Sets the {@link HotspotNetwork} object of the connection. * * @return Returns the Builder object. */ @NonNull - public Builder setTetherNetwork(@NonNull TetherNetwork tetherNetwork) { - mTetherNetwork = tetherNetwork; + public Builder setHotspotNetwork(@NonNull HotspotNetwork hotspotNetwork) { + mHotspotNetwork = hotspotNetwork; return this; } @@ -152,20 +153,21 @@ public final class TetherNetworkConnectionStatus implements Parcelable { } /** - * Builds the {@link TetherNetworkConnectionStatus} object. + * Builds the {@link HotspotNetworkConnectionStatus} object. * - * @return Returns the built {@link TetherNetworkConnectionStatus} object. + * @return Returns the built {@link HotspotNetworkConnectionStatus} object. */ @NonNull - public TetherNetworkConnectionStatus build() { - return new TetherNetworkConnectionStatus(mStatus, mTetherNetwork, mExtras); + public HotspotNetworkConnectionStatus build() { + return new HotspotNetworkConnectionStatus(mStatus, mHotspotNetwork, mExtras); } } - private TetherNetworkConnectionStatus(@ConnectionStatus int status, TetherNetwork tetherNetwork, + private HotspotNetworkConnectionStatus(@ConnectionStatus int status, + HotspotNetwork hotspotNetwork, Bundle extras) { mStatus = status; - mTetherNetwork = tetherNetwork; + mHotspotNetwork = hotspotNetwork; mExtras = extras; } @@ -180,13 +182,13 @@ public final class TetherNetworkConnectionStatus implements Parcelable { } /** - * Gets the {@link TetherNetwork} object of the connection. + * Gets the {@link HotspotNetwork} object of the connection. * - * @return Returns a TetherNetwork object. + * @return Returns a HotspotNetwork object. */ @NonNull - public TetherNetwork getTetherNetwork() { - return mTetherNetwork; + public HotspotNetwork getHotspotNetwork() { + return mHotspotNetwork; } /** @@ -201,15 +203,15 @@ public final class TetherNetworkConnectionStatus implements Parcelable { @Override public boolean equals(Object obj) { - if (!(obj instanceof TetherNetworkConnectionStatus)) return false; - TetherNetworkConnectionStatus other = (TetherNetworkConnectionStatus) obj; + if (!(obj instanceof HotspotNetworkConnectionStatus)) return false; + HotspotNetworkConnectionStatus other = (HotspotNetworkConnectionStatus) obj; return mStatus == other.getStatus() - && Objects.equals(mTetherNetwork, other.getTetherNetwork()); + && Objects.equals(mHotspotNetwork, other.getHotspotNetwork()); } @Override public int hashCode() { - return Objects.hash(mStatus, mTetherNetwork); + return Objects.hash(mStatus, mHotspotNetwork); } @Override @@ -220,39 +222,39 @@ public final class TetherNetworkConnectionStatus implements Parcelable { @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mStatus); - mTetherNetwork.writeToParcel(dest, flags); + mHotspotNetwork.writeToParcel(dest, flags); dest.writeBundle(mExtras); } /** - * Creates a {@link TetherNetworkConnectionStatus} object from a parcel. + * Creates a {@link HotspotNetworkConnectionStatus} object from a parcel. * * @hide */ @NonNull - public static TetherNetworkConnectionStatus readFromParcel(@NonNull Parcel in) { - return new TetherNetworkConnectionStatus(in.readInt(), - TetherNetwork.readFromParcel(in), in.readBundle()); + public static HotspotNetworkConnectionStatus readFromParcel(@NonNull Parcel in) { + return new HotspotNetworkConnectionStatus(in.readInt(), + HotspotNetwork.readFromParcel(in), in.readBundle()); } @NonNull - public static final Creator<TetherNetworkConnectionStatus> CREATOR = new Creator<>() { + public static final Creator<HotspotNetworkConnectionStatus> CREATOR = new Creator<>() { @Override - public TetherNetworkConnectionStatus createFromParcel(Parcel in) { + public HotspotNetworkConnectionStatus createFromParcel(Parcel in) { return readFromParcel(in); } @Override - public TetherNetworkConnectionStatus[] newArray(int size) { - return new TetherNetworkConnectionStatus[size]; + public HotspotNetworkConnectionStatus[] newArray(int size) { + return new HotspotNetworkConnectionStatus[size]; } }; @Override public String toString() { - return new StringBuilder("TetherNetworkConnectionStatus[") + return new StringBuilder("HotspotNetworkConnectionStatus[") .append("status=").append(mStatus) - .append("tether network=").append(mTetherNetwork.toString()) + .append("hotspot network=").append(mHotspotNetwork.toString()) .append("extras=").append(mExtras.toString()) .append("]").toString(); } diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/KnownNetwork.java b/wifi/java/src/android/net/wifi/sharedconnectivity/app/KnownNetwork.java index fe23caae7f03..d33e08feacc5 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/KnownNetwork.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/KnownNetwork.java @@ -69,7 +69,7 @@ public final class KnownNetwork implements Parcelable { @NetworkSource private final int mNetworkSource; private final String mSsid; @SecurityType private final ArraySet<Integer> mSecurityTypes; - private final DeviceInfo mDeviceInfo; + private final NetworkProviderInfo mNetworkProviderInfo; /** * Builder class for {@link KnownNetwork}. @@ -78,7 +78,7 @@ public final class KnownNetwork implements Parcelable { @NetworkSource private int mNetworkSource = -1; private String mSsid; @SecurityType private final ArraySet<Integer> mSecurityTypes = new ArraySet<>(); - private android.net.wifi.sharedconnectivity.app.DeviceInfo mDeviceInfo; + private NetworkProviderInfo mNetworkProviderInfo; /** * Sets the indicated source of the known network. @@ -120,12 +120,12 @@ public final class KnownNetwork implements Parcelable { * Sets the device information of the device providing connectivity. * Must be set if network source is {@link KnownNetwork#NETWORK_SOURCE_NEARBY_SELF}. * - * @param deviceInfo The device information object. + * @param networkProviderInfo The device information object. * @return Returns the Builder object. */ @NonNull - public Builder setDeviceInfo(@Nullable DeviceInfo deviceInfo) { - mDeviceInfo = deviceInfo; + public Builder setNetworkProviderInfo(@Nullable NetworkProviderInfo networkProviderInfo) { + mNetworkProviderInfo = networkProviderInfo; return this; } @@ -140,12 +140,12 @@ public final class KnownNetwork implements Parcelable { mNetworkSource, mSsid, mSecurityTypes, - mDeviceInfo); + mNetworkProviderInfo); } } private static void validate(int networkSource, String ssid, Set<Integer> securityTypes, - DeviceInfo deviceInfo) { + NetworkProviderInfo networkProviderInfo) { if (networkSource != NETWORK_SOURCE_UNKNOWN && networkSource != NETWORK_SOURCE_CLOUD_SELF && networkSource != NETWORK_SOURCE_NEARBY_SELF) { @@ -157,7 +157,7 @@ public final class KnownNetwork implements Parcelable { if (securityTypes.isEmpty()) { throw new IllegalArgumentException("SecurityTypes must be set"); } - if (networkSource == NETWORK_SOURCE_NEARBY_SELF && deviceInfo == null) { + if (networkSource == NETWORK_SOURCE_NEARBY_SELF && networkProviderInfo == null) { throw new IllegalArgumentException("Device info must be provided when network source" + " is NETWORK_SOURCE_NEARBY_SELF"); } @@ -167,12 +167,12 @@ public final class KnownNetwork implements Parcelable { @NetworkSource int networkSource, @NonNull String ssid, @NonNull @SecurityType ArraySet<Integer> securityTypes, - @Nullable DeviceInfo deviceInfo) { - validate(networkSource, ssid, securityTypes, deviceInfo); + @Nullable NetworkProviderInfo networkProviderInfo) { + validate(networkSource, ssid, securityTypes, networkProviderInfo); mNetworkSource = networkSource; mSsid = ssid; mSecurityTypes = new ArraySet<>(securityTypes); - mDeviceInfo = deviceInfo; + mNetworkProviderInfo = networkProviderInfo; } /** @@ -213,8 +213,8 @@ public final class KnownNetwork implements Parcelable { * network source is cloud or unknown. */ @Nullable - public DeviceInfo getDeviceInfo() { - return mDeviceInfo; + public NetworkProviderInfo getNetworkProviderInfo() { + return mNetworkProviderInfo; } @Override @@ -224,12 +224,12 @@ public final class KnownNetwork implements Parcelable { return mNetworkSource == other.getNetworkSource() && Objects.equals(mSsid, other.getSsid()) && Objects.equals(mSecurityTypes, other.getSecurityTypes()) - && Objects.equals(mDeviceInfo, other.getDeviceInfo()); + && Objects.equals(mNetworkProviderInfo, other.getNetworkProviderInfo()); } @Override public int hashCode() { - return Objects.hash(mNetworkSource, mSsid, mSecurityTypes, mDeviceInfo); + return Objects.hash(mNetworkSource, mSsid, mSecurityTypes, mNetworkProviderInfo); } @Override @@ -242,7 +242,7 @@ public final class KnownNetwork implements Parcelable { dest.writeInt(mNetworkSource); dest.writeString(mSsid); dest.writeArraySet(mSecurityTypes); - mDeviceInfo.writeToParcel(dest, flags); + mNetworkProviderInfo.writeToParcel(dest, flags); } /** @@ -254,7 +254,7 @@ public final class KnownNetwork implements Parcelable { public static KnownNetwork readFromParcel(@NonNull Parcel in) { return new KnownNetwork(in.readInt(), in.readString(), (ArraySet<Integer>) in.readArraySet(null), - DeviceInfo.readFromParcel(in)); + NetworkProviderInfo.readFromParcel(in)); } @NonNull @@ -276,7 +276,7 @@ public final class KnownNetwork implements Parcelable { .append("NetworkSource=").append(mNetworkSource) .append(", ssid=").append(mSsid) .append(", securityTypes=").append(mSecurityTypes.toString()) - .append(", deviceInfo=").append(mDeviceInfo.toString()) + .append(", networkProviderInfo=").append(mNetworkProviderInfo.toString()) .append("]").toString(); } } diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetwork.aidl b/wifi/java/src/android/net/wifi/sharedconnectivity/app/NetworkProviderInfo.aidl index 6cc4cfe7dce5..f3cbbc2963a3 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/TetherNetwork.aidl +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/NetworkProviderInfo.aidl @@ -16,4 +16,4 @@ package android.net.wifi.sharedconnectivity.app; -parcelable TetherNetwork; +parcelable NetworkProviderInfo;
\ No newline at end of file diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/DeviceInfo.java b/wifi/java/src/android/net/wifi/sharedconnectivity/app/NetworkProviderInfo.java index 52abf33bc761..a436571cb2a1 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/DeviceInfo.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/NetworkProviderInfo.java @@ -36,7 +36,7 @@ import java.util.Objects; * @hide */ @SystemApi -public final class DeviceInfo implements Parcelable { +public final class NetworkProviderInfo implements Parcelable { /** * Device type providing connectivity is unknown. @@ -59,6 +59,16 @@ public final class DeviceInfo implements Parcelable { public static final int DEVICE_TYPE_LAPTOP = 3; /** + * Device providing connectivity is a watch. + */ + public static final int DEVICE_TYPE_WATCH = 4; + + /** + * Device providing connectivity is a watch. + */ + public static final int DEVICE_TYPE_AUTO = 5; + + /** * @hide */ @Retention(RetentionPolicy.SOURCE) @@ -66,7 +76,9 @@ public final class DeviceInfo implements Parcelable { DEVICE_TYPE_UNKNOWN, DEVICE_TYPE_PHONE, DEVICE_TYPE_TABLET, - DEVICE_TYPE_LAPTOP + DEVICE_TYPE_LAPTOP, + DEVICE_TYPE_WATCH, + DEVICE_TYPE_AUTO }) public @interface DeviceType {} @@ -77,7 +89,7 @@ public final class DeviceInfo implements Parcelable { private final int mConnectionStrength; /** - * Builder class for {@link DeviceInfo}. + * Builder class for {@link NetworkProviderInfo}. */ public static final class Builder { private int mDeviceType; @@ -149,13 +161,13 @@ public final class DeviceInfo implements Parcelable { } /** - * Builds the {@link DeviceInfo} object. + * Builds the {@link NetworkProviderInfo} object. * - * @return Returns the built {@link DeviceInfo} object. + * @return Returns the built {@link NetworkProviderInfo} object. */ @NonNull - public DeviceInfo build() { - return new DeviceInfo(mDeviceType, mDeviceName, mModelName, mBatteryPercentage, + public NetworkProviderInfo build() { + return new NetworkProviderInfo(mDeviceType, mDeviceName, mModelName, mBatteryPercentage, mConnectionStrength); } } @@ -163,7 +175,8 @@ public final class DeviceInfo implements Parcelable { private static void validate(int deviceType, String deviceName, String modelName, int batteryPercentage, int connectionStrength) { if (deviceType != DEVICE_TYPE_UNKNOWN && deviceType != DEVICE_TYPE_PHONE - && deviceType != DEVICE_TYPE_TABLET && deviceType != DEVICE_TYPE_LAPTOP) { + && deviceType != DEVICE_TYPE_TABLET && deviceType != DEVICE_TYPE_LAPTOP + && deviceType != DEVICE_TYPE_WATCH && deviceType != DEVICE_TYPE_AUTO) { throw new IllegalArgumentException("Illegal device type"); } if (Objects.isNull(deviceName)) { @@ -180,7 +193,7 @@ public final class DeviceInfo implements Parcelable { } } - private DeviceInfo(@DeviceType int deviceType, @NonNull String deviceName, + private NetworkProviderInfo(@DeviceType int deviceType, @NonNull String deviceName, @NonNull String modelName, int batteryPercentage, int connectionStrength) { validate(deviceType, deviceName, modelName, batteryPercentage, connectionStrength); mDeviceType = deviceType; @@ -242,8 +255,8 @@ public final class DeviceInfo implements Parcelable { @Override public boolean equals(Object obj) { - if (!(obj instanceof DeviceInfo)) return false; - DeviceInfo other = (DeviceInfo) obj; + if (!(obj instanceof NetworkProviderInfo)) return false; + NetworkProviderInfo other = (NetworkProviderInfo) obj; return mDeviceType == other.getDeviceType() && Objects.equals(mDeviceName, other.mDeviceName) && Objects.equals(mModelName, other.mModelName) @@ -271,32 +284,32 @@ public final class DeviceInfo implements Parcelable { } /** - * Creates a {@link DeviceInfo} object from a parcel. + * Creates a {@link NetworkProviderInfo} object from a parcel. * * @hide */ @NonNull - public static DeviceInfo readFromParcel(@NonNull Parcel in) { - return new DeviceInfo(in.readInt(), in.readString(), in.readString(), in.readInt(), + public static NetworkProviderInfo readFromParcel(@NonNull Parcel in) { + return new NetworkProviderInfo(in.readInt(), in.readString(), in.readString(), in.readInt(), in.readInt()); } @NonNull - public static final Creator<DeviceInfo> CREATOR = new Creator<DeviceInfo>() { + public static final Creator<NetworkProviderInfo> CREATOR = new Creator<NetworkProviderInfo>() { @Override - public DeviceInfo createFromParcel(Parcel in) { + public NetworkProviderInfo createFromParcel(Parcel in) { return readFromParcel(in); } @Override - public DeviceInfo[] newArray(int size) { - return new DeviceInfo[size]; + public NetworkProviderInfo[] newArray(int size) { + return new NetworkProviderInfo[size]; } }; @Override public String toString() { - return new StringBuilder("DeviceInfo[") + return new StringBuilder("NetworkProviderInfo[") .append("deviceType=").append(mDeviceType) .append(", deviceName=").append(mDeviceName) .append(", modelName=").append(mModelName) diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityClientCallback.java b/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityClientCallback.java index d2b9be783bca..eb04df64d6d0 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityClientCallback.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityClientCallback.java @@ -32,14 +32,16 @@ import java.util.List; public interface SharedConnectivityClientCallback { /** * This method is being called by {@link SharedConnectivityService} to notify of a change in the - * list of available Tether Networks. - * @param networks Updated Tether Network list. + * list of available Hotspot Networks. + * + * @param networks Updated Hotspot Network list. */ - void onTetherNetworksUpdated(@NonNull List<TetherNetwork> networks); + void onHotspotNetworksUpdated(@NonNull List<HotspotNetwork> networks); /** * This method is being called by {@link SharedConnectivityService} to notify of a change in the * list of available Known Networks. + * * @param networks Updated Known Network list. */ void onKnownNetworksUpdated(@NonNull List<KnownNetwork> networks); @@ -47,20 +49,23 @@ public interface SharedConnectivityClientCallback { /** * This method is being called by {@link SharedConnectivityService} to notify of a change in the * state of share connectivity settings. + * * @param state The new state. */ void onSharedConnectivitySettingsChanged(@NonNull SharedConnectivitySettingsState state); /** * This method is being called by {@link SharedConnectivityService} to notify of a change in the - * status of the current tether network connection. + * status of the current hotspot network connection. + * * @param status The new status. */ - void onTetherNetworkConnectionStatusChanged(@NonNull TetherNetworkConnectionStatus status); + void onHotspotNetworkConnectionStatusChanged(@NonNull HotspotNetworkConnectionStatus status); /** * This method is being called by {@link SharedConnectivityService} to notify of a change in the * status of the current known network connection. + * * @param status The new status. */ void onKnownNetworkConnectionStatusChanged(@NonNull KnownNetworkConnectionStatus status); diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java b/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java index c09f85b39ee4..684b385d60e8 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java @@ -49,7 +49,7 @@ import java.util.concurrent.Executor; * This class is the library used by consumers of Shared Connectivity data to bind to the service, * receive callbacks from, and send user actions to the service. * - * The methods {@link #connectTetherNetwork}, {@link #disconnectTetherNetwork}, + * The methods {@link #connectHotspotNetwork}, {@link #disconnectHotspotNetwork}, * {@link #connectKnownNetwork} and {@link #forgetKnownNetwork} are not valid and will return false * if not called between {@link SharedConnectivityClientCallback#onServiceConnected()} * and {@link SharedConnectivityClientCallback#onServiceDisconnected()} or if @@ -74,12 +74,11 @@ public class SharedConnectivityManager { mCallback = callback; } - @Override - public void onTetherNetworksUpdated(@NonNull List<TetherNetwork> networks) { + public void onHotspotNetworksUpdated(@NonNull List<HotspotNetwork> networks) { if (mCallback != null) { final long token = Binder.clearCallingIdentity(); try { - mExecutor.execute(() -> mCallback.onTetherNetworksUpdated(networks)); + mExecutor.execute(() -> mCallback.onHotspotNetworksUpdated(networks)); } finally { Binder.restoreCallingIdentity(token); } @@ -111,14 +110,13 @@ public class SharedConnectivityManager { } } - @Override - public void onTetherNetworkConnectionStatusChanged( - @NonNull TetherNetworkConnectionStatus status) { + public void onHotspotNetworkConnectionStatusChanged( + @NonNull HotspotNetworkConnectionStatus status) { if (mCallback != null) { final long token = Binder.clearCallingIdentity(); try { mExecutor.execute(() -> - mCallback.onTetherNetworkConnectionStatusChanged(status)); + mCallback.onHotspotNetworkConnectionStatusChanged(status)); } finally { Binder.restoreCallingIdentity(token); } @@ -259,8 +257,8 @@ public class SharedConnectivityManager { } /** - * Registers a callback for receiving updates to the list of Tether Networks, Known Networks, - * shared connectivity settings state, tether network connection status and known network + * Registers a callback for receiving updates to the list of Hotspot Networks, Known Networks, + * shared connectivity settings state, hotspot network connection status and known network * connection status. * The {@link SharedConnectivityClientCallback#onRegisterCallbackFailed} will be called if the * registration failed. @@ -331,26 +329,26 @@ public class SharedConnectivityManager { /** * Send command to the implementation of {@link SharedConnectivityService} requesting connection - * to the specified Tether Network. + * to the specified Hotspot Network. * - * @param network {@link TetherNetwork} object representing the network the user has requested + * @param network {@link HotspotNetwork} object representing the network the user has requested * a connection to. * @return Returns true if the service received the command. Does not guarantee that the - * connection was successful. + * connection was successful. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) - public boolean connectTetherNetwork(@NonNull TetherNetwork network) { - Objects.requireNonNull(network, "Tether network cannot be null"); + public boolean connectHotspotNetwork(@NonNull HotspotNetwork network) { + Objects.requireNonNull(network, "Hotspot network cannot be null"); if (mService == null) { return false; } try { - mService.connectTetherNetwork(network); + mService.connectHotspotNetwork(network); } catch (RemoteException e) { - Log.e(TAG, "Exception in connectTetherNetwork", e); + Log.e(TAG, "Exception in connectHotspotNetwork", e); return false; } return true; @@ -358,24 +356,24 @@ public class SharedConnectivityManager { /** * Send command to the implementation of {@link SharedConnectivityService} requesting - * disconnection from the active Tether Network. + * disconnection from the active Hotspot Network. * - * @param network {@link TetherNetwork} object representing the network the user has requested + * @param network {@link HotspotNetwork} object representing the network the user has requested * to disconnect from. * @return Returns true if the service received the command. Does not guarantee that the - * disconnection was successful. + * disconnection was successful. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) - public boolean disconnectTetherNetwork(@NonNull TetherNetwork network) { + public boolean disconnectHotspotNetwork(@NonNull HotspotNetwork network) { if (mService == null) { return false; } try { - mService.disconnectTetherNetwork(network); + mService.disconnectHotspotNetwork(network); } catch (RemoteException e) { - Log.e(TAG, "Exception in disconnectTetherNetwork", e); + Log.e(TAG, "Exception in disconnectHotspotNetwork", e); return false; } return true; @@ -388,7 +386,7 @@ public class SharedConnectivityManager { * @param network {@link KnownNetwork} object representing the network the user has requested * a connection to. * @return Returns true if the service received the command. Does not guarantee that the - * connection was successful. + * connection was successful. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) @@ -413,7 +411,7 @@ public class SharedConnectivityManager { * the specified Known Network from the list of Known Networks. * * @return Returns true if the service received the command. Does not guarantee that the - * forget action was successful. + * forget action was successful. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) @@ -434,22 +432,22 @@ public class SharedConnectivityManager { } /** - * Gets the list of tether networks the user can select to connect to. + * Gets the list of hotspot networks the user can select to connect to. * - * @return Returns a {@link List} of {@link TetherNetwork} objects, empty list on failure. + * @return Returns a {@link List} of {@link HotspotNetwork} objects, empty list on failure. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) @NonNull - public List<TetherNetwork> getTetherNetworks() { + public List<HotspotNetwork> getHotspotNetworks() { if (mService == null) { return List.of(); } try { - return mService.getTetherNetworks(); + return mService.getHotspotNetworks(); } catch (RemoteException e) { - Log.e(TAG, "Exception in getTetherNetworks", e); + Log.e(TAG, "Exception in getHotspotNetworks", e); } return List.of(); } @@ -498,24 +496,24 @@ public class SharedConnectivityManager { } /** - * Gets the connection status of the tether network the user selected to connect to. + * Gets the connection status of the hotspot network the user selected to connect to. * - * @return Returns a {@link TetherNetworkConnectionStatus} object with the connection status, + * @return Returns a {@link HotspotNetworkConnectionStatus} object with the connection status, * null on failure. If no connection is active the status will be - * {@link TetherNetworkConnectionStatus#CONNECTION_STATUS_UNKNOWN}. + * {@link HotspotNetworkConnectionStatus#CONNECTION_STATUS_UNKNOWN}. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) @Nullable - public TetherNetworkConnectionStatus getTetherNetworkConnectionStatus() { + public HotspotNetworkConnectionStatus getHotspotNetworkConnectionStatus() { if (mService == null) { return null; } try { - return mService.getTetherNetworkConnectionStatus(); + return mService.getHotspotNetworkConnectionStatus(); } catch (RemoteException e) { - Log.e(TAG, "Exception in getTetherNetworkConnectionStatus", e); + Log.e(TAG, "Exception in getHotspotNetworkConnectionStatus", e); } return null; } diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityCallback.aidl b/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityCallback.aidl index 6f6f1627c6a5..737aa6d9964c 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityCallback.aidl +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityCallback.aidl @@ -19,15 +19,15 @@ package android.net.wifi.sharedconnectivity.service; import android.net.wifi.sharedconnectivity.app.KnownNetwork; import android.net.wifi.sharedconnectivity.app.KnownNetworkConnectionStatus; import android.net.wifi.sharedconnectivity.app.SharedConnectivitySettingsState; -import android.net.wifi.sharedconnectivity.app.TetherNetwork; -import android.net.wifi.sharedconnectivity.app.TetherNetworkConnectionStatus; +import android.net.wifi.sharedconnectivity.app.HotspotNetwork; +import android.net.wifi.sharedconnectivity.app.HotspotNetworkConnectionStatus; /* * @hide */ interface ISharedConnectivityCallback { - oneway void onTetherNetworksUpdated(in List<TetherNetwork> networks); - oneway void onTetherNetworkConnectionStatusChanged(in TetherNetworkConnectionStatus status); + oneway void onHotspotNetworksUpdated(in List<HotspotNetwork> networks); + oneway void onHotspotNetworkConnectionStatusChanged(in HotspotNetworkConnectionStatus status); oneway void onKnownNetworksUpdated(in List<KnownNetwork> networks); oneway void onKnownNetworkConnectionStatusChanged(in KnownNetworkConnectionStatus status); oneway void onSharedConnectivitySettingsChanged(in SharedConnectivitySettingsState state); diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityService.aidl b/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityService.aidl index 9f33e99ad3d1..c81380df3c79 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityService.aidl +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/service/ISharedConnectivityService.aidl @@ -17,10 +17,10 @@ package android.net.wifi.sharedconnectivity.service; import android.net.wifi.sharedconnectivity.app.KnownNetwork; -import android.net.wifi.sharedconnectivity.app.TetherNetwork; +import android.net.wifi.sharedconnectivity.app.HotspotNetwork; import android.net.wifi.sharedconnectivity.app.KnownNetworkConnectionStatus; import android.net.wifi.sharedconnectivity.app.SharedConnectivitySettingsState; -import android.net.wifi.sharedconnectivity.app.TetherNetworkConnectionStatus; +import android.net.wifi.sharedconnectivity.app.HotspotNetworkConnectionStatus; import android.net.wifi.sharedconnectivity.service.ISharedConnectivityCallback; /* @@ -29,13 +29,13 @@ import android.net.wifi.sharedconnectivity.service.ISharedConnectivityCallback; interface ISharedConnectivityService { void registerCallback(in ISharedConnectivityCallback callback); void unregisterCallback(in ISharedConnectivityCallback callback); - void connectTetherNetwork(in TetherNetwork network); - void disconnectTetherNetwork(in TetherNetwork network); + void connectHotspotNetwork(in HotspotNetwork network); + void disconnectHotspotNetwork(in HotspotNetwork network); void connectKnownNetwork(in KnownNetwork network); void forgetKnownNetwork(in KnownNetwork network); - List<TetherNetwork> getTetherNetworks(); + List<HotspotNetwork> getHotspotNetworks(); List<KnownNetwork> getKnownNetworks(); SharedConnectivitySettingsState getSettingsState(); - TetherNetworkConnectionStatus getTetherNetworkConnectionStatus(); + HotspotNetworkConnectionStatus getHotspotNetworkConnectionStatus(); KnownNetworkConnectionStatus getKnownNetworkConnectionStatus(); } diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/service/SharedConnectivityService.java b/wifi/java/src/android/net/wifi/sharedconnectivity/service/SharedConnectivityService.java index 4c88c1b269a9..c53da9c15d4d 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/service/SharedConnectivityService.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/service/SharedConnectivityService.java @@ -27,12 +27,12 @@ import android.annotation.TestApi; import android.app.Service; import android.content.Intent; import android.content.pm.PackageManager; +import android.net.wifi.sharedconnectivity.app.HotspotNetwork; +import android.net.wifi.sharedconnectivity.app.HotspotNetworkConnectionStatus; import android.net.wifi.sharedconnectivity.app.KnownNetwork; import android.net.wifi.sharedconnectivity.app.KnownNetworkConnectionStatus; import android.net.wifi.sharedconnectivity.app.SharedConnectivityManager; import android.net.wifi.sharedconnectivity.app.SharedConnectivitySettingsState; -import android.net.wifi.sharedconnectivity.app.TetherNetwork; -import android.net.wifi.sharedconnectivity.app.TetherNetworkConnectionStatus; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -62,14 +62,14 @@ public abstract class SharedConnectivityService extends Service { private Handler mHandler; private final RemoteCallbackList<ISharedConnectivityCallback> mRemoteCallbackList = new RemoteCallbackList<>(); - private List<TetherNetwork> mTetherNetworks = Collections.emptyList(); + private List<HotspotNetwork> mHotspotNetworks = Collections.emptyList(); private List<KnownNetwork> mKnownNetworks = Collections.emptyList(); private SharedConnectivitySettingsState mSettingsState = new SharedConnectivitySettingsState.Builder().setInstantTetherEnabled(false) .setExtras(Bundle.EMPTY).build(); - private TetherNetworkConnectionStatus mTetherNetworkConnectionStatus = - new TetherNetworkConnectionStatus.Builder() - .setStatus(TetherNetworkConnectionStatus.CONNECTION_STATUS_UNKNOWN) + private HotspotNetworkConnectionStatus mHotspotNetworkConnectionStatus = + new HotspotNetworkConnectionStatus.Builder() + .setStatus(HotspotNetworkConnectionStatus.CONNECTION_STATUS_UNKNOWN) .setExtras(Bundle.EMPTY).build(); private KnownNetworkConnectionStatus mKnownNetworkConnectionStatus = new KnownNetworkConnectionStatus.Builder() @@ -84,8 +84,8 @@ public abstract class SharedConnectivityService extends Service { IBinder serviceStub = new ISharedConnectivityService.Stub() { /** - * Registers a callback for receiving updates to the list of Tether Networks, Known - * Networks, shared connectivity settings state, tether network connection status and + * Registers a callback for receiving updates to the list of Hotspot Networks, Known + * Networks, shared connectivity settings state, hotspot network connection status and * known network connection status. * * @param callback The callback of type {@link ISharedConnectivityCallback} to be called @@ -113,29 +113,28 @@ public abstract class SharedConnectivityService extends Service { } /** - * Connects to a tether network. + * Connects to a hotspot network. * * @param network The network to connect to. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) @Override - public void connectTetherNetwork(TetherNetwork network) { + public void connectHotspotNetwork(HotspotNetwork network) { checkPermissions(); - mHandler.post(() -> onConnectTetherNetwork(network)); + mHandler.post(() -> onConnectHotspotNetwork(network)); } /** - * Disconnects from a previously connected tether network. + * Disconnects from a previously connected hotspot network. * * @param network The network to disconnect from. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) - @Override - public void disconnectTetherNetwork(TetherNetwork network) { + public void disconnectHotspotNetwork(HotspotNetwork network) { checkPermissions(); - mHandler.post(() -> onDisconnectTetherNetwork(network)); + mHandler.post(() -> onDisconnectHotspotNetwork(network)); } /** @@ -164,16 +163,16 @@ public abstract class SharedConnectivityService extends Service { } /** - * Gets the list of tether networks the user can select to connect to. + * Gets the list of hotspot networks the user can select to connect to. * - * @return Returns a {@link List} of {@link TetherNetwork} objects + * @return Returns a {@link List} of {@link HotspotNetwork} objects */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) @Override - public List<TetherNetwork> getTetherNetworks() { + public List<HotspotNetwork> getHotspotNetworks() { checkPermissions(); - return mTetherNetworks; + return mHotspotNetworks; } /** @@ -203,17 +202,17 @@ public abstract class SharedConnectivityService extends Service { } /** - * Gets the connection status of the tether network the user selected to connect to. + * Gets the connection status of the hotspot network the user selected to connect to. * - * @return Returns a {@link TetherNetworkConnectionStatus} object with the connection + * @return Returns a {@link HotspotNetworkConnectionStatus} object with the connection * status. */ @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) @Override - public TetherNetworkConnectionStatus getTetherNetworkConnectionStatus() { + public HotspotNetworkConnectionStatus getHotspotNetworkConnectionStatus() { checkPermissions(); - return mTetherNetworkConnectionStatus; + return mHotspotNetworkConnectionStatus; } /** @@ -254,7 +253,8 @@ public abstract class SharedConnectivityService extends Service { /** @hide */ @TestApi - public void onBind() {} + public void onBind() { + } private void onRegisterCallback(ISharedConnectivityCallback callback) { mRemoteCallbackList.register(callback); @@ -265,23 +265,23 @@ public abstract class SharedConnectivityService extends Service { } /** - * Implementing application should call this method to provide an up-to-date list of Tether + * Implementing application should call this method to provide an up-to-date list of Hotspot * Networks to be displayed to the user. * * This method updates the cached list and notifies all registered callbacks. Any callbacks that * are inaccessible will be unregistered. * - * @param networks The updated list of {@link TetherNetwork} objects. + * @param networks The updated list of {@link HotspotNetwork} objects. */ - public final void setTetherNetworks(@NonNull List<TetherNetwork> networks) { - mTetherNetworks = networks; + public final void setHotspotNetworks(@NonNull List<HotspotNetwork> networks) { + mHotspotNetworks = networks; int count = mRemoteCallbackList.beginBroadcast(); for (int i = 0; i < count; i++) { try { - mRemoteCallbackList.getBroadcastItem(i).onTetherNetworksUpdated(mTetherNetworks); + mRemoteCallbackList.getBroadcastItem(i).onHotspotNetworksUpdated(mHotspotNetworks); } catch (RemoteException e) { - if (DEBUG) Log.w(TAG, "Exception in setTetherNetworks", e); + if (DEBUG) Log.w(TAG, "Exception in setHotspotNetworks", e); } } mRemoteCallbackList.finishBroadcast(); @@ -318,7 +318,7 @@ public abstract class SharedConnectivityService extends Service { * that are inaccessible will be unregistered. * * @param settingsState The updated state {@link SharedConnectivitySettingsState} - * objects. + * objects. */ public final void setSettingsState(@NonNull SharedConnectivitySettingsState settingsState) { mSettingsState = settingsState; @@ -337,23 +337,22 @@ public abstract class SharedConnectivityService extends Service { /** * Implementing application should call this method to provide an up-to-date status of enabling - * and connecting to the tether network. - * - * @param status The updated status {@link TetherNetworkConnectionStatus} of the connection. + * and connecting to the hotspot network. * + * @param status The updated status {@link HotspotNetworkConnectionStatus} of the connection. */ - public final void updateTetherNetworkConnectionStatus( - @NonNull TetherNetworkConnectionStatus status) { - mTetherNetworkConnectionStatus = status; + public final void updateHotspotNetworkConnectionStatus( + @NonNull HotspotNetworkConnectionStatus status) { + mHotspotNetworkConnectionStatus = status; int count = mRemoteCallbackList.beginBroadcast(); for (int i = 0; i < count; i++) { try { mRemoteCallbackList - .getBroadcastItem(i).onTetherNetworkConnectionStatusChanged( - mTetherNetworkConnectionStatus); + .getBroadcastItem(i).onHotspotNetworkConnectionStatusChanged( + mHotspotNetworkConnectionStatus); } catch (RemoteException e) { - if (DEBUG) Log.w(TAG, "Exception in updateTetherNetworkConnectionStatus", e); + if (DEBUG) Log.w(TAG, "Exception in updateHotspotNetworkConnectionStatus", e); } } mRemoteCallbackList.finishBroadcast(); @@ -364,7 +363,6 @@ public abstract class SharedConnectivityService extends Service { * connecting to a known network. * * @param status The updated status {@link KnownNetworkConnectionStatus} of the connection. - * */ public final void updateKnownNetworkConnectionStatus( @NonNull KnownNetworkConnectionStatus status) { @@ -386,20 +384,20 @@ public abstract class SharedConnectivityService extends Service { /** * Implementing application should implement this method. * - * Implementation should initiate a connection to the Tether Network indicated. + * Implementation should initiate a connection to the Hotspot Network indicated. * - * @param network Object identifying the Tether Network the user has requested a connection to. + * @param network Object identifying the Hotspot Network the user has requested a connection to. */ - public abstract void onConnectTetherNetwork(@NonNull TetherNetwork network); + public abstract void onConnectHotspotNetwork(@NonNull HotspotNetwork network); /** * Implementing application should implement this method. * - * Implementation should initiate a disconnection from the active Tether Network. + * Implementation should initiate a disconnection from the active Hotspot Network. * - * @param network Object identifying the Tether Network the user has requested to disconnect. + * @param network Object identifying the Hotspot Network the user has requested to disconnect. */ - public abstract void onDisconnectTetherNetwork(@NonNull TetherNetwork network); + public abstract void onDisconnectHotspotNetwork(@NonNull HotspotNetwork network); /** * Implementing application should implement this method. |