Merge "Remove mSubscriberId from NetworkTemplate" am: 99348b1664
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2241058 Change-Id: Ifa205d2ef88e1556a77288a6852a8827a1621cb3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -258,7 +258,6 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final int mMatchRule;
|
private final int mMatchRule;
|
||||||
private final String mSubscriberId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ugh, templates are designed to target a single subscriber, but we might
|
* Ugh, templates are designed to target a single subscriber, but we might
|
||||||
@@ -313,7 +312,7 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
// to metered networks. It is now possible to match mobile with any meteredness, but
|
// to metered networks. It is now possible to match mobile with any meteredness, but
|
||||||
// in order to preserve backward compatibility of @UnsupportedAppUsage methods, this
|
// in order to preserve backward compatibility of @UnsupportedAppUsage methods, this
|
||||||
//constructor passes METERED_YES for these types.
|
//constructor passes METERED_YES for these types.
|
||||||
this(matchRule, subscriberId, new String[] { subscriberId },
|
this(matchRule, new String[] { subscriberId },
|
||||||
wifiNetworkKey != null ? new String[] { wifiNetworkKey } : new String[0],
|
wifiNetworkKey != null ? new String[] { wifiNetworkKey } : new String[0],
|
||||||
(matchRule == MATCH_MOBILE || matchRule == MATCH_MOBILE_WILDCARD
|
(matchRule == MATCH_MOBILE || matchRule == MATCH_MOBILE_WILDCARD
|
||||||
|| matchRule == MATCH_CARRIER) ? METERED_YES : METERED_ALL,
|
|| matchRule == MATCH_CARRIER) ? METERED_YES : METERED_ALL,
|
||||||
@@ -321,13 +320,12 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public NetworkTemplate(int matchRule, String subscriberId, String[] matchSubscriberIds,
|
public NetworkTemplate(int matchRule, String[] matchSubscriberIds,
|
||||||
String[] matchWifiNetworkKeys, int metered, int roaming,
|
String[] matchWifiNetworkKeys, int metered, int roaming, int defaultNetwork,
|
||||||
int defaultNetwork, int ratType, int oemManaged) {
|
int ratType, int oemManaged) {
|
||||||
Objects.requireNonNull(matchWifiNetworkKeys);
|
Objects.requireNonNull(matchWifiNetworkKeys);
|
||||||
Objects.requireNonNull(matchSubscriberIds);
|
Objects.requireNonNull(matchSubscriberIds);
|
||||||
mMatchRule = matchRule;
|
mMatchRule = matchRule;
|
||||||
mSubscriberId = subscriberId;
|
|
||||||
mMatchSubscriberIds = matchSubscriberIds;
|
mMatchSubscriberIds = matchSubscriberIds;
|
||||||
mMatchWifiNetworkKeys = matchWifiNetworkKeys;
|
mMatchWifiNetworkKeys = matchWifiNetworkKeys;
|
||||||
mMetered = metered;
|
mMetered = metered;
|
||||||
@@ -344,7 +342,6 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
|
|
||||||
private NetworkTemplate(Parcel in) {
|
private NetworkTemplate(Parcel in) {
|
||||||
mMatchRule = in.readInt();
|
mMatchRule = in.readInt();
|
||||||
mSubscriberId = in.readString();
|
|
||||||
mMatchSubscriberIds = in.createStringArray();
|
mMatchSubscriberIds = in.createStringArray();
|
||||||
mMatchWifiNetworkKeys = in.createStringArray();
|
mMatchWifiNetworkKeys = in.createStringArray();
|
||||||
mMetered = in.readInt();
|
mMetered = in.readInt();
|
||||||
@@ -357,7 +354,6 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
dest.writeInt(mMatchRule);
|
dest.writeInt(mMatchRule);
|
||||||
dest.writeString(mSubscriberId);
|
|
||||||
dest.writeStringArray(mMatchSubscriberIds);
|
dest.writeStringArray(mMatchSubscriberIds);
|
||||||
dest.writeStringArray(mMatchWifiNetworkKeys);
|
dest.writeStringArray(mMatchWifiNetworkKeys);
|
||||||
dest.writeInt(mMetered);
|
dest.writeInt(mMetered);
|
||||||
@@ -376,10 +372,6 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder builder = new StringBuilder("NetworkTemplate: ");
|
final StringBuilder builder = new StringBuilder("NetworkTemplate: ");
|
||||||
builder.append("matchRule=").append(getMatchRuleName(mMatchRule));
|
builder.append("matchRule=").append(getMatchRuleName(mMatchRule));
|
||||||
if (mSubscriberId != null) {
|
|
||||||
builder.append(", subscriberId=").append(
|
|
||||||
NetworkIdentityUtils.scrubSubscriberId(mSubscriberId));
|
|
||||||
}
|
|
||||||
if (mMatchSubscriberIds != null) {
|
if (mMatchSubscriberIds != null) {
|
||||||
builder.append(", matchSubscriberIds=").append(
|
builder.append(", matchSubscriberIds=").append(
|
||||||
Arrays.toString(NetworkIdentityUtils.scrubSubscriberIds(mMatchSubscriberIds)));
|
Arrays.toString(NetworkIdentityUtils.scrubSubscriberIds(mMatchSubscriberIds)));
|
||||||
@@ -406,7 +398,7 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mMatchRule, mSubscriberId, Arrays.hashCode(mMatchWifiNetworkKeys),
|
return Objects.hash(mMatchRule, Arrays.hashCode(mMatchWifiNetworkKeys),
|
||||||
mMetered, mRoaming, mDefaultNetwork, mRatType, mOemManaged);
|
mMetered, mRoaming, mDefaultNetwork, mRatType, mOemManaged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,7 +407,6 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
if (obj instanceof NetworkTemplate) {
|
if (obj instanceof NetworkTemplate) {
|
||||||
final NetworkTemplate other = (NetworkTemplate) obj;
|
final NetworkTemplate other = (NetworkTemplate) obj;
|
||||||
return mMatchRule == other.mMatchRule
|
return mMatchRule == other.mMatchRule
|
||||||
&& Objects.equals(mSubscriberId, other.mSubscriberId)
|
|
||||||
&& mMetered == other.mMetered
|
&& mMetered == other.mMetered
|
||||||
&& mRoaming == other.mRoaming
|
&& mRoaming == other.mRoaming
|
||||||
&& mDefaultNetwork == other.mDefaultNetwork
|
&& mDefaultNetwork == other.mDefaultNetwork
|
||||||
@@ -456,12 +447,15 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get subscriber Id of the template.
|
* Get subscriber Id of the template.
|
||||||
|
*
|
||||||
|
* @deprecated User should get a subscriberId by {@link #getSubscriberIds} instead.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@Nullable
|
@Nullable
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public String getSubscriberId() {
|
public String getSubscriberId() {
|
||||||
return mSubscriberId;
|
return CollectionUtils.isEmpty(mMatchSubscriberIds) ? null : mMatchSubscriberIds[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -775,15 +769,16 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
// information. For instances:
|
// information. For instances:
|
||||||
// The TYPE_WIFI with subscriberId means that it is a merged carrier wifi network.
|
// The TYPE_WIFI with subscriberId means that it is a merged carrier wifi network.
|
||||||
// The TYPE_CARRIER means that the network associate to specific carrier network.
|
// The TYPE_CARRIER means that the network associate to specific carrier network.
|
||||||
if (template.mSubscriberId == null) return template;
|
|
||||||
|
|
||||||
if (CollectionUtils.contains(merged, template.mSubscriberId)) {
|
if (CollectionUtils.isEmpty(template.mMatchSubscriberIds)) return template;
|
||||||
|
|
||||||
|
if (CollectionUtils.contains(merged, template.mMatchSubscriberIds[0])) {
|
||||||
// Requested template subscriber is part of the merge group; return
|
// Requested template subscriber is part of the merge group; return
|
||||||
// a template that matches all merged subscribers.
|
// a template that matches all merged subscribers.
|
||||||
final String[] matchWifiNetworkKeys = template.mMatchWifiNetworkKeys;
|
final String[] matchWifiNetworkKeys = template.mMatchWifiNetworkKeys;
|
||||||
// TODO: Use NetworkTemplate.Builder to build a template after NetworkTemplate
|
// TODO: Use NetworkTemplate.Builder to build a template after NetworkTemplate
|
||||||
// could handle incompatible subscriberIds. See b/217805241.
|
// could handle incompatible subscriberIds. See b/217805241.
|
||||||
return new NetworkTemplate(template.mMatchRule, merged[0], merged,
|
return new NetworkTemplate(template.mMatchRule, merged,
|
||||||
CollectionUtils.isEmpty(matchWifiNetworkKeys)
|
CollectionUtils.isEmpty(matchWifiNetworkKeys)
|
||||||
? new String[0] : new String[] { matchWifiNetworkKeys[0] },
|
? new String[0] : new String[] { matchWifiNetworkKeys[0] },
|
||||||
(template.mMatchRule == MATCH_MOBILE
|
(template.mMatchRule == MATCH_MOBILE
|
||||||
@@ -1002,7 +997,6 @@ public final class NetworkTemplate implements Parcelable {
|
|||||||
public NetworkTemplate build() {
|
public NetworkTemplate build() {
|
||||||
assertRequestableParameters();
|
assertRequestableParameters();
|
||||||
return new NetworkTemplate(getWildcardDeducedMatchRule(),
|
return new NetworkTemplate(getWildcardDeducedMatchRule(),
|
||||||
mMatchSubscriberIds.isEmpty() ? null : mMatchSubscriberIds.iterator().next(),
|
|
||||||
mMatchSubscriberIds.toArray(new String[0]),
|
mMatchSubscriberIds.toArray(new String[0]),
|
||||||
mMatchWifiNetworkKeys.toArray(new String[0]), mMetered, mRoaming,
|
mMatchWifiNetworkKeys.toArray(new String[0]), mMetered, mRoaming,
|
||||||
mDefaultNetwork, mRatType, mOemManaged);
|
mDefaultNetwork, mRatType, mOemManaged);
|
||||||
|
|||||||
@@ -75,10 +75,9 @@ class NetworkTemplateTest {
|
|||||||
listOf(MATCH_MOBILE, MATCH_CARRIER).forEach { matchRule ->
|
listOf(MATCH_MOBILE, MATCH_CARRIER).forEach { matchRule ->
|
||||||
NetworkTemplate.Builder(matchRule).setSubscriberIds(setOf(TEST_IMSI1))
|
NetworkTemplate.Builder(matchRule).setSubscriberIds(setOf(TEST_IMSI1))
|
||||||
.setMeteredness(METERED_YES).build().let {
|
.setMeteredness(METERED_YES).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(matchRule, TEST_IMSI1,
|
val expectedTemplate = NetworkTemplate(matchRule, arrayOf(TEST_IMSI1),
|
||||||
arrayOf(TEST_IMSI1), emptyArray<String>(), METERED_YES,
|
emptyArray<String>(), METERED_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
||||||
ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
|
||||||
OEM_MANAGED_ALL)
|
|
||||||
assertEquals(expectedTemplate, it)
|
assertEquals(expectedTemplate, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,10 +87,9 @@ class NetworkTemplateTest {
|
|||||||
listOf(MATCH_MOBILE, MATCH_CARRIER).forEach { matchRule ->
|
listOf(MATCH_MOBILE, MATCH_CARRIER).forEach { matchRule ->
|
||||||
NetworkTemplate.Builder(matchRule).setSubscriberIds(setOf(TEST_IMSI1))
|
NetworkTemplate.Builder(matchRule).setSubscriberIds(setOf(TEST_IMSI1))
|
||||||
.setRoaming(ROAMING_YES).setMeteredness(METERED_YES).build().let {
|
.setRoaming(ROAMING_YES).setMeteredness(METERED_YES).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(matchRule, TEST_IMSI1,
|
val expectedTemplate = NetworkTemplate(matchRule, arrayOf(TEST_IMSI1),
|
||||||
arrayOf(TEST_IMSI1), emptyArray<String>(), METERED_YES,
|
emptyArray<String>(), METERED_YES, ROAMING_YES, DEFAULT_NETWORK_ALL,
|
||||||
ROAMING_YES, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
|
||||||
OEM_MANAGED_ALL)
|
|
||||||
assertEquals(expectedTemplate, it)
|
assertEquals(expectedTemplate, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,8 +102,8 @@ class NetworkTemplateTest {
|
|||||||
// Verify template which matches metered cellular networks,
|
// Verify template which matches metered cellular networks,
|
||||||
// regardless of IMSI. See buildTemplateMobileWildcard.
|
// regardless of IMSI. See buildTemplateMobileWildcard.
|
||||||
NetworkTemplate.Builder(MATCH_MOBILE).setMeteredness(METERED_YES).build().let {
|
NetworkTemplate.Builder(MATCH_MOBILE).setMeteredness(METERED_YES).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(MATCH_MOBILE_WILDCARD, null /*subscriberId*/,
|
val expectedTemplate = NetworkTemplate(MATCH_MOBILE_WILDCARD,
|
||||||
emptyArray<String>() /*subscriberIds*/, emptyArray<String>(),
|
emptyArray<String>() /*subscriberIds*/, emptyArray<String>() /*wifiNetworkKey*/,
|
||||||
METERED_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
METERED_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
||||||
OEM_MANAGED_ALL)
|
OEM_MANAGED_ALL)
|
||||||
assertEquals(expectedTemplate, it)
|
assertEquals(expectedTemplate, it)
|
||||||
@@ -116,30 +114,28 @@ class NetworkTemplateTest {
|
|||||||
NetworkTemplate.Builder(MATCH_MOBILE).setSubscriberIds(setOf(TEST_IMSI1))
|
NetworkTemplate.Builder(MATCH_MOBILE).setSubscriberIds(setOf(TEST_IMSI1))
|
||||||
.setMeteredness(METERED_YES).setRatType(TelephonyManager.NETWORK_TYPE_UMTS)
|
.setMeteredness(METERED_YES).setRatType(TelephonyManager.NETWORK_TYPE_UMTS)
|
||||||
.build().let {
|
.build().let {
|
||||||
val expectedTemplate = NetworkTemplate(MATCH_MOBILE, TEST_IMSI1,
|
val expectedTemplate = NetworkTemplate(MATCH_MOBILE, arrayOf(TEST_IMSI1),
|
||||||
arrayOf(TEST_IMSI1), emptyArray<String>(), METERED_YES,
|
emptyArray<String>(), METERED_YES, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
||||||
ROAMING_ALL, DEFAULT_NETWORK_ALL, TelephonyManager.NETWORK_TYPE_UMTS,
|
TelephonyManager.NETWORK_TYPE_UMTS, OEM_MANAGED_ALL)
|
||||||
OEM_MANAGED_ALL)
|
|
||||||
assertEquals(expectedTemplate, it)
|
assertEquals(expectedTemplate, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify template which matches all wifi networks,
|
// Verify template which matches all wifi networks,
|
||||||
// regardless of Wifi Network Key. See buildTemplateWifiWildcard and buildTemplateWifi.
|
// regardless of Wifi Network Key. See buildTemplateWifiWildcard and buildTemplateWifi.
|
||||||
NetworkTemplate.Builder(MATCH_WIFI).build().let {
|
NetworkTemplate.Builder(MATCH_WIFI).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(MATCH_WIFI_WILDCARD, null /*subscriberId*/,
|
val expectedTemplate = NetworkTemplate(MATCH_WIFI_WILDCARD,
|
||||||
emptyArray<String>() /*subscriberIds*/, emptyArray<String>(),
|
emptyArray<String>() /*subscriberIds*/, emptyArray<String>(), METERED_ALL,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
|
||||||
OEM_MANAGED_ALL)
|
|
||||||
assertEquals(expectedTemplate, it)
|
assertEquals(expectedTemplate, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify template which matches wifi networks with the given Wifi Network Key.
|
// Verify template which matches wifi networks with the given Wifi Network Key.
|
||||||
// See buildTemplateWifi(wifiNetworkKey).
|
// See buildTemplateWifi(wifiNetworkKey).
|
||||||
NetworkTemplate.Builder(MATCH_WIFI).setWifiNetworkKeys(setOf(TEST_WIFI_KEY1)).build().let {
|
NetworkTemplate.Builder(MATCH_WIFI).setWifiNetworkKeys(setOf(TEST_WIFI_KEY1)).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(MATCH_WIFI, null /*subscriberId*/,
|
val expectedTemplate =
|
||||||
emptyArray<String>() /*subscriberIds*/, arrayOf(TEST_WIFI_KEY1),
|
NetworkTemplate(MATCH_WIFI, emptyArray<String>() /*subscriberIds*/,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
arrayOf(TEST_WIFI_KEY1), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
||||||
OEM_MANAGED_ALL)
|
NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
|
||||||
assertEquals(expectedTemplate, it)
|
assertEquals(expectedTemplate, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,10 +143,9 @@ class NetworkTemplateTest {
|
|||||||
// given Wifi Network Key, and IMSI. See buildTemplateWifi(wifiNetworkKey, subscriberId).
|
// given Wifi Network Key, and IMSI. See buildTemplateWifi(wifiNetworkKey, subscriberId).
|
||||||
NetworkTemplate.Builder(MATCH_WIFI).setSubscriberIds(setOf(TEST_IMSI1))
|
NetworkTemplate.Builder(MATCH_WIFI).setSubscriberIds(setOf(TEST_IMSI1))
|
||||||
.setWifiNetworkKeys(setOf(TEST_WIFI_KEY1)).build().let {
|
.setWifiNetworkKeys(setOf(TEST_WIFI_KEY1)).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(MATCH_WIFI, TEST_IMSI1,
|
val expectedTemplate = NetworkTemplate(MATCH_WIFI, arrayOf(TEST_IMSI1),
|
||||||
arrayOf(TEST_IMSI1), arrayOf(TEST_WIFI_KEY1),
|
arrayOf(TEST_WIFI_KEY1), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
|
||||||
OEM_MANAGED_ALL)
|
|
||||||
assertEquals(expectedTemplate, it)
|
assertEquals(expectedTemplate, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +153,7 @@ class NetworkTemplateTest {
|
|||||||
// See buildTemplateEthernet and buildTemplateBluetooth.
|
// See buildTemplateEthernet and buildTemplateBluetooth.
|
||||||
listOf(MATCH_ETHERNET, MATCH_BLUETOOTH).forEach { matchRule ->
|
listOf(MATCH_ETHERNET, MATCH_BLUETOOTH).forEach { matchRule ->
|
||||||
NetworkTemplate.Builder(matchRule).build().let {
|
NetworkTemplate.Builder(matchRule).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(matchRule, null /*subscriberId*/,
|
val expectedTemplate = NetworkTemplate(matchRule,
|
||||||
emptyArray<String>() /*subscriberIds*/, emptyArray<String>(),
|
emptyArray<String>() /*subscriberIds*/, emptyArray<String>(),
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
||||||
OEM_MANAGED_ALL)
|
OEM_MANAGED_ALL)
|
||||||
@@ -193,7 +188,7 @@ class NetworkTemplateTest {
|
|||||||
|
|
||||||
// Verify template which matches wifi wildcard with the given empty key set.
|
// Verify template which matches wifi wildcard with the given empty key set.
|
||||||
NetworkTemplate.Builder(MATCH_WIFI).setWifiNetworkKeys(setOf<String>()).build().let {
|
NetworkTemplate.Builder(MATCH_WIFI).setWifiNetworkKeys(setOf<String>()).build().let {
|
||||||
val expectedTemplate = NetworkTemplate(MATCH_WIFI_WILDCARD, null /*subscriberId*/,
|
val expectedTemplate = NetworkTemplate(MATCH_WIFI_WILDCARD,
|
||||||
emptyArray<String>() /*subscriberIds*/, emptyArray<String>(),
|
emptyArray<String>() /*subscriberIds*/, emptyArray<String>(),
|
||||||
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL,
|
||||||
OEM_MANAGED_ALL)
|
OEM_MANAGED_ALL)
|
||||||
|
|||||||
@@ -447,18 +447,18 @@ class NetworkTemplateTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testParcelUnparcel() {
|
fun testParcelUnparcel() {
|
||||||
val templateMobile = NetworkTemplate(MATCH_MOBILE, TEST_IMSI1, arrayOf(TEST_IMSI1),
|
val templateMobile = NetworkTemplate(MATCH_MOBILE, arrayOf(TEST_IMSI1),
|
||||||
emptyArray<String>(), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
emptyArray<String>(), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL,
|
||||||
TelephonyManager.NETWORK_TYPE_LTE, OEM_MANAGED_ALL)
|
TelephonyManager.NETWORK_TYPE_LTE, OEM_MANAGED_ALL)
|
||||||
val templateWifi = NetworkTemplate(MATCH_WIFI, null, emptyArray<String>(),
|
val templateWifi = NetworkTemplate(MATCH_WIFI, emptyArray<String>(),
|
||||||
arrayOf(TEST_WIFI_KEY1), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, 0,
|
arrayOf(TEST_WIFI_KEY1), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, 0,
|
||||||
OEM_MANAGED_ALL)
|
OEM_MANAGED_ALL)
|
||||||
val templateOem = NetworkTemplate(MATCH_MOBILE_WILDCARD, null, emptyArray<String>(),
|
val templateOem = NetworkTemplate(MATCH_MOBILE_WILDCARD, emptyArray<String>(),
|
||||||
emptyArray<String>(), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, 0,
|
emptyArray<String>(), METERED_ALL, ROAMING_ALL, DEFAULT_NETWORK_ALL, 0,
|
||||||
OEM_MANAGED_YES)
|
OEM_MANAGED_YES)
|
||||||
assertParcelSane(templateMobile, 9)
|
assertParcelSane(templateMobile, 8)
|
||||||
assertParcelSane(templateWifi, 9)
|
assertParcelSane(templateWifi, 8)
|
||||||
assertParcelSane(templateOem, 9)
|
assertParcelSane(templateOem, 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify NETWORK_TYPE_* constants in NetworkTemplate do not conflict with
|
// Verify NETWORK_TYPE_* constants in NetworkTemplate do not conflict with
|
||||||
@@ -510,10 +510,10 @@ class NetworkTemplateTest {
|
|||||||
val matchSubscriberIds = arrayOf(subscriberId)
|
val matchSubscriberIds = arrayOf(subscriberId)
|
||||||
val matchWifiNetworkKeys = arrayOf(templateWifiKey)
|
val matchWifiNetworkKeys = arrayOf(templateWifiKey)
|
||||||
|
|
||||||
val templateOemYes = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
val templateOemYes = NetworkTemplate(matchType, matchSubscriberIds,
|
||||||
matchWifiNetworkKeys, METERED_ALL, ROAMING_ALL,
|
matchWifiNetworkKeys, METERED_ALL, ROAMING_ALL,
|
||||||
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_YES)
|
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_YES)
|
||||||
val templateOemAll = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
val templateOemAll = NetworkTemplate(matchType, matchSubscriberIds,
|
||||||
matchWifiNetworkKeys, METERED_ALL, ROAMING_ALL,
|
matchWifiNetworkKeys, METERED_ALL, ROAMING_ALL,
|
||||||
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
|
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, OEM_MANAGED_ALL)
|
||||||
|
|
||||||
@@ -524,7 +524,7 @@ class NetworkTemplateTest {
|
|||||||
|
|
||||||
// Create a template with each OEM managed type and match it against the NetworkIdentity
|
// Create a template with each OEM managed type and match it against the NetworkIdentity
|
||||||
for (templateOemManagedState in oemManagedStates) {
|
for (templateOemManagedState in oemManagedStates) {
|
||||||
val template = NetworkTemplate(matchType, subscriberId, matchSubscriberIds,
|
val template = NetworkTemplate(matchType, matchSubscriberIds,
|
||||||
matchWifiNetworkKeys, METERED_ALL, ROAMING_ALL,
|
matchWifiNetworkKeys, METERED_ALL, ROAMING_ALL,
|
||||||
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, templateOemManagedState)
|
DEFAULT_NETWORK_ALL, NETWORK_TYPE_ALL, templateOemManagedState)
|
||||||
if (identityOemManagedState == templateOemManagedState) {
|
if (identityOemManagedState == templateOemManagedState) {
|
||||||
|
|||||||
Reference in New Issue
Block a user