Add LinkProperties methods to system APIs
The exposed methods are used by telephony, wifi
and tethering. For mainline support, making the
methods @SystemApi.
Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksTelephonyTests
./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
atest android.net.cts
atest android.net.wifi.cts
atest android.telephony.cts
Change-Id: Ib16a838cf9f748e1c5b045d6c2f17678f16af28c
This commit is contained in:
@@ -227,7 +227,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);
|
||||||
@@ -247,7 +247,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) {
|
||||||
@@ -342,8 +342,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());
|
||||||
@@ -542,6 +542,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);
|
||||||
@@ -729,7 +730,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()) {
|
||||||
@@ -1025,7 +1026,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()) {
|
||||||
@@ -1082,7 +1083,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) {
|
||||||
@@ -1110,7 +1111,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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user