Merge "Add extras parameter to rest of data classes" into udc-dev am: b274394eb6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22086092 Change-Id: I961a27a16bfb8df975aee6d2adc426eb647ba4f7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
180aa39076
@@ -9984,6 +9984,7 @@ package android.net.wifi.sharedconnectivity.app {
|
|||||||
public final class HotspotNetwork implements android.os.Parcelable {
|
public final class HotspotNetwork implements android.os.Parcelable {
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public long getDeviceId();
|
method public long getDeviceId();
|
||||||
|
method @NonNull public android.os.Bundle getExtras();
|
||||||
method public int getHostNetworkType();
|
method public int getHostNetworkType();
|
||||||
method @Nullable public String getHotspotBssid();
|
method @Nullable public String getHotspotBssid();
|
||||||
method @NonNull public java.util.Set<java.lang.Integer> getHotspotSecurityTypes();
|
method @NonNull public java.util.Set<java.lang.Integer> getHotspotSecurityTypes();
|
||||||
@@ -10003,6 +10004,7 @@ package android.net.wifi.sharedconnectivity.app {
|
|||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder addHotspotSecurityType(int);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder addHotspotSecurityType(int);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork build();
|
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork build();
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setDeviceId(long);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setDeviceId(long);
|
||||||
|
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setExtras(@NonNull android.os.Bundle);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setHostNetworkType(int);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setHostNetworkType(int);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setHotspotBssid(@NonNull String);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setHotspotBssid(@NonNull String);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setHotspotSsid(@NonNull String);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.HotspotNetwork.Builder setHotspotSsid(@NonNull String);
|
||||||
@@ -10039,6 +10041,7 @@ package android.net.wifi.sharedconnectivity.app {
|
|||||||
|
|
||||||
public final class KnownNetwork implements android.os.Parcelable {
|
public final class KnownNetwork implements android.os.Parcelable {
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
|
method @NonNull public android.os.Bundle getExtras();
|
||||||
method @Nullable public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo getNetworkProviderInfo();
|
method @Nullable public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo getNetworkProviderInfo();
|
||||||
method public int getNetworkSource();
|
method public int getNetworkSource();
|
||||||
method @NonNull public java.util.Set<java.lang.Integer> getSecurityTypes();
|
method @NonNull public java.util.Set<java.lang.Integer> getSecurityTypes();
|
||||||
@@ -10054,6 +10057,7 @@ package android.net.wifi.sharedconnectivity.app {
|
|||||||
ctor public KnownNetwork.Builder();
|
ctor public KnownNetwork.Builder();
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder addSecurityType(int);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder addSecurityType(int);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork build();
|
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork build();
|
||||||
|
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder setExtras(@NonNull android.os.Bundle);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder setNetworkProviderInfo(@Nullable android.net.wifi.sharedconnectivity.app.NetworkProviderInfo);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder setNetworkProviderInfo(@Nullable android.net.wifi.sharedconnectivity.app.NetworkProviderInfo);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder setNetworkSource(int);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder setNetworkSource(int);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder setSsid(@NonNull String);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.KnownNetwork.Builder setSsid(@NonNull String);
|
||||||
@@ -10085,6 +10089,7 @@ package android.net.wifi.sharedconnectivity.app {
|
|||||||
method @IntRange(from=0, to=3) public int getConnectionStrength();
|
method @IntRange(from=0, to=3) public int getConnectionStrength();
|
||||||
method @NonNull public String getDeviceName();
|
method @NonNull public String getDeviceName();
|
||||||
method public int getDeviceType();
|
method public int getDeviceType();
|
||||||
|
method @NonNull public android.os.Bundle getExtras();
|
||||||
method @NonNull public String getModelName();
|
method @NonNull public String getModelName();
|
||||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.sharedconnectivity.app.NetworkProviderInfo> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.sharedconnectivity.app.NetworkProviderInfo> CREATOR;
|
||||||
@@ -10103,6 +10108,7 @@ package android.net.wifi.sharedconnectivity.app {
|
|||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setConnectionStrength(@IntRange(from=0, to=3) int);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setConnectionStrength(@IntRange(from=0, to=3) int);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setDeviceName(@NonNull String);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setDeviceName(@NonNull String);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setDeviceType(int);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setDeviceType(int);
|
||||||
|
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setExtras(@NonNull android.os.Bundle);
|
||||||
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setModelName(@NonNull String);
|
method @NonNull public android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.Builder setModelName(@NonNull String);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.net.wifi.sharedconnectivity.service.SharedConnectivityService;
|
import android.net.wifi.sharedconnectivity.service.SharedConnectivityService;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
@@ -86,6 +87,7 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@SecurityType
|
@SecurityType
|
||||||
private final ArraySet<Integer> mHotspotSecurityTypes;
|
private final ArraySet<Integer> mHotspotSecurityTypes;
|
||||||
|
private final Bundle mExtras;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder class for {@link HotspotNetwork}.
|
* Builder class for {@link HotspotNetwork}.
|
||||||
@@ -102,8 +104,8 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
private String mHotspotBssid;
|
private String mHotspotBssid;
|
||||||
@Nullable
|
@Nullable
|
||||||
@SecurityType
|
@SecurityType
|
||||||
private final ArraySet<Integer> mHotspotSecurityTypes =
|
private final ArraySet<Integer> mHotspotSecurityTypes = new ArraySet<>();
|
||||||
new ArraySet<>();
|
private Bundle mExtras = Bundle.EMPTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the remote device ID.
|
* Set the remote device ID.
|
||||||
@@ -189,6 +191,17 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the extras bundle
|
||||||
|
*
|
||||||
|
* @return Returns the Builder object.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder setExtras(@NonNull Bundle extras) {
|
||||||
|
mExtras = extras;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the {@link HotspotNetwork} object.
|
* Builds the {@link HotspotNetwork} object.
|
||||||
*
|
*
|
||||||
@@ -203,7 +216,8 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
mNetworkName,
|
mNetworkName,
|
||||||
mHotspotSsid,
|
mHotspotSsid,
|
||||||
mHotspotBssid,
|
mHotspotBssid,
|
||||||
mHotspotSecurityTypes);
|
mHotspotSecurityTypes,
|
||||||
|
mExtras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +245,8 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
@NonNull String networkName,
|
@NonNull String networkName,
|
||||||
@Nullable String hotspotSsid,
|
@Nullable String hotspotSsid,
|
||||||
@Nullable String hotspotBssid,
|
@Nullable String hotspotBssid,
|
||||||
@Nullable @SecurityType ArraySet<Integer> hotspotSecurityTypes) {
|
@Nullable @SecurityType ArraySet<Integer> hotspotSecurityTypes,
|
||||||
|
@NonNull Bundle extras) {
|
||||||
validate(deviceId,
|
validate(deviceId,
|
||||||
networkType,
|
networkType,
|
||||||
networkName,
|
networkName,
|
||||||
@@ -243,6 +258,7 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
mHotspotSsid = hotspotSsid;
|
mHotspotSsid = hotspotSsid;
|
||||||
mHotspotBssid = hotspotBssid;
|
mHotspotBssid = hotspotBssid;
|
||||||
mHotspotSecurityTypes = new ArraySet<>(hotspotSecurityTypes);
|
mHotspotSecurityTypes = new ArraySet<>(hotspotSecurityTypes);
|
||||||
|
mExtras = extras;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -315,6 +331,16 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
return mHotspotSecurityTypes;
|
return mHotspotSecurityTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the extras Bundle.
|
||||||
|
*
|
||||||
|
* @return Returns a Bundle object.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Bundle getExtras() {
|
||||||
|
return mExtras;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof HotspotNetwork)) return false;
|
if (!(obj instanceof HotspotNetwork)) return false;
|
||||||
@@ -348,6 +374,7 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
dest.writeString(mHotspotSsid);
|
dest.writeString(mHotspotSsid);
|
||||||
dest.writeString(mHotspotBssid);
|
dest.writeString(mHotspotBssid);
|
||||||
dest.writeArraySet(mHotspotSecurityTypes);
|
dest.writeArraySet(mHotspotSecurityTypes);
|
||||||
|
dest.writeBundle(mExtras);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -359,7 +386,7 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
public static HotspotNetwork readFromParcel(@NonNull Parcel in) {
|
public static HotspotNetwork readFromParcel(@NonNull Parcel in) {
|
||||||
return new HotspotNetwork(in.readLong(), NetworkProviderInfo.readFromParcel(in),
|
return new HotspotNetwork(in.readLong(), NetworkProviderInfo.readFromParcel(in),
|
||||||
in.readInt(), in.readString(), in.readString(), in.readString(),
|
in.readInt(), in.readString(), in.readString(), in.readString(),
|
||||||
(ArraySet<Integer>) in.readArraySet(null));
|
(ArraySet<Integer>) in.readArraySet(null), in.readBundle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -385,6 +412,7 @@ public final class HotspotNetwork implements Parcelable {
|
|||||||
.append(", hotspotSsid=").append(mHotspotSsid)
|
.append(", hotspotSsid=").append(mHotspotSsid)
|
||||||
.append(", hotspotBssid=").append(mHotspotBssid)
|
.append(", hotspotBssid=").append(mHotspotBssid)
|
||||||
.append(", hotspotSecurityTypes=").append(mHotspotSecurityTypes.toString())
|
.append(", hotspotSecurityTypes=").append(mHotspotSecurityTypes.toString())
|
||||||
|
.append(", extras=").append(mExtras.toString())
|
||||||
.append("]").toString();
|
.append("]").toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public final class HotspotNetworkConnectionStatus implements Parcelable {
|
|||||||
@ConnectionStatus
|
@ConnectionStatus
|
||||||
private int mStatus;
|
private int mStatus;
|
||||||
private HotspotNetwork mHotspotNetwork;
|
private HotspotNetwork mHotspotNetwork;
|
||||||
private Bundle mExtras;
|
private Bundle mExtras = Bundle.EMPTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the status of the connection
|
* Sets the status of the connection
|
||||||
@@ -179,7 +179,7 @@ public final class HotspotNetworkConnectionStatus implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HotspotNetworkConnectionStatus(@ConnectionStatus int status,
|
private HotspotNetworkConnectionStatus(@ConnectionStatus int status,
|
||||||
HotspotNetwork hotspotNetwork, Bundle extras) {
|
HotspotNetwork hotspotNetwork, @NonNull Bundle extras) {
|
||||||
validate(status);
|
validate(status);
|
||||||
mStatus = status;
|
mStatus = status;
|
||||||
mHotspotNetwork = hotspotNetwork;
|
mHotspotNetwork = hotspotNetwork;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.annotation.IntDef;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -73,6 +74,7 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
@SecurityType
|
@SecurityType
|
||||||
private final ArraySet<Integer> mSecurityTypes;
|
private final ArraySet<Integer> mSecurityTypes;
|
||||||
private final NetworkProviderInfo mNetworkProviderInfo;
|
private final NetworkProviderInfo mNetworkProviderInfo;
|
||||||
|
private final Bundle mExtras;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder class for {@link KnownNetwork}.
|
* Builder class for {@link KnownNetwork}.
|
||||||
@@ -84,6 +86,7 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
@SecurityType
|
@SecurityType
|
||||||
private final ArraySet<Integer> mSecurityTypes = new ArraySet<>();
|
private final ArraySet<Integer> mSecurityTypes = new ArraySet<>();
|
||||||
private NetworkProviderInfo mNetworkProviderInfo;
|
private NetworkProviderInfo mNetworkProviderInfo;
|
||||||
|
private Bundle mExtras = Bundle.EMPTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the indicated source of the known network.
|
* Sets the indicated source of the known network.
|
||||||
@@ -134,6 +137,17 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the extras bundle
|
||||||
|
*
|
||||||
|
* @return Returns the Builder object.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder setExtras(@NonNull Bundle extras) {
|
||||||
|
mExtras = extras;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the {@link KnownNetwork} object.
|
* Builds the {@link KnownNetwork} object.
|
||||||
*
|
*
|
||||||
@@ -145,7 +159,8 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
mNetworkSource,
|
mNetworkSource,
|
||||||
mSsid,
|
mSsid,
|
||||||
mSecurityTypes,
|
mSecurityTypes,
|
||||||
mNetworkProviderInfo);
|
mNetworkProviderInfo,
|
||||||
|
mExtras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,12 +188,14 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
@NetworkSource int networkSource,
|
@NetworkSource int networkSource,
|
||||||
@NonNull String ssid,
|
@NonNull String ssid,
|
||||||
@NonNull @SecurityType ArraySet<Integer> securityTypes,
|
@NonNull @SecurityType ArraySet<Integer> securityTypes,
|
||||||
@Nullable NetworkProviderInfo networkProviderInfo) {
|
@Nullable NetworkProviderInfo networkProviderInfo,
|
||||||
|
@NonNull Bundle extras) {
|
||||||
validate(networkSource, ssid, securityTypes, networkProviderInfo);
|
validate(networkSource, ssid, securityTypes, networkProviderInfo);
|
||||||
mNetworkSource = networkSource;
|
mNetworkSource = networkSource;
|
||||||
mSsid = ssid;
|
mSsid = ssid;
|
||||||
mSecurityTypes = new ArraySet<>(securityTypes);
|
mSecurityTypes = new ArraySet<>(securityTypes);
|
||||||
mNetworkProviderInfo = networkProviderInfo;
|
mNetworkProviderInfo = networkProviderInfo;
|
||||||
|
mExtras = extras;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,6 +240,16 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
return mNetworkProviderInfo;
|
return mNetworkProviderInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the extras Bundle.
|
||||||
|
*
|
||||||
|
* @return Returns a Bundle object.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Bundle getExtras() {
|
||||||
|
return mExtras;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof KnownNetwork)) return false;
|
if (!(obj instanceof KnownNetwork)) return false;
|
||||||
@@ -249,6 +276,7 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
dest.writeString(mSsid);
|
dest.writeString(mSsid);
|
||||||
dest.writeArraySet(mSecurityTypes);
|
dest.writeArraySet(mSecurityTypes);
|
||||||
mNetworkProviderInfo.writeToParcel(dest, flags);
|
mNetworkProviderInfo.writeToParcel(dest, flags);
|
||||||
|
dest.writeBundle(mExtras);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,7 +288,7 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
public static KnownNetwork readFromParcel(@NonNull Parcel in) {
|
public static KnownNetwork readFromParcel(@NonNull Parcel in) {
|
||||||
return new KnownNetwork(in.readInt(), in.readString(),
|
return new KnownNetwork(in.readInt(), in.readString(),
|
||||||
(ArraySet<Integer>) in.readArraySet(null),
|
(ArraySet<Integer>) in.readArraySet(null),
|
||||||
NetworkProviderInfo.readFromParcel(in));
|
NetworkProviderInfo.readFromParcel(in), in.readBundle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -283,6 +311,7 @@ public final class KnownNetwork implements Parcelable {
|
|||||||
.append(", ssid=").append(mSsid)
|
.append(", ssid=").append(mSsid)
|
||||||
.append(", securityTypes=").append(mSecurityTypes.toString())
|
.append(", securityTypes=").append(mSecurityTypes.toString())
|
||||||
.append(", networkProviderInfo=").append(mNetworkProviderInfo.toString())
|
.append(", networkProviderInfo=").append(mNetworkProviderInfo.toString())
|
||||||
|
.append(", extras=").append(mExtras.toString())
|
||||||
.append("]").toString();
|
.append("]").toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public final class KnownNetworkConnectionStatus implements Parcelable {
|
|||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
@ConnectionStatus private int mStatus;
|
@ConnectionStatus private int mStatus;
|
||||||
private KnownNetwork mKnownNetwork;
|
private KnownNetwork mKnownNetwork;
|
||||||
private Bundle mExtras;
|
private Bundle mExtras = Bundle.EMPTY;
|
||||||
|
|
||||||
public Builder() {}
|
public Builder() {}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ public final class KnownNetworkConnectionStatus implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private KnownNetworkConnectionStatus(@ConnectionStatus int status, KnownNetwork knownNetwork,
|
private KnownNetworkConnectionStatus(@ConnectionStatus int status, KnownNetwork knownNetwork,
|
||||||
Bundle extras) {
|
@NonNull Bundle extras) {
|
||||||
validate(status);
|
validate(status);
|
||||||
mStatus = status;
|
mStatus = status;
|
||||||
mKnownNetwork = knownNetwork;
|
mKnownNetwork = knownNetwork;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.annotation.IntRange;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.net.wifi.sharedconnectivity.service.SharedConnectivityService;
|
import android.net.wifi.sharedconnectivity.service.SharedConnectivityService;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
@@ -89,6 +90,7 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
private final String mModelName;
|
private final String mModelName;
|
||||||
private final int mBatteryPercentage;
|
private final int mBatteryPercentage;
|
||||||
private final int mConnectionStrength;
|
private final int mConnectionStrength;
|
||||||
|
private final Bundle mExtras;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder class for {@link NetworkProviderInfo}.
|
* Builder class for {@link NetworkProviderInfo}.
|
||||||
@@ -99,6 +101,7 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
private String mModelName;
|
private String mModelName;
|
||||||
private int mBatteryPercentage;
|
private int mBatteryPercentage;
|
||||||
private int mConnectionStrength;
|
private int mConnectionStrength;
|
||||||
|
private Bundle mExtras = Bundle.EMPTY;
|
||||||
|
|
||||||
public Builder(@NonNull String deviceName, @NonNull String modelName) {
|
public Builder(@NonNull String deviceName, @NonNull String modelName) {
|
||||||
Objects.requireNonNull(deviceName);
|
Objects.requireNonNull(deviceName);
|
||||||
@@ -169,6 +172,17 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the extras bundle
|
||||||
|
*
|
||||||
|
* @return Returns the Builder object.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Builder setExtras(@NonNull Bundle extras) {
|
||||||
|
mExtras = extras;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the {@link NetworkProviderInfo} object.
|
* Builds the {@link NetworkProviderInfo} object.
|
||||||
*
|
*
|
||||||
@@ -177,7 +191,7 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public NetworkProviderInfo build() {
|
public NetworkProviderInfo build() {
|
||||||
return new NetworkProviderInfo(mDeviceType, mDeviceName, mModelName, mBatteryPercentage,
|
return new NetworkProviderInfo(mDeviceType, mDeviceName, mModelName, mBatteryPercentage,
|
||||||
mConnectionStrength);
|
mConnectionStrength, mExtras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,13 +211,15 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private NetworkProviderInfo(@DeviceType int deviceType, @NonNull String deviceName,
|
private NetworkProviderInfo(@DeviceType int deviceType, @NonNull String deviceName,
|
||||||
@NonNull String modelName, int batteryPercentage, int connectionStrength) {
|
@NonNull String modelName, int batteryPercentage, int connectionStrength,
|
||||||
|
@NonNull Bundle extras) {
|
||||||
validate(deviceType, deviceName, modelName, batteryPercentage, connectionStrength);
|
validate(deviceType, deviceName, modelName, batteryPercentage, connectionStrength);
|
||||||
mDeviceType = deviceType;
|
mDeviceType = deviceType;
|
||||||
mDeviceName = deviceName;
|
mDeviceName = deviceName;
|
||||||
mModelName = modelName;
|
mModelName = modelName;
|
||||||
mBatteryPercentage = batteryPercentage;
|
mBatteryPercentage = batteryPercentage;
|
||||||
mConnectionStrength = connectionStrength;
|
mConnectionStrength = connectionStrength;
|
||||||
|
mExtras = extras;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,6 +272,16 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
return mConnectionStrength;
|
return mConnectionStrength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the extras Bundle.
|
||||||
|
*
|
||||||
|
* @return Returns a Bundle object.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Bundle getExtras() {
|
||||||
|
return mExtras;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof NetworkProviderInfo)) return false;
|
if (!(obj instanceof NetworkProviderInfo)) return false;
|
||||||
@@ -280,6 +306,7 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
dest.writeString(mModelName);
|
dest.writeString(mModelName);
|
||||||
dest.writeInt(mBatteryPercentage);
|
dest.writeInt(mBatteryPercentage);
|
||||||
dest.writeInt(mConnectionStrength);
|
dest.writeInt(mConnectionStrength);
|
||||||
|
dest.writeBundle(mExtras);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -295,7 +322,7 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public static NetworkProviderInfo readFromParcel(@NonNull Parcel in) {
|
public static NetworkProviderInfo readFromParcel(@NonNull Parcel in) {
|
||||||
return new NetworkProviderInfo(in.readInt(), in.readString(), in.readString(), in.readInt(),
|
return new NetworkProviderInfo(in.readInt(), in.readString(), in.readString(), in.readInt(),
|
||||||
in.readInt());
|
in.readInt(), in.readBundle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -319,6 +346,7 @@ public final class NetworkProviderInfo implements Parcelable {
|
|||||||
.append(", modelName=").append(mModelName)
|
.append(", modelName=").append(mModelName)
|
||||||
.append(", batteryPercentage=").append(mBatteryPercentage)
|
.append(", batteryPercentage=").append(mBatteryPercentage)
|
||||||
.append(", connectionStrength=").append(mConnectionStrength)
|
.append(", connectionStrength=").append(mConnectionStrength)
|
||||||
|
.append(", extras=").append(mExtras.toString())
|
||||||
.append("]").toString();
|
.append("]").toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public final class SharedConnectivitySettingsState implements Parcelable {
|
|||||||
private boolean mInstantTetherEnabled;
|
private boolean mInstantTetherEnabled;
|
||||||
private Intent mInstantTetherSettingsIntent;
|
private Intent mInstantTetherSettingsIntent;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private Bundle mExtras;
|
private Bundle mExtras = Bundle.EMPTY;
|
||||||
|
|
||||||
public Builder(@NonNull Context context) {
|
public Builder(@NonNull Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -112,8 +112,7 @@ public final class SharedConnectivitySettingsState implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private SharedConnectivitySettingsState(boolean instantTetherEnabled,
|
private SharedConnectivitySettingsState(boolean instantTetherEnabled,
|
||||||
PendingIntent pendingIntent, Bundle extras) {
|
PendingIntent pendingIntent, @NonNull Bundle extras) {
|
||||||
|
|
||||||
mInstantTetherEnabled = instantTetherEnabled;
|
mInstantTetherEnabled = instantTetherEnabled;
|
||||||
mInstantTetherSettingsPendingIntent = pendingIntent;
|
mInstantTetherSettingsPendingIntent = pendingIntent;
|
||||||
mExtras = extras;
|
mExtras = extras;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertThrows;
|
import static org.junit.Assert.assertThrows;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
@@ -55,6 +56,8 @@ public class HotspotNetworkTest {
|
|||||||
private static final String HOTSPOT_SSID = "TEST_SSID";
|
private static final String HOTSPOT_SSID = "TEST_SSID";
|
||||||
private static final String HOTSPOT_BSSID = "TEST _BSSID";
|
private static final String HOTSPOT_BSSID = "TEST _BSSID";
|
||||||
private static final int[] HOTSPOT_SECURITY_TYPES = {SECURITY_TYPE_WEP, SECURITY_TYPE_EAP};
|
private static final int[] HOTSPOT_SECURITY_TYPES = {SECURITY_TYPE_WEP, SECURITY_TYPE_EAP};
|
||||||
|
private static final String BUNDLE_KEY = "INT-KEY";
|
||||||
|
private static final int BUNDLE_VALUE = 1;
|
||||||
|
|
||||||
private static final long DEVICE_ID_1 = 111L;
|
private static final long DEVICE_ID_1 = 111L;
|
||||||
private static final NetworkProviderInfo NETWORK_PROVIDER_INFO1 =
|
private static final NetworkProviderInfo NETWORK_PROVIDER_INFO1 =
|
||||||
@@ -138,6 +141,7 @@ public class HotspotNetworkTest {
|
|||||||
assertThat(network.getHotspotSsid()).isEqualTo(HOTSPOT_SSID);
|
assertThat(network.getHotspotSsid()).isEqualTo(HOTSPOT_SSID);
|
||||||
assertThat(network.getHotspotBssid()).isEqualTo(HOTSPOT_BSSID);
|
assertThat(network.getHotspotBssid()).isEqualTo(HOTSPOT_BSSID);
|
||||||
assertThat(network.getHotspotSecurityTypes()).containsExactlyElementsIn(securityTypes);
|
assertThat(network.getHotspotSecurityTypes()).containsExactlyElementsIn(securityTypes);
|
||||||
|
assertThat(network.getExtras().getInt(BUNDLE_KEY)).isEqualTo(BUNDLE_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -161,11 +165,18 @@ public class HotspotNetworkTest {
|
|||||||
.setHostNetworkType(NETWORK_TYPE)
|
.setHostNetworkType(NETWORK_TYPE)
|
||||||
.setNetworkName(NETWORK_NAME)
|
.setNetworkName(NETWORK_NAME)
|
||||||
.setHotspotSsid(HOTSPOT_SSID)
|
.setHotspotSsid(HOTSPOT_SSID)
|
||||||
.setHotspotBssid(HOTSPOT_BSSID);
|
.setHotspotBssid(HOTSPOT_BSSID)
|
||||||
|
.setExtras(buildBundle());
|
||||||
Arrays.stream(HOTSPOT_SECURITY_TYPES).forEach(builder::addHotspotSecurityType);
|
Arrays.stream(HOTSPOT_SECURITY_TYPES).forEach(builder::addHotspotSecurityType);
|
||||||
if (withNetworkProviderInfo) {
|
if (withNetworkProviderInfo) {
|
||||||
builder.setNetworkProviderInfo(NETWORK_PROVIDER_INFO);
|
builder.setNetworkProviderInfo(NETWORK_PROVIDER_INFO);
|
||||||
}
|
}
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Bundle buildBundle() {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putInt(BUNDLE_KEY, BUNDLE_VALUE);
|
||||||
|
return bundle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import static android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.DEVICE
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
@@ -47,6 +48,9 @@ public class KnownNetworkTest {
|
|||||||
new NetworkProviderInfo.Builder("TEST_NAME", "TEST_MODEL")
|
new NetworkProviderInfo.Builder("TEST_NAME", "TEST_MODEL")
|
||||||
.setDeviceType(DEVICE_TYPE_TABLET).setConnectionStrength(2)
|
.setDeviceType(DEVICE_TYPE_TABLET).setConnectionStrength(2)
|
||||||
.setBatteryPercentage(50).build();
|
.setBatteryPercentage(50).build();
|
||||||
|
private static final String BUNDLE_KEY = "INT-KEY";
|
||||||
|
private static final int BUNDLE_VALUE = 1;
|
||||||
|
|
||||||
private static final int NETWORK_SOURCE_1 = NETWORK_SOURCE_CLOUD_SELF;
|
private static final int NETWORK_SOURCE_1 = NETWORK_SOURCE_CLOUD_SELF;
|
||||||
private static final String SSID_1 = "TEST_SSID1";
|
private static final String SSID_1 = "TEST_SSID1";
|
||||||
private static final int[] SECURITY_TYPES_1 = {SECURITY_TYPE_PSK};
|
private static final int[] SECURITY_TYPES_1 = {SECURITY_TYPE_PSK};
|
||||||
@@ -113,6 +117,7 @@ public class KnownNetworkTest {
|
|||||||
assertThat(network.getSsid()).isEqualTo(SSID);
|
assertThat(network.getSsid()).isEqualTo(SSID);
|
||||||
assertThat(network.getSecurityTypes()).containsExactlyElementsIn(securityTypes);
|
assertThat(network.getSecurityTypes()).containsExactlyElementsIn(securityTypes);
|
||||||
assertThat(network.getNetworkProviderInfo()).isEqualTo(NETWORK_PROVIDER_INFO);
|
assertThat(network.getNetworkProviderInfo()).isEqualTo(NETWORK_PROVIDER_INFO);
|
||||||
|
assertThat(network.getExtras().getInt(BUNDLE_KEY)).isEqualTo(BUNDLE_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -125,8 +130,15 @@ public class KnownNetworkTest {
|
|||||||
|
|
||||||
private KnownNetwork.Builder buildKnownNetworkBuilder() {
|
private KnownNetwork.Builder buildKnownNetworkBuilder() {
|
||||||
KnownNetwork.Builder builder = new KnownNetwork.Builder().setNetworkSource(NETWORK_SOURCE)
|
KnownNetwork.Builder builder = new KnownNetwork.Builder().setNetworkSource(NETWORK_SOURCE)
|
||||||
.setSsid(SSID).setNetworkProviderInfo(NETWORK_PROVIDER_INFO);
|
.setSsid(SSID).setNetworkProviderInfo(NETWORK_PROVIDER_INFO)
|
||||||
|
.setExtras(buildBundle());
|
||||||
Arrays.stream(SECURITY_TYPES).forEach(builder::addSecurityType);
|
Arrays.stream(SECURITY_TYPES).forEach(builder::addSecurityType);
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Bundle buildBundle() {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putInt(BUNDLE_KEY, BUNDLE_VALUE);
|
||||||
|
return bundle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static android.net.wifi.sharedconnectivity.app.NetworkProviderInfo.DEVICE
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
@@ -38,6 +39,8 @@ public class NetworkProviderInfoTest {
|
|||||||
private static final String DEVICE_MODEL = "TEST_MODEL";
|
private static final String DEVICE_MODEL = "TEST_MODEL";
|
||||||
private static final int BATTERY_PERCENTAGE = 50;
|
private static final int BATTERY_PERCENTAGE = 50;
|
||||||
private static final int CONNECTION_STRENGTH = 2;
|
private static final int CONNECTION_STRENGTH = 2;
|
||||||
|
private static final String BUNDLE_KEY = "INT-KEY";
|
||||||
|
private static final int BUNDLE_VALUE = 1;
|
||||||
|
|
||||||
private static final int DEVICE_TYPE_1 = DEVICE_TYPE_LAPTOP;
|
private static final int DEVICE_TYPE_1 = DEVICE_TYPE_LAPTOP;
|
||||||
private static final String DEVICE_NAME_1 = "TEST_NAME1";
|
private static final String DEVICE_NAME_1 = "TEST_NAME1";
|
||||||
@@ -105,6 +108,7 @@ public class NetworkProviderInfoTest {
|
|||||||
assertThat(info.getModelName()).isEqualTo(DEVICE_MODEL);
|
assertThat(info.getModelName()).isEqualTo(DEVICE_MODEL);
|
||||||
assertThat(info.getBatteryPercentage()).isEqualTo(BATTERY_PERCENTAGE);
|
assertThat(info.getBatteryPercentage()).isEqualTo(BATTERY_PERCENTAGE);
|
||||||
assertThat(info.getConnectionStrength()).isEqualTo(CONNECTION_STRENGTH);
|
assertThat(info.getConnectionStrength()).isEqualTo(CONNECTION_STRENGTH);
|
||||||
|
assertThat(info.getExtras().getInt(BUNDLE_KEY)).isEqualTo(BUNDLE_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -118,6 +122,13 @@ public class NetworkProviderInfoTest {
|
|||||||
private NetworkProviderInfo.Builder buildNetworkProviderInfoBuilder() {
|
private NetworkProviderInfo.Builder buildNetworkProviderInfoBuilder() {
|
||||||
return new NetworkProviderInfo.Builder(DEVICE_NAME, DEVICE_MODEL).setDeviceType(DEVICE_TYPE)
|
return new NetworkProviderInfo.Builder(DEVICE_NAME, DEVICE_MODEL).setDeviceType(DEVICE_TYPE)
|
||||||
.setBatteryPercentage(BATTERY_PERCENTAGE)
|
.setBatteryPercentage(BATTERY_PERCENTAGE)
|
||||||
.setConnectionStrength(CONNECTION_STRENGTH);
|
.setConnectionStrength(CONNECTION_STRENGTH)
|
||||||
|
.setExtras(buildBundle());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bundle buildBundle() {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putInt(BUNDLE_KEY, BUNDLE_VALUE);
|
||||||
|
return bundle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user