diff options
| -rw-r--r-- | api/current.txt | 19 | ||||
| -rwxr-xr-x | api/system-current.txt | 12 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 83 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/EasyConnectStatusCallback.java | 40 |
4 files changed, 126 insertions, 28 deletions
diff --git a/api/current.txt b/api/current.txt index 1beddd45d652..333719714c8d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -30158,6 +30158,21 @@ package android.net.ssl { package android.net.wifi { + public abstract class EasyConnectStatusCallback { + field public static final int EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION = -2; // 0xfffffffe + field public static final int EASY_CONNECT_EVENT_FAILURE_BUSY = -5; // 0xfffffffb + field public static final int EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK = -10; // 0xfffffff6 + field public static final int EASY_CONNECT_EVENT_FAILURE_CONFIGURATION = -4; // 0xfffffffc + field public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION = -11; // 0xfffffff5 + field public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION = -12; // 0xfffffff4 + field public static final int EASY_CONNECT_EVENT_FAILURE_GENERIC = -7; // 0xfffffff9 + field public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK = -9; // 0xfffffff7 + field public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_URI = -1; // 0xffffffff + field public static final int EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE = -3; // 0xfffffffd + field public static final int EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED = -8; // 0xfffffff8 + field public static final int EASY_CONNECT_EVENT_FAILURE_TIMEOUT = -6; // 0xfffffffa + } + public class ScanResult implements android.os.Parcelable { method public int describeContents(); method public int getWifiStandard(); @@ -39459,6 +39474,10 @@ package android.provider { field public static final String EXTRA_CHANNEL_ID = "android.provider.extra.CHANNEL_ID"; field public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED = "android.settings.extra.do_not_disturb_mode_enabled"; field public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = "android.settings.extra.do_not_disturb_mode_minutes"; + field public static final String EXTRA_EASY_CONNECT_ATTEMPTED_SSID = "android.provider.extra.EASY_CONNECT_ATTEMPTED_SSID"; + field public static final String EXTRA_EASY_CONNECT_BAND_LIST = "android.provider.extra.EASY_CONNECT_BAND_LIST"; + field public static final String EXTRA_EASY_CONNECT_CHANNEL_LIST = "android.provider.extra.EASY_CONNECT_CHANNEL_LIST"; + field public static final String EXTRA_EASY_CONNECT_ERROR_CODE = "android.provider.extra.EASY_CONNECT_ERROR_CODE"; field public static final String EXTRA_INPUT_METHOD_ID = "input_method_id"; field public static final String EXTRA_NOTIFICATION_LISTENER_COMPONENT_NAME = "android.provider.extra.NOTIFICATION_LISTENER_COMPONENT_NAME"; field public static final String EXTRA_SUB_ID = "android.provider.extra.SUB_ID"; diff --git a/api/system-current.txt b/api/system-current.txt index cd6e9bb4dfe0..609faa89ecdb 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5403,18 +5403,6 @@ package android.net.wifi { method public void onFailure(int); method public void onFailure(int, @Nullable String, @NonNull android.util.SparseArray<int[]>, @NonNull int[]); method public abstract void onProgress(int); - field public static final int EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION = -2; // 0xfffffffe - field public static final int EASY_CONNECT_EVENT_FAILURE_BUSY = -5; // 0xfffffffb - field public static final int EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK = -10; // 0xfffffff6 - field public static final int EASY_CONNECT_EVENT_FAILURE_CONFIGURATION = -4; // 0xfffffffc - field public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION = -11; // 0xfffffff5 - field public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION = -12; // 0xfffffff4 - field public static final int EASY_CONNECT_EVENT_FAILURE_GENERIC = -7; // 0xfffffff9 - field public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK = -9; // 0xfffffff7 - field public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_URI = -1; // 0xffffffff - field public static final int EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE = -3; // 0xfffffffd - field public static final int EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED = -8; // 0xfffffff8 - field public static final int EASY_CONNECT_EVENT_FAILURE_TIMEOUT = -6; // 0xfffffffa field public static final int EASY_CONNECT_EVENT_PROGRESS_AUTHENTICATION_SUCCESS = 0; // 0x0 field public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_ACCEPTED = 3; // 0x3 field public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_SENT_WAITING_RESPONSE = 2; // 0x2 diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 462627e08520..588bb18a7984 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -494,25 +494,94 @@ public final class Settings { * Activity Action: Show setting page to process an Easy Connect (Wi-Fi DPP) QR code and start * configuration. This intent should be used when you want to use this device to take on the * configurator role for an IoT/other device. When provided with a valid DPP URI string Settings - * will open a wifi selection screen for the user to indicate which network they would like - * to configure the device specified in the DPP URI string for and carry them through the rest - * of the flow for provisioning the device. + * will open a wifi selection screen for the user to indicate which network they would like to + * configure the device specified in the DPP URI string for and carry them through the rest of + * the flow for provisioning the device. * <p> - * In some cases, a matching Activity may not exist, so ensure you safeguard - * against this by checking WifiManager.isEasyConnectSupported(); + * In some cases, a matching Activity may not exist, so ensure you safeguard against this by + * checking WifiManager.isEasyConnectSupported(); * <p> * Input: The Intent's data URI specifies bootstrapping information for authenticating and * provisioning the peer, with the "DPP" scheme. * <p> * Output: After {@code startActivityForResult}, the callback {@code onActivityResult} will have - * resultCode {@link android.app.Activity#RESULT_OK} if Wi-Fi Easy Connect configuration - * success and the user clicks 'Done' button. + * resultCode {@link android.app.Activity#RESULT_OK} if Wi-Fi Easy Connect configuration succeeded + * and the user tapped 'Done' button, or {@link android.app.Activity#RESULT_CANCELED} if operation + * failed and user tapped 'Cancel'. In case the operation has failed, a status code from {@link + * android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode} will be returned as + * Extra {@link #EXTRA_EASY_CONNECT_ERROR_CODE}. Easy Connect R2 Enrollees report additional + * details about the error they encountered, which will be provided in the {@link + * #EXTRA_EASY_CONNECT_ATTEMPTED_SSID}, {@link #EXTRA_EASY_CONNECT_CHANNEL_LIST}, and {@link + * #EXTRA_EASY_CONNECT_BAND_LIST}. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_PROCESS_WIFI_EASY_CONNECT_URI = "android.settings.PROCESS_WIFI_EASY_CONNECT_URI"; /** + * Activity Extra: The Easy Connect operation error code + * <p> + * An extra returned on the result intent received when using the {@link + * #ACTION_PROCESS_WIFI_EASY_CONNECT_URI} intent to launch the Easy Connect Operation. This + * extra contains the error code of the operation - one of + * {@link android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode}. + * If there is no error, i.e. if the operation returns {@link android.app.Activity#RESULT_OK}, + * then this extra is not attached to the result intent. + */ + public static final String EXTRA_EASY_CONNECT_ERROR_CODE = + "android.provider.extra.EASY_CONNECT_ERROR_CODE"; + + /** + * Activity Extra: The SSID that the Enrollee tried to connect to. + * <p> + * An extra returned on the result intent received when using the {@link + * #ACTION_PROCESS_WIFI_EASY_CONNECT_URI} intent to launch the Easy Connect Operation. This + * extra contains the SSID of the Access Point that the remote Enrollee tried to connect to. + * This value is populated only by remote R2 devices, and only for the following error codes: + * {@link android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode#EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK} + * {@link android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode#EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION}. + * Therefore, always check if this extra is available using {@link Intent#hasExtra(String)}. If + * there is no error, i.e. if the operation returns {@link android.app.Activity#RESULT_OK}, then + * this extra is not attached to the result intent. + */ + public static final String EXTRA_EASY_CONNECT_ATTEMPTED_SSID = + "android.provider.extra.EASY_CONNECT_ATTEMPTED_SSID"; + + /** + * Activity Extra: The Channel List that the Enrollee used to scan a network. + * <p> + * An extra returned on the result intent received when using the {@link + * #ACTION_PROCESS_WIFI_EASY_CONNECT_URI} intent to launch the Easy Connect Operation. This + * extra contains the list channels the Enrollee used to scan for a network. This value is + * populated only by remote R2 devices, and only for the following error code: {@link + * android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode#EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK}. + * Therefore, always check if this extra is available using {@link Intent#hasExtra(String)}. If + * there is no error, i.e. if the operation returns {@link android.app.Activity#RESULT_OK}, then + * this extra is not attached to the result intent. The list is JSON formatted, as an array + * (Wi-Fi global operating classes) of arrays (Wi-Fi channels). + */ + public static final String EXTRA_EASY_CONNECT_CHANNEL_LIST = + "android.provider.extra.EASY_CONNECT_CHANNEL_LIST"; + + /** + * Activity Extra: The Band List that the Enrollee supports. + * <p> + * An extra returned on the result intent received when using the {@link + * #ACTION_PROCESS_WIFI_EASY_CONNECT_URI} intent to launch the Easy Connect Operation. This + * extra contains the bands the Enrollee supports, expressed as the Global Operating Class, + * see Table E-4 in IEEE Std 802.11-2016 -Global operating classes. This value is populated only + * by remote R2 devices, and only for the following error codes: {@link + * android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode#EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK} + * {@link android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode#EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION} + * {@link android.net.wifi.EasyConnectStatusCallback.EasyConnectFailureStatusCode#EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION}. + * Therefore, always check if this extra is available using {@link Intent#hasExtra(String)}. If + * there is no error, i.e. if the operation returns {@link android.app.Activity#RESULT_OK}, then + * this extra is not attached to the result intent. + */ + public static final String EXTRA_EASY_CONNECT_BAND_LIST = + "android.provider.extra.EASY_CONNECT_BAND_LIST"; + + /** * Activity Action: Show settings to allow configuration of data and view data usage. * <p> * In some cases, a matching Activity may not exist, so ensure you diff --git a/wifi/java/android/net/wifi/EasyConnectStatusCallback.java b/wifi/java/android/net/wifi/EasyConnectStatusCallback.java index 4fa93ee271e9..8ccf0076f0b0 100644 --- a/wifi/java/android/net/wifi/EasyConnectStatusCallback.java +++ b/wifi/java/android/net/wifi/EasyConnectStatusCallback.java @@ -28,29 +28,27 @@ import java.util.concurrent.Executor; /** * Easy Connect (DPP) Status Callback. Use this callback to get status updates (success, failure, - * progress) from the Easy Connect operation started with - * {@link WifiManager#startEasyConnectAsConfiguratorInitiator(String, int, int, Executor, - * EasyConnectStatusCallback)} or {@link WifiManager#startEasyConnectAsEnrolleeInitiator(String, - * Executor, EasyConnectStatusCallback)} - * - * @hide + * progress) from the Easy Connect operations. */ -@SystemApi public abstract class EasyConnectStatusCallback { /** * Easy Connect R1 Success event: Configuration sent (Configurator mode). This is the last * and final Easy Connect event when either the local device or remote device implement R1. * If both devices implement R2, this event will never be received, and the - * {@link EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED} will be received. + * {@link #EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED} will be received. + * @hide */ + @SystemApi public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT = 0; /** * East Connect R2 Success event: Configuration applied by Enrollee (Configurator mode). * This is the last and final Easy Connect event when both the local device and remote device * implement R2. If either the local device or remote device implement R1, this event will never - * be received, and the {@link EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT} will be received. + * be received, and the {@link #EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT} will be received. + * @hide */ + @SystemApi public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED = 1; /** @hide */ @@ -64,22 +62,30 @@ public abstract class EasyConnectStatusCallback { /** * Easy Connect Progress event: Initial authentication with peer succeeded. + * @hide */ + @SystemApi public static final int EASY_CONNECT_EVENT_PROGRESS_AUTHENTICATION_SUCCESS = 0; /** * Easy Connect Progress event: Peer requires more time to process bootstrapping. + * @hide */ + @SystemApi public static final int EASY_CONNECT_EVENT_PROGRESS_RESPONSE_PENDING = 1; /** * Easy Connect R2 Progress event: Configuration sent to Enrollee, waiting for response + * @hide */ + @SystemApi public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_SENT_WAITING_RESPONSE = 2; /** * Easy Connect R2 Progress event: Configuration accepted by Enrollee, waiting for response + * @hide */ + @SystemApi public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_ACCEPTED = 3; /** @hide */ @@ -174,6 +180,12 @@ public abstract class EasyConnectStatusCallback { public @interface EasyConnectFailureStatusCode { } + /** @hide */ + @SystemApi + public EasyConnectStatusCallback() { + // Fully-static utility classes must not have constructor + } + /** * Called when local Easy Connect Enrollee successfully receives a new Wi-Fi configuration from * the @@ -185,7 +197,9 @@ public abstract class EasyConnectStatusCallback { * EasyConnectStatusCallback)} . * * @param newNetworkId New Wi-Fi configuration with a network ID received from the configurator + * @hide */ + @SystemApi public abstract void onEnrolleeSuccess(int newNetworkId); /** @@ -197,7 +211,9 @@ public abstract class EasyConnectStatusCallback { * int, Executor,EasyConnectStatusCallback)}. * * @param code Easy Connect success status code. + * @hide */ + @SystemApi public abstract void onConfiguratorSuccess(@EasyConnectSuccessStatusCode int code); /** @@ -205,7 +221,9 @@ public abstract class EasyConnectStatusCallback { * end of the current Easy Connect session, and no further callbacks will be called. * * @param code Easy Connect failure status code. + * @hide */ + @SystemApi public void onFailure(@EasyConnectFailureStatusCode int code) {} /** @@ -227,7 +245,9 @@ public abstract class EasyConnectStatusCallback { * @param operatingClassArray Array of bands the Enrollee supports as expressed as the Global * Operating Class, see Table E-4 in IEEE Std 802.11-2016 - Global * operating classes. + * @hide */ + @SystemApi public void onFailure(@EasyConnectFailureStatusCode int code, @Nullable String ssid, @NonNull SparseArray<int[]> channelListArray, @NonNull int[] operatingClassArray) { onFailure(code); @@ -238,6 +258,8 @@ public abstract class EasyConnectStatusCallback { * to show progress. * * @param code Easy Connect progress status code. + * @hide */ + @SystemApi public abstract void onProgress(@EasyConnectProgressStatusCode int code); } |