Merge "Add support for Ethernet tethering"
This commit is contained in:
committed by
Android (Google) Code Review
commit
66c9974bb8
@@ -17,7 +17,9 @@
|
|||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.SystemApi;
|
||||||
import android.annotation.SystemService;
|
import android.annotation.SystemService;
|
||||||
|
import android.annotation.TestApi;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -32,6 +34,8 @@ import java.util.Objects;
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@SystemApi
|
||||||
|
@TestApi
|
||||||
@SystemService(Context.ETHERNET_SERVICE)
|
@SystemService(Context.ETHERNET_SERVICE)
|
||||||
public class EthernetManager {
|
public class EthernetManager {
|
||||||
private static final String TAG = "EthernetManager";
|
private static final String TAG = "EthernetManager";
|
||||||
@@ -62,12 +66,14 @@ public class EthernetManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener interface to receive notification on changes in Ethernet.
|
* A listener interface to receive notification on changes in Ethernet.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
/**
|
/**
|
||||||
* Called when Ethernet port's availability is changed.
|
* Called when Ethernet port's availability is changed.
|
||||||
* @param iface Ethernet interface name
|
* @param iface Ethernet interface name
|
||||||
* @param isAvailable {@code true} if Ethernet port exists.
|
* @param isAvailable {@code true} if Ethernet port exists.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
void onAvailabilityChanged(String iface, boolean isAvailable);
|
void onAvailabilityChanged(String iface, boolean isAvailable);
|
||||||
@@ -78,6 +84,7 @@ public class EthernetManager {
|
|||||||
* Applications will almost always want to use
|
* Applications will almost always want to use
|
||||||
* {@link android.content.Context#getSystemService Context.getSystemService()} to retrieve
|
* {@link android.content.Context#getSystemService Context.getSystemService()} to retrieve
|
||||||
* the standard {@link android.content.Context#ETHERNET_SERVICE Context.ETHERNET_SERVICE}.
|
* the standard {@link android.content.Context#ETHERNET_SERVICE Context.ETHERNET_SERVICE}.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public EthernetManager(Context context, IEthernetManager service) {
|
public EthernetManager(Context context, IEthernetManager service) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -87,6 +94,7 @@ public class EthernetManager {
|
|||||||
/**
|
/**
|
||||||
* Get Ethernet configuration.
|
* Get Ethernet configuration.
|
||||||
* @return the Ethernet Configuration, contained in {@link IpConfiguration}.
|
* @return the Ethernet Configuration, contained in {@link IpConfiguration}.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public IpConfiguration getConfiguration(String iface) {
|
public IpConfiguration getConfiguration(String iface) {
|
||||||
@@ -99,6 +107,7 @@ public class EthernetManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Ethernet configuration.
|
* Set Ethernet configuration.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public void setConfiguration(String iface, IpConfiguration config) {
|
public void setConfiguration(String iface, IpConfiguration config) {
|
||||||
@@ -111,6 +120,7 @@ public class EthernetManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the system currently has one or more Ethernet interfaces.
|
* Indicates whether the system currently has one or more Ethernet interfaces.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
@@ -121,6 +131,7 @@ public class EthernetManager {
|
|||||||
* Indicates whether the system has given interface.
|
* Indicates whether the system has given interface.
|
||||||
*
|
*
|
||||||
* @param iface Ethernet interface name
|
* @param iface Ethernet interface name
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public boolean isAvailable(String iface) {
|
public boolean isAvailable(String iface) {
|
||||||
@@ -135,6 +146,7 @@ public class EthernetManager {
|
|||||||
* Adds a listener.
|
* Adds a listener.
|
||||||
* @param listener A {@link Listener} to add.
|
* @param listener A {@link Listener} to add.
|
||||||
* @throws IllegalArgumentException If the listener is null.
|
* @throws IllegalArgumentException If the listener is null.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public void addListener(Listener listener) {
|
public void addListener(Listener listener) {
|
||||||
@@ -153,6 +165,7 @@ public class EthernetManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of available Ethernet interface names.
|
* Returns an array of available Ethernet interface names.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public String[] getAvailableInterfaces() {
|
public String[] getAvailableInterfaces() {
|
||||||
@@ -167,6 +180,7 @@ public class EthernetManager {
|
|||||||
* Removes a listener.
|
* Removes a listener.
|
||||||
* @param listener A {@link Listener} to remove.
|
* @param listener A {@link Listener} to remove.
|
||||||
* @throws IllegalArgumentException If the listener is null.
|
* @throws IllegalArgumentException If the listener is null.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public void removeListener(Listener listener) {
|
public void removeListener(Listener listener) {
|
||||||
|
|||||||
Reference in New Issue
Block a user