Merge changes from topic "135105735" into qt-r1-dev am: 896cdfa547
am: e0f8c07335
Change-Id: I02bdf3635298cc331e5b3bd794df772b759463ab
This commit is contained in:
@@ -48,6 +48,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -481,19 +482,41 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
* For example, given an incoming template matching B, and the currently
|
* For example, given an incoming template matching B, and the currently
|
||||||
* active merge set [A,B], we'd return a new template that primarily matches
|
* active merge set [A,B], we'd return a new template that primarily matches
|
||||||
* A, but also matches B.
|
* A, but also matches B.
|
||||||
|
* TODO: remove and use {@link #normalize(NetworkTemplate, List)}.
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate normalize(NetworkTemplate template, String[] merged) {
|
public static NetworkTemplate normalize(NetworkTemplate template, String[] merged) {
|
||||||
if (template.isMatchRuleMobile() && ArrayUtils.contains(merged, template.mSubscriberId)) {
|
return normalize(template, Arrays.<String[]>asList(merged));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Examine the given template and normalize if it refers to a "merged"
|
||||||
|
* mobile subscriber. We pick the "lowest" merged subscriber as the primary
|
||||||
|
* for key purposes, and expand the template to match all other merged
|
||||||
|
* subscribers.
|
||||||
|
*
|
||||||
|
* There can be multiple merged subscriberIds for multi-SIM devices.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* For example, given an incoming template matching B, and the currently
|
||||||
|
* active merge set [A,B], we'd return a new template that primarily matches
|
||||||
|
* A, but also matches B.
|
||||||
|
*/
|
||||||
|
public static NetworkTemplate normalize(NetworkTemplate template, List<String[]> mergedList) {
|
||||||
|
if (!template.isMatchRuleMobile()) return template;
|
||||||
|
|
||||||
|
for (String[] merged : mergedList) {
|
||||||
|
if (ArrayUtils.contains(merged, template.mSubscriberId)) {
|
||||||
// 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.
|
||||||
return new NetworkTemplate(template.mMatchRule, merged[0], merged,
|
return new NetworkTemplate(template.mMatchRule, merged[0], merged,
|
||||||
template.mNetworkId);
|
template.mNetworkId);
|
||||||
} else {
|
|
||||||
return template;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public static final @android.annotation.NonNull Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
|
public static final @android.annotation.NonNull Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user