Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master
Bug: 135460123 Change-Id: I65906d82b14125c0893d5cde0cfebb73bf9e38ab Merged-In: I1f2564837c33cd4c6c3db6aac3cbaf8c09707da9
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,17 +482,39 @@ 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));
|
||||||
// Requested template subscriber is part of the merge group; return
|
}
|
||||||
// a template that matches all merged subscribers.
|
|
||||||
return new NetworkTemplate(template.mMatchRule, merged[0], merged,
|
/**
|
||||||
template.mNetworkId);
|
* Examine the given template and normalize if it refers to a "merged"
|
||||||
} else {
|
* mobile subscriber. We pick the "lowest" merged subscriber as the primary
|
||||||
return template;
|
* 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
|
||||||
|
// a template that matches all merged subscribers.
|
||||||
|
return new NetworkTemplate(template.mMatchRule, merged[0], merged,
|
||||||
|
template.mNetworkId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
|||||||
Reference in New Issue
Block a user