Merge changes I7065d081,Ic7c3a331,Ia432057b

* changes:
  Add API for tethering clients change
  Allows the caller to specify configuration by TetheringRequest
  Make TetheringManager to system API
This commit is contained in:
Lorenzo Colitti
2020-01-24 16:23:18 +00:00
committed by Gerrit Code Review

View File

@@ -33,6 +33,9 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.IpSecManager.UdpEncapsulationSocket; import android.net.IpSecManager.UdpEncapsulationSocket;
import android.net.SocketKeepalive.Callback; import android.net.SocketKeepalive.Callback;
import android.net.TetheringManager.StartTetheringCallback;
import android.net.TetheringManager.TetheringEventCallback;
import android.net.TetheringManager.TetheringRequest;
import android.os.Binder; import android.os.Binder;
import android.os.Build; import android.os.Build;
import android.os.Build.VERSION_CODES; import android.os.Build.VERSION_CODES;
@@ -58,6 +61,7 @@ import android.util.ArrayMap;
import android.util.Log; import android.util.Log;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions;
import com.android.internal.util.Protocol; import com.android.internal.util.Protocol;
@@ -75,6 +79,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@@ -484,34 +489,35 @@ public class ConnectivityManager {
* enable if any. * enable if any.
* @hide * @hide
*/ */
public static final String EXTRA_ADD_TETHER_TYPE = TetheringManager.EXTRA_ADD_TETHER_TYPE; public static final String EXTRA_ADD_TETHER_TYPE = TetheringConstants.EXTRA_ADD_TETHER_TYPE;
/** /**
* Extra used for communicating with the TetherService. Includes the type of tethering for * Extra used for communicating with the TetherService. Includes the type of tethering for
* which to cancel provisioning. * which to cancel provisioning.
* @hide * @hide
*/ */
public static final String EXTRA_REM_TETHER_TYPE = TetheringManager.EXTRA_REM_TETHER_TYPE; public static final String EXTRA_REM_TETHER_TYPE = TetheringConstants.EXTRA_REM_TETHER_TYPE;
/** /**
* Extra used for communicating with the TetherService. True to schedule a recheck of tether * Extra used for communicating with the TetherService. True to schedule a recheck of tether
* provisioning. * provisioning.
* @hide * @hide
*/ */
public static final String EXTRA_SET_ALARM = TetheringManager.EXTRA_SET_ALARM; public static final String EXTRA_SET_ALARM = TetheringConstants.EXTRA_SET_ALARM;
/** /**
* Tells the TetherService to run a provision check now. * Tells the TetherService to run a provision check now.
* @hide * @hide
*/ */
public static final String EXTRA_RUN_PROVISION = TetheringManager.EXTRA_RUN_PROVISION; public static final String EXTRA_RUN_PROVISION = TetheringConstants.EXTRA_RUN_PROVISION;
/** /**
* Extra used for communicating with the TetherService. Contains the {@link ResultReceiver} * Extra used for communicating with the TetherService. Contains the {@link ResultReceiver}
* which will receive provisioning results. Can be left empty. * which will receive provisioning results. Can be left empty.
* @hide * @hide
*/ */
public static final String EXTRA_PROVISION_CALLBACK = TetheringManager.EXTRA_PROVISION_CALLBACK; public static final String EXTRA_PROVISION_CALLBACK =
TetheringConstants.EXTRA_PROVISION_CALLBACK;
/** /**
* The absence of a connection type. * The absence of a connection type.
@@ -2369,10 +2375,12 @@ public class ConnectivityManager {
* *
* @return an array of 0 or more Strings of tetherable interface names. * @return an array of 0 or more Strings of tetherable interface names.
* *
* @deprecated Use {@link TetheringEventCallback#onTetherableInterfacesChanged(List)} instead.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public String[] getTetherableIfaces() { public String[] getTetherableIfaces() {
return getTetheringManager().getTetherableIfaces(); return getTetheringManager().getTetherableIfaces();
} }
@@ -2382,10 +2390,12 @@ public class ConnectivityManager {
* *
* @return an array of 0 or more String of currently tethered interface names. * @return an array of 0 or more String of currently tethered interface names.
* *
* @deprecated Use {@link TetheringEventCallback#onTetherableInterfacesChanged(List)} instead.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public String[] getTetheredIfaces() { public String[] getTetheredIfaces() {
return getTetheringManager().getTetheredIfaces(); return getTetheringManager().getTetheredIfaces();
} }
@@ -2401,10 +2411,12 @@ public class ConnectivityManager {
* @return an array of 0 or more String indicating the interface names * @return an array of 0 or more String indicating the interface names
* which failed to tether. * which failed to tether.
* *
* @deprecated Use {@link TetheringEventCallback#onError(String, int)} instead.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public String[] getTetheringErroredIfaces() { public String[] getTetheringErroredIfaces() {
return getTetheringManager().getTetheringErroredIfaces(); return getTetheringManager().getTetheringErroredIfaces();
} }
@@ -2413,9 +2425,11 @@ public class ConnectivityManager {
* Get the set of tethered dhcp ranges. * Get the set of tethered dhcp ranges.
* *
* @return an array of 0 or more {@code String} of tethered dhcp ranges. * @return an array of 0 or more {@code String} of tethered dhcp ranges.
* @deprecated This API just return the default value which is not used in DhcpServer.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
@Deprecated
public String[] getTetheredDhcpRanges() { public String[] getTetheredDhcpRanges() {
return getTetheringManager().getTetheredDhcpRanges(); return getTetheringManager().getTetheredDhcpRanges();
} }
@@ -2441,10 +2455,12 @@ public class ConnectivityManager {
* *
* @param iface the interface name to tether. * @param iface the interface name to tether.
* @return error a {@code TETHER_ERROR} value indicating success or failure type * @return error a {@code TETHER_ERROR} value indicating success or failure type
* @deprecated Use {@link TetheringManager#startTethering} instead
* *
* {@hide} * {@hide}
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public int tether(String iface) { public int tether(String iface) {
return getTetheringManager().tether(iface); return getTetheringManager().tether(iface);
} }
@@ -2468,6 +2484,7 @@ public class ConnectivityManager {
* {@hide} * {@hide}
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public int untether(String iface) { public int untether(String iface) {
return getTetheringManager().untether(iface); return getTetheringManager().untether(iface);
} }
@@ -2488,6 +2505,7 @@ public class ConnectivityManager {
* *
* @return a boolean - {@code true} indicating Tethering is supported. * @return a boolean - {@code true} indicating Tethering is supported.
* *
* @deprecated Use {@link TetheringEventCallback#onTetheringSupported(boolean)} instead.
* {@hide} * {@hide}
*/ */
@SystemApi @SystemApi
@@ -2499,9 +2517,12 @@ public class ConnectivityManager {
/** /**
* Callback for use with {@link #startTethering} to find out whether tethering succeeded. * Callback for use with {@link #startTethering} to find out whether tethering succeeded.
*
* @deprecated Use {@link TetheringManager.StartTetheringCallback} instead.
* @hide * @hide
*/ */
@SystemApi @SystemApi
@Deprecated
public static abstract class OnStartTetheringCallback { public static abstract class OnStartTetheringCallback {
/** /**
* Called when tethering has been successfully started. * Called when tethering has been successfully started.
@@ -2518,9 +2539,12 @@ public class ConnectivityManager {
* Convenient overload for * Convenient overload for
* {@link #startTethering(int, boolean, OnStartTetheringCallback, Handler)} which passes a null * {@link #startTethering(int, boolean, OnStartTetheringCallback, Handler)} which passes a null
* handler to run on the current thread's {@link Looper}. * handler to run on the current thread's {@link Looper}.
*
* @deprecated Use {@link TetheringManager#startTethering} instead.
* @hide * @hide
*/ */
@SystemApi @SystemApi
@Deprecated
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
public void startTethering(int type, boolean showProvisioningUi, public void startTethering(int type, boolean showProvisioningUi,
final OnStartTetheringCallback callback) { final OnStartTetheringCallback callback) {
@@ -2544,26 +2568,44 @@ public class ConnectivityManager {
* @param callback an {@link OnStartTetheringCallback} which will be called to notify the caller * @param callback an {@link OnStartTetheringCallback} which will be called to notify the caller
* of the result of trying to tether. * of the result of trying to tether.
* @param handler {@link Handler} to specify the thread upon which the callback will be invoked. * @param handler {@link Handler} to specify the thread upon which the callback will be invoked.
*
* @deprecated Use {@link TetheringManager#startTethering} instead.
* @hide * @hide
*/ */
@SystemApi @SystemApi
@Deprecated
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
public void startTethering(int type, boolean showProvisioningUi, public void startTethering(int type, boolean showProvisioningUi,
final OnStartTetheringCallback callback, Handler handler) { final OnStartTetheringCallback callback, Handler handler) {
Preconditions.checkNotNull(callback, "OnStartTetheringCallback cannot be null."); Preconditions.checkNotNull(callback, "OnStartTetheringCallback cannot be null.");
ResultReceiver wrappedCallback = new ResultReceiver(handler) { final Executor executor = new Executor() {
@Override @Override
protected void onReceiveResult(int resultCode, Bundle resultData) { public void execute(Runnable command) {
if (resultCode == TETHER_ERROR_NO_ERROR) { if (handler == null) {
callback.onTetheringStarted(); command.run();
} else { } else {
callback.onTetheringFailed(); handler.post(command);
} }
} }
}; };
getTetheringManager().startTethering(type, wrappedCallback, showProvisioningUi); final StartTetheringCallback tetheringCallback = new StartTetheringCallback() {
@Override
public void onTetheringStarted() {
callback.onTetheringStarted();
}
@Override
public void onTetheringFailed(final int resultCode) {
callback.onTetheringFailed();
}
};
final TetheringRequest request = new TetheringRequest.Builder(type)
.setSilentProvisioning(!showProvisioningUi).build();
getTetheringManager().startTethering(request, executor, tetheringCallback);
} }
/** /**
@@ -2574,9 +2616,12 @@ public class ConnectivityManager {
* {@link ConnectivityManager.TETHERING_WIFI}, * {@link ConnectivityManager.TETHERING_WIFI},
* {@link ConnectivityManager.TETHERING_USB}, or * {@link ConnectivityManager.TETHERING_USB}, or
* {@link ConnectivityManager.TETHERING_BLUETOOTH}. * {@link ConnectivityManager.TETHERING_BLUETOOTH}.
*
* @deprecated Use {@link TetheringManager#stopTethering} instead.
* @hide * @hide
*/ */
@SystemApi @SystemApi
@Deprecated
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
public void stopTethering(int type) { public void stopTethering(int type) {
getTetheringManager().stopTethering(type); getTetheringManager().stopTethering(type);
@@ -2586,9 +2631,11 @@ public class ConnectivityManager {
* Callback for use with {@link registerTetheringEventCallback} to find out tethering * Callback for use with {@link registerTetheringEventCallback} to find out tethering
* upstream status. * upstream status.
* *
*@hide * @deprecated Use {@line TetheringManager#OnTetheringEventCallback} instead.
* @hide
*/ */
@SystemApi @SystemApi
@Deprecated
public abstract static class OnTetheringEventCallback { public abstract static class OnTetheringEventCallback {
/** /**
@@ -2601,6 +2648,10 @@ public class ConnectivityManager {
public void onUpstreamChanged(@Nullable Network network) {} public void onUpstreamChanged(@Nullable Network network) {}
} }
@GuardedBy("mTetheringEventCallbacks")
private final ArrayMap<OnTetheringEventCallback, TetheringEventCallback>
mTetheringEventCallbacks = new ArrayMap<>();
/** /**
* Start listening to tethering change events. Any new added callback will receive the last * Start listening to tethering change events. Any new added callback will receive the last
* tethering status right away. If callback is registered when tethering has no upstream or * tethering status right away. If callback is registered when tethering has no upstream or
@@ -2609,16 +2660,30 @@ public class ConnectivityManager {
* *
* @param executor the executor on which callback will be invoked. * @param executor the executor on which callback will be invoked.
* @param callback the callback to be called when tethering has change events. * @param callback the callback to be called when tethering has change events.
*
* @deprecated Use {@line TetheringManager#registerTetheringEventCallback} instead.
* @hide * @hide
*/ */
@SystemApi @SystemApi
@Deprecated
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
public void registerTetheringEventCallback( public void registerTetheringEventCallback(
@NonNull @CallbackExecutor Executor executor, @NonNull @CallbackExecutor Executor executor,
@NonNull final OnTetheringEventCallback callback) { @NonNull final OnTetheringEventCallback callback) {
Preconditions.checkNotNull(callback, "OnTetheringEventCallback cannot be null."); Preconditions.checkNotNull(callback, "OnTetheringEventCallback cannot be null.");
getTetheringManager().registerTetheringEventCallback(executor, callback); final TetheringEventCallback tetherCallback =
new TetheringEventCallback() {
@Override
public void onUpstreamChanged(@Nullable Network network) {
callback.onUpstreamChanged(network);
}
};
synchronized (mTetheringEventCallbacks) {
mTetheringEventCallbacks.put(callback, tetherCallback);
getTetheringManager().registerTetheringEventCallback(executor, tetherCallback);
}
} }
/** /**
@@ -2626,13 +2691,21 @@ public class ConnectivityManager {
* {@link #registerTetheringEventCallback}. * {@link #registerTetheringEventCallback}.
* *
* @param callback previously registered callback. * @param callback previously registered callback.
*
* @deprecated Use {@link TetheringManager#unregisterTetheringEventCallback} instead.
* @hide * @hide
*/ */
@SystemApi @SystemApi
@Deprecated
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
public void unregisterTetheringEventCallback( public void unregisterTetheringEventCallback(
@NonNull final OnTetheringEventCallback callback) { @NonNull final OnTetheringEventCallback callback) {
getTetheringManager().unregisterTetheringEventCallback(callback); Objects.requireNonNull(callback, "The callback must be non-null");
synchronized (mTetheringEventCallbacks) {
final TetheringEventCallback tetherCallback =
mTetheringEventCallbacks.remove(callback);
getTetheringManager().unregisterTetheringEventCallback(tetherCallback);
}
} }
@@ -2644,10 +2717,12 @@ public class ConnectivityManager {
* @return an array of 0 or more regular expression Strings defining * @return an array of 0 or more regular expression Strings defining
* what interfaces are considered tetherable usb interfaces. * what interfaces are considered tetherable usb interfaces.
* *
* @deprecated Use {@link TetheringEventCallback#onTetherableInterfaceRegexpsChanged} instead.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public String[] getTetherableUsbRegexs() { public String[] getTetherableUsbRegexs() {
return getTetheringManager().getTetherableUsbRegexs(); return getTetheringManager().getTetherableUsbRegexs();
} }
@@ -2660,10 +2735,12 @@ public class ConnectivityManager {
* @return an array of 0 or more regular expression Strings defining * @return an array of 0 or more regular expression Strings defining
* what interfaces are considered tetherable wifi interfaces. * what interfaces are considered tetherable wifi interfaces.
* *
* @deprecated Use {@link TetheringEventCallback#onTetherableInterfaceRegexpsChanged} instead.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public String[] getTetherableWifiRegexs() { public String[] getTetherableWifiRegexs() {
return getTetheringManager().getTetherableWifiRegexs(); return getTetheringManager().getTetherableWifiRegexs();
} }
@@ -2676,10 +2753,13 @@ public class ConnectivityManager {
* @return an array of 0 or more regular expression Strings defining * @return an array of 0 or more regular expression Strings defining
* what interfaces are considered tetherable bluetooth interfaces. * what interfaces are considered tetherable bluetooth interfaces.
* *
* @deprecated Use {@link TetheringEventCallback#onTetherableInterfaceRegexpsChanged(
*TetheringManager.TetheringInterfaceRegexps)} instead.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public String[] getTetherableBluetoothRegexs() { public String[] getTetherableBluetoothRegexs() {
return getTetheringManager().getTetherableBluetoothRegexs(); return getTetheringManager().getTetherableBluetoothRegexs();
} }
@@ -2698,45 +2778,114 @@ public class ConnectivityManager {
* *
* @param enable a boolean - {@code true} to enable tethering * @param enable a boolean - {@code true} to enable tethering
* @return error a {@code TETHER_ERROR} value indicating success or failure type * @return error a {@code TETHER_ERROR} value indicating success or failure type
* @deprecated Use {@link TetheringManager#startTethering} instead
* *
* {@hide} * {@hide}
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public int setUsbTethering(boolean enable) { public int setUsbTethering(boolean enable) {
return getTetheringManager().setUsbTethering(enable); return getTetheringManager().setUsbTethering(enable);
} }
/** {@hide} */ /**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_NO_ERROR}.
* {@hide}
*/
@SystemApi @SystemApi
public static final int TETHER_ERROR_NO_ERROR = 0; @Deprecated
/** {@hide} */ public static final int TETHER_ERROR_NO_ERROR = TetheringManager.TETHER_ERROR_NO_ERROR;
public static final int TETHER_ERROR_UNKNOWN_IFACE = 1; /**
/** {@hide} */ * @deprecated Use {@link TetheringManager#TETHER_ERROR_UNKNOWN_IFACE}.
public static final int TETHER_ERROR_SERVICE_UNAVAIL = 2; * {@hide}
/** {@hide} */ */
public static final int TETHER_ERROR_UNSUPPORTED = 3; @Deprecated
/** {@hide} */ public static final int TETHER_ERROR_UNKNOWN_IFACE =
public static final int TETHER_ERROR_UNAVAIL_IFACE = 4; TetheringManager.TETHER_ERROR_UNKNOWN_IFACE;
/** {@hide} */ /**
public static final int TETHER_ERROR_MASTER_ERROR = 5; * @deprecated Use {@link TetheringManager#TETHER_ERROR_SERVICE_UNAVAIL}.
/** {@hide} */ * {@hide}
public static final int TETHER_ERROR_TETHER_IFACE_ERROR = 6; */
/** {@hide} */ @Deprecated
public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR = 7; public static final int TETHER_ERROR_SERVICE_UNAVAIL =
/** {@hide} */ TetheringManager.TETHER_ERROR_SERVICE_UNAVAIL;
public static final int TETHER_ERROR_ENABLE_NAT_ERROR = 8; /**
/** {@hide} */ * @deprecated Use {@link TetheringManager#TETHER_ERROR_UNSUPPORTED}.
public static final int TETHER_ERROR_DISABLE_NAT_ERROR = 9; * {@hide}
/** {@hide} */ */
public static final int TETHER_ERROR_IFACE_CFG_ERROR = 10; @Deprecated
/** {@hide} */ public static final int TETHER_ERROR_UNSUPPORTED = TetheringManager.TETHER_ERROR_UNSUPPORTED;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_UNAVAIL_IFACE}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_UNAVAIL_IFACE =
TetheringManager.TETHER_ERROR_UNAVAIL_IFACE;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_MASTER_ERROR}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_MASTER_ERROR = TetheringManager.TETHER_ERROR_MASTER_ERROR;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_TETHER_IFACE_ERROR}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_TETHER_IFACE_ERROR =
TetheringManager.TETHER_ERROR_TETHER_IFACE_ERROR;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_UNTETHER_IFACE_ERROR}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR =
TetheringManager.TETHER_ERROR_UNTETHER_IFACE_ERROR;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_ENABLE_NAT_ERROR}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_ENABLE_NAT_ERROR =
TetheringManager.TETHER_ERROR_ENABLE_NAT_ERROR;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_DISABLE_NAT_ERROR}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_DISABLE_NAT_ERROR =
TetheringManager.TETHER_ERROR_DISABLE_NAT_ERROR;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_IFACE_CFG_ERROR}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_IFACE_CFG_ERROR =
TetheringManager.TETHER_ERROR_IFACE_CFG_ERROR;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_PROVISION_FAILED}.
* {@hide}
*/
@SystemApi @SystemApi
public static final int TETHER_ERROR_PROVISION_FAILED = 11; @Deprecated
/** {@hide} */ public static final int TETHER_ERROR_PROVISION_FAILED =
public static final int TETHER_ERROR_DHCPSERVER_ERROR = 12; TetheringManager.TETHER_ERROR_PROVISION_FAILED;
/** {@hide} */ /**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_DHCPSERVER_ERROR}.
* {@hide}
*/
@Deprecated
public static final int TETHER_ERROR_DHCPSERVER_ERROR =
TetheringManager.TETHER_ERROR_DHCPSERVER_ERROR;
/**
* @deprecated Use {@link TetheringManager#TETHER_ERROR_ENTITLEMENT_UNKNOWN}.
* {@hide}
*/
@SystemApi @SystemApi
public static final int TETHER_ERROR_ENTITLEMENT_UNKONWN = 13; @Deprecated
public static final int TETHER_ERROR_ENTITLEMENT_UNKONWN =
TetheringManager.TETHER_ERROR_ENTITLEMENT_UNKNOWN;
/** /**
* Get a more detailed error code after a Tethering or Untethering * Get a more detailed error code after a Tethering or Untethering
@@ -2746,10 +2895,12 @@ public class ConnectivityManager {
* @return error The error code of the last error tethering or untethering the named * @return error The error code of the last error tethering or untethering the named
* interface * interface
* *
* @deprecated Use {@link TetheringEventCallback#onError(String, int)} instead.
* {@hide} * {@hide}
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage
@Deprecated
public int getLastTetherError(String iface) { public int getLastTetherError(String iface) {
return getTetheringManager().getLastTetherError(iface); return getTetheringManager().getLastTetherError(iface);
} }
@@ -2767,9 +2918,12 @@ public class ConnectivityManager {
/** /**
* Callback for use with {@link #getLatestTetheringEntitlementResult} to find out whether * Callback for use with {@link #getLatestTetheringEntitlementResult} to find out whether
* entitlement succeeded. * entitlement succeeded.
*
* @deprecated Use {@link TetheringManager#OnTetheringEntitlementResultListener} instead.
* @hide * @hide
*/ */
@SystemApi @SystemApi
@Deprecated
public interface OnTetheringEntitlementResultListener { public interface OnTetheringEntitlementResultListener {
/** /**
* Called to notify entitlement result. * Called to notify entitlement result.
@@ -2799,9 +2953,11 @@ public class ConnectivityManager {
* @param listener an {@link OnTetheringEntitlementResultListener} which will be called to * @param listener an {@link OnTetheringEntitlementResultListener} which will be called to
* notify the caller of the result of entitlement check. The listener may be called zero * notify the caller of the result of entitlement check. The listener may be called zero
* or one time. * or one time.
* @deprecated Use {@link TetheringManager#requestLatestTetheringEntitlementResult} instead.
* {@hide} * {@hide}
*/ */
@SystemApi @SystemApi
@Deprecated
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
public void getLatestTetheringEntitlementResult(int type, boolean showEntitlementUi, public void getLatestTetheringEntitlementResult(int type, boolean showEntitlementUi,
@NonNull @CallbackExecutor Executor executor, @NonNull @CallbackExecutor Executor executor,