Merge "Fix normalize doesn't work on carrier template" am: a1e47b652b am: a42b6bffbb am: 10f7bb62c5 am: 05406865c4

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878227

Change-Id: Iecf4afea95c1a3073bd277db79cb0fb7df87806c
This commit is contained in:
Les Lee
2021-11-06 01:58:02 +00:00
committed by Automerger Merge Worker

View File

@@ -777,8 +777,8 @@ public class NetworkTemplate implements Parcelable {
} }
/** /**
* Examine the given template and normalize if it refers to a "merged" * Examine the given template and normalize it.
* mobile subscriber. We pick the "lowest" merged subscriber as the primary * We pick the "lowest" merged subscriber as the primary
* for key purposes, and expand the template to match all other merged * for key purposes, and expand the template to match all other merged
* subscribers. * subscribers.
* <p> * <p>
@@ -793,8 +793,8 @@ public class NetworkTemplate implements Parcelable {
} }
/** /**
* Examine the given template and normalize if it refers to a "merged" * Examine the given template and normalize it.
* mobile subscriber. We pick the "lowest" merged subscriber as the primary * We pick the "lowest" merged subscriber as the primary
* for key purposes, and expand the template to match all other merged * for key purposes, and expand the template to match all other merged
* subscribers. * subscribers.
* *
@@ -806,7 +806,12 @@ public class NetworkTemplate implements Parcelable {
* A, but also matches B. * A, but also matches B.
*/ */
public static NetworkTemplate normalize(NetworkTemplate template, List<String[]> mergedList) { public static NetworkTemplate normalize(NetworkTemplate template, List<String[]> mergedList) {
if (!template.isMatchRuleMobile()) return template; // Now there are several types of network which uses SubscriberId to store network
// information. For instances:
// 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.
if (template.mSubscriberId == null) return template;
for (String[] merged : mergedList) { for (String[] merged : mergedList) {
if (ArrayUtils.contains(merged, template.mSubscriberId)) { if (ArrayUtils.contains(merged, template.mSubscriberId)) {