From ed55c7ad03423042bc6243c19e8f0935c8c420f0 Mon Sep 17 00:00:00 2001 From: markchien Date: Wed, 18 Mar 2020 08:43:07 +0800 Subject: [PATCH] Expose netId by adding getter API Bug: 151156820 Test: m atest TetetheringTests Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899 (cherry picked from commit 8831c4b54178753013d568c0b76bbf7487db8122) --- core/java/android/net/Network.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java index 6f5471baa7..f807a4968d 100644 --- a/core/java/android/net/Network.java +++ b/core/java/android/net/Network.java @@ -64,7 +64,7 @@ public class Network implements Parcelable { * The unique id of the network. * @hide */ - @SystemApi + @UnsupportedAppUsage public final int netId; // Objects used to perform per-network operations such as getSocketFactory @@ -169,6 +169,17 @@ public class Network implements Parcelable { return new Network(netId, true); } + /** + * Get the unique id of the network. + * + * @hide + */ + @TestApi + @SystemApi + public int getNetId() { + return netId; + } + /** * Returns a netid marked with the Private DNS bypass flag. *