Merge "Add LinkProperties methods to system APIs"

This commit is contained in:
Aaron Huang
2019-12-19 08:01:58 +00:00
committed by Gerrit Code Review

View File

@@ -229,7 +229,7 @@ public final class LinkProperties implements Parcelable {
/** /**
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public @NonNull List<String> getAllInterfaceNames() { public @NonNull List<String> getAllInterfaceNames() {
List<String> interfaceNames = new ArrayList<>(mStackedLinks.size() + 1); List<String> interfaceNames = new ArrayList<>(mStackedLinks.size() + 1);
if (mIfaceName != null) interfaceNames.add(mIfaceName); if (mIfaceName != null) interfaceNames.add(mIfaceName);
@@ -249,7 +249,7 @@ public final class LinkProperties implements Parcelable {
* @return An unmodifiable {@link List} of {@link InetAddress} for this link. * @return An unmodifiable {@link List} of {@link InetAddress} for this link.
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public @NonNull List<InetAddress> getAddresses() { public @NonNull List<InetAddress> getAddresses() {
final List<InetAddress> addresses = new ArrayList<>(); final List<InetAddress> addresses = new ArrayList<>();
for (LinkAddress linkAddress : mLinkAddresses) { for (LinkAddress linkAddress : mLinkAddresses) {
@@ -344,8 +344,8 @@ public final class LinkProperties implements Parcelable {
* Returns all the addresses on this link and all the links stacked above it. * Returns all the addresses on this link and all the links stacked above it.
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public List<LinkAddress> getAllLinkAddresses() { public @NonNull List<LinkAddress> getAllLinkAddresses() {
List<LinkAddress> addresses = new ArrayList<>(mLinkAddresses); List<LinkAddress> addresses = new ArrayList<>(mLinkAddresses);
for (LinkProperties stacked: mStackedLinks.values()) { for (LinkProperties stacked: mStackedLinks.values()) {
addresses.addAll(stacked.getAllLinkAddresses()); addresses.addAll(stacked.getAllLinkAddresses());
@@ -544,6 +544,7 @@ public final class LinkProperties implements Parcelable {
* @return true if the PCSCF server was added, false otherwise. * @return true if the PCSCF server was added, false otherwise.
* @hide * @hide
*/ */
@SystemApi
public boolean addPcscfServer(@NonNull InetAddress pcscfServer) { public boolean addPcscfServer(@NonNull InetAddress pcscfServer) {
if (pcscfServer != null && !mPcscfs.contains(pcscfServer)) { if (pcscfServer != null && !mPcscfs.contains(pcscfServer)) {
mPcscfs.add(pcscfServer); mPcscfs.add(pcscfServer);
@@ -731,7 +732,7 @@ public final class LinkProperties implements Parcelable {
* Returns all the routes on this link and all the links stacked above it. * Returns all the routes on this link and all the links stacked above it.
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public @NonNull List<RouteInfo> getAllRoutes() { public @NonNull List<RouteInfo> getAllRoutes() {
List<RouteInfo> routes = new ArrayList<>(mRoutes); List<RouteInfo> routes = new ArrayList<>(mRoutes);
for (LinkProperties stacked: mStackedLinks.values()) { for (LinkProperties stacked: mStackedLinks.values()) {
@@ -1027,7 +1028,7 @@ public final class LinkProperties implements Parcelable {
* @return {@code true} if there is an IPv4 default route, {@code false} otherwise. * @return {@code true} if there is an IPv4 default route, {@code false} otherwise.
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public boolean hasIpv4DefaultRoute() { public boolean hasIpv4DefaultRoute() {
for (RouteInfo r : mRoutes) { for (RouteInfo r : mRoutes) {
if (r.isIPv4Default()) { if (r.isIPv4Default()) {
@@ -1084,7 +1085,7 @@ public final class LinkProperties implements Parcelable {
* @return {@code true} if there is an IPv4 DNS server, {@code false} otherwise. * @return {@code true} if there is an IPv4 DNS server, {@code false} otherwise.
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public boolean hasIpv4DnsServer() { public boolean hasIpv4DnsServer() {
for (InetAddress ia : mDnses) { for (InetAddress ia : mDnses) {
if (ia instanceof Inet4Address) { if (ia instanceof Inet4Address) {
@@ -1112,7 +1113,7 @@ public final class LinkProperties implements Parcelable {
* @return {@code true} if there is an IPv6 DNS server, {@code false} otherwise. * @return {@code true} if there is an IPv6 DNS server, {@code false} otherwise.
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
public boolean hasIpv6DnsServer() { public boolean hasIpv6DnsServer() {
for (InetAddress ia : mDnses) { for (InetAddress ia : mDnses) {
if (ia instanceof Inet6Address) { if (ia instanceof Inet6Address) {