[DPP] Rename "DPP" public API to "Easy Connect"
Rename all DPP public API and constants to use Easy Connect naming, whic is the WFA public technology name Bug: 122851551 Test: atest DppManagerTest Test: act.py -c ../WifiDppConfig.json -tc WifiDppTest Change-Id: Iaf30b62d8981b55e07cb509a4f12a476baf22768
This commit is contained in:
@@ -3900,24 +3900,24 @@ package android.net {
|
||||
|
||||
package android.net.wifi {
|
||||
|
||||
public abstract class DppStatusCallback {
|
||||
ctor public DppStatusCallback();
|
||||
public abstract class EasyConnectStatusCallback {
|
||||
ctor public EasyConnectStatusCallback();
|
||||
method public abstract void onConfiguratorSuccess(int);
|
||||
method public abstract void onEnrolleeSuccess(int);
|
||||
method public abstract void onFailure(int);
|
||||
method public abstract void onProgress(int);
|
||||
field public static final int DPP_EVENT_FAILURE = -7; // 0xfffffff9
|
||||
field public static final int DPP_EVENT_FAILURE_AUTHENTICATION = -2; // 0xfffffffe
|
||||
field public static final int DPP_EVENT_FAILURE_BUSY = -5; // 0xfffffffb
|
||||
field public static final int DPP_EVENT_FAILURE_CONFIGURATION = -4; // 0xfffffffc
|
||||
field public static final int DPP_EVENT_FAILURE_INVALID_NETWORK = -9; // 0xfffffff7
|
||||
field public static final int DPP_EVENT_FAILURE_INVALID_URI = -1; // 0xffffffff
|
||||
field public static final int DPP_EVENT_FAILURE_NOT_COMPATIBLE = -3; // 0xfffffffd
|
||||
field public static final int DPP_EVENT_FAILURE_NOT_SUPPORTED = -8; // 0xfffffff8
|
||||
field public static final int DPP_EVENT_FAILURE_TIMEOUT = -6; // 0xfffffffa
|
||||
field public static final int DPP_EVENT_PROGRESS_AUTHENTICATION_SUCCESS = 0; // 0x0
|
||||
field public static final int DPP_EVENT_PROGRESS_RESPONSE_PENDING = 1; // 0x1
|
||||
field public static final int DPP_EVENT_SUCCESS_CONFIGURATION_SENT = 0; // 0x0
|
||||
field public static final int EASY_CONNECT_EVENT_FAILURE = -7; // 0xfffffff9
|
||||
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_CONFIGURATION = -4; // 0xfffffffc
|
||||
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_RESPONSE_PENDING = 1; // 0x1
|
||||
field public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT = 0; // 0x0
|
||||
}
|
||||
|
||||
public deprecated class RttManager {
|
||||
@@ -4148,10 +4148,10 @@ package android.net.wifi {
|
||||
method public void save(android.net.wifi.WifiConfiguration, android.net.wifi.WifiManager.ActionListener);
|
||||
method public void setDeviceMobilityState(int);
|
||||
method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
|
||||
method public void startDppAsConfiguratorInitiator(java.lang.String, int, int, android.os.Handler, android.net.wifi.DppStatusCallback);
|
||||
method public void startDppAsEnrolleeInitiator(java.lang.String, android.os.Handler, android.net.wifi.DppStatusCallback);
|
||||
method public void startEasyConnectAsConfiguratorInitiator(java.lang.String, int, int, android.os.Handler, android.net.wifi.EasyConnectStatusCallback);
|
||||
method public void startEasyConnectAsEnrolleeInitiator(java.lang.String, android.os.Handler, android.net.wifi.EasyConnectStatusCallback);
|
||||
method public boolean startScan(android.os.WorkSource);
|
||||
method public void stopDppSession();
|
||||
method public void stopEasyConnectSession();
|
||||
method public void unregisterNetworkRequestMatchCallback(android.net.wifi.WifiManager.NetworkRequestMatchCallback);
|
||||
field public static final int CHANGE_REASON_ADDED = 0; // 0x0
|
||||
field public static final int CHANGE_REASON_CONFIG_CHANGE = 2; // 0x2
|
||||
@@ -4161,8 +4161,8 @@ package android.net.wifi {
|
||||
field public static final int DEVICE_MOBILITY_STATE_LOW_MVMT = 2; // 0x2
|
||||
field public static final int DEVICE_MOBILITY_STATE_STATIONARY = 3; // 0x3
|
||||
field public static final int DEVICE_MOBILITY_STATE_UNKNOWN = 0; // 0x0
|
||||
field public static final int DPP_NETWORK_ROLE_AP = 1; // 0x1
|
||||
field public static final int DPP_NETWORK_ROLE_STA = 0; // 0x0
|
||||
field public static final int EASY_CONNECT_NETWORK_ROLE_AP = 1; // 0x1
|
||||
field public static final int EASY_CONNECT_NETWORK_ROLE_STA = 0; // 0x0
|
||||
field public static final java.lang.String EXTRA_CHANGE_REASON = "changeReason";
|
||||
field public static final java.lang.String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
|
||||
field public static final java.lang.String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Handler;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* DPP Status Callback. Use this callback to get status updates (success, failure, progress)
|
||||
* from the DPP operation started with {@link WifiManager#startDppAsConfiguratorInitiator(String,
|
||||
* int, int, Handler, DppStatusCallback)} or {@link WifiManager#startDppAsEnrolleeInitiator(String,
|
||||
* Handler, DppStatusCallback)}
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public abstract class DppStatusCallback {
|
||||
/**
|
||||
* DPP Success event: Configuration sent (Configurator mode).
|
||||
*/
|
||||
public static final int DPP_EVENT_SUCCESS_CONFIGURATION_SENT = 0;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "DPP_EVENT_SUCCESS_" }, value = {
|
||||
DPP_EVENT_SUCCESS_CONFIGURATION_SENT,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DppSuccessStatusCode {}
|
||||
|
||||
/**
|
||||
* DPP Progress event: Initial authentication with peer succeeded.
|
||||
*/
|
||||
public static final int DPP_EVENT_PROGRESS_AUTHENTICATION_SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* DPP Progress event: Peer requires more time to process bootstrapping.
|
||||
*/
|
||||
public static final int DPP_EVENT_PROGRESS_RESPONSE_PENDING = 1;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "DPP_EVENT_PROGRESS_" }, value = {
|
||||
DPP_EVENT_PROGRESS_AUTHENTICATION_SUCCESS,
|
||||
DPP_EVENT_PROGRESS_RESPONSE_PENDING,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DppProgressStatusCode {}
|
||||
|
||||
/**
|
||||
* DPP Failure event: Scanned QR code is either not a DPP URI, or the DPP URI has errors.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_INVALID_URI = -1;
|
||||
|
||||
/**
|
||||
* DPP Failure event: Bootstrapping/Authentication initialization process failure.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_AUTHENTICATION = -2;
|
||||
|
||||
/**
|
||||
* DPP Failure event: Both devices are implementing the same role and are incompatible.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_NOT_COMPATIBLE = -3;
|
||||
|
||||
/**
|
||||
* DPP Failure event: Configuration process has failed due to malformed message.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_CONFIGURATION = -4;
|
||||
|
||||
/**
|
||||
* DPP Failure event: DPP request while in another DPP exchange.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_BUSY = -5;
|
||||
|
||||
/**
|
||||
* DPP Failure event: No response from the peer.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_TIMEOUT = -6;
|
||||
|
||||
/**
|
||||
* DPP Failure event: General protocol failure.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE = -7;
|
||||
|
||||
/**
|
||||
* DPP Failure event: Feature or option is not supported.
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_NOT_SUPPORTED = -8;
|
||||
|
||||
/**
|
||||
* DPP Failure event: Invalid network provided to DPP configurator.
|
||||
* Network must either be WPA3-Personal (SAE) or WPA2-Personal (PSK).
|
||||
*/
|
||||
public static final int DPP_EVENT_FAILURE_INVALID_NETWORK = -9;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = {"DPP_EVENT_FAILURE_"}, value = {
|
||||
DPP_EVENT_FAILURE_INVALID_URI,
|
||||
DPP_EVENT_FAILURE_AUTHENTICATION,
|
||||
DPP_EVENT_FAILURE_NOT_COMPATIBLE,
|
||||
DPP_EVENT_FAILURE_CONFIGURATION,
|
||||
DPP_EVENT_FAILURE_BUSY,
|
||||
DPP_EVENT_FAILURE_TIMEOUT,
|
||||
DPP_EVENT_FAILURE,
|
||||
DPP_EVENT_FAILURE_NOT_SUPPORTED,
|
||||
DPP_EVENT_FAILURE_INVALID_NETWORK,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DppFailureStatusCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when local DPP Enrollee successfully receives a new Wi-Fi configuration from the
|
||||
* peer DPP configurator. This callback marks the successful end of the DPP current DPP
|
||||
* session, and no further callbacks will be called. This callback is the successful outcome
|
||||
* of a DPP flow starting with {@link WifiManager#startDppAsEnrolleeInitiator(String, Handler,
|
||||
* DppStatusCallback)}.
|
||||
*
|
||||
* @param newNetworkId New Wi-Fi configuration with a network ID received from the configurator
|
||||
*/
|
||||
public abstract void onEnrolleeSuccess(int newNetworkId);
|
||||
|
||||
/**
|
||||
* Called when a DPP success event takes place, except for when configuration is received from
|
||||
* an external Configurator. The callback onSuccessConfigReceived will be used in this case.
|
||||
* This callback marks the successful end of the current DPP session, and no further
|
||||
* callbacks will be called. This callback is the successful outcome of a DPP flow starting with
|
||||
* {@link WifiManager#startDppAsConfiguratorInitiator(String, int, int, Handler,
|
||||
* DppStatusCallback)}.
|
||||
*
|
||||
* @param code DPP success status code.
|
||||
*/
|
||||
public abstract void onConfiguratorSuccess(@DppSuccessStatusCode int code);
|
||||
|
||||
/**
|
||||
* Called when a DPP Failure event takes place. This callback marks the unsuccessful end of the
|
||||
* current DPP session, and no further callbacks will be called.
|
||||
*
|
||||
* @param code DPP failure status code.
|
||||
*/
|
||||
public abstract void onFailure(@DppFailureStatusCode int code);
|
||||
|
||||
/**
|
||||
* Called when DPP events that indicate progress take place. Can be used by UI elements
|
||||
* to show progress.
|
||||
*
|
||||
* @param code DPP progress status code.
|
||||
*/
|
||||
public abstract void onProgress(@DppProgressStatusCode int code);
|
||||
}
|
||||
179
wifi/java/android/net/wifi/EasyConnectStatusCallback.java
Normal file
179
wifi/java/android/net/wifi/EasyConnectStatusCallback.java
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Handler;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* 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, Handler, EasyConnectStatusCallback)} or
|
||||
* {@link WifiManager#startEasyConnectAsEnrolleeInitiator(String,
|
||||
* Handler, EasyConnectStatusCallback)}
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public abstract class EasyConnectStatusCallback {
|
||||
/**
|
||||
* Easy Connect Success event: Configuration sent (Configurator mode).
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT = 0;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = {"EASY_CONNECT_EVENT_SUCCESS_"}, value = {
|
||||
EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface EasyConnectSuccessStatusCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Easy Connect Progress event: Initial authentication with peer succeeded.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_PROGRESS_AUTHENTICATION_SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* Easy Connect Progress event: Peer requires more time to process bootstrapping.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_PROGRESS_RESPONSE_PENDING = 1;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = {"EASY_CONNECT_EVENT_PROGRESS_"}, value = {
|
||||
EASY_CONNECT_EVENT_PROGRESS_AUTHENTICATION_SUCCESS,
|
||||
EASY_CONNECT_EVENT_PROGRESS_RESPONSE_PENDING,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface EasyConnectProgressStatusCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: Scanned QR code is either not a Easy Connect URI, or the Easy
|
||||
* Connect URI has errors.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_URI = -1;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: Bootstrapping/Authentication initialization process failure.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION = -2;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: Both devices are implementing the same role and are incompatible.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE = -3;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: Configuration process has failed due to malformed message.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_CONFIGURATION = -4;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: Easy Connect request while in another Easy Connect exchange.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_BUSY = -5;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: No response from the peer.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_TIMEOUT = -6;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: General protocol failure.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE = -7;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: Feature or option is not supported.
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED = -8;
|
||||
|
||||
/**
|
||||
* Easy Connect Failure event: Invalid network provided to Easy Connect configurator.
|
||||
* Network must either be WPA3-Personal (SAE) or WPA2-Personal (PSK).
|
||||
*/
|
||||
public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK = -9;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = {"EASY_CONNECT_EVENT_FAILURE_"}, value = {
|
||||
EASY_CONNECT_EVENT_FAILURE_INVALID_URI,
|
||||
EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION,
|
||||
EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE,
|
||||
EASY_CONNECT_EVENT_FAILURE_CONFIGURATION,
|
||||
EASY_CONNECT_EVENT_FAILURE_BUSY,
|
||||
EASY_CONNECT_EVENT_FAILURE_TIMEOUT,
|
||||
EASY_CONNECT_EVENT_FAILURE,
|
||||
EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED,
|
||||
EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface EasyConnectFailureStatusCode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when local Easy Connect Enrollee successfully receives a new Wi-Fi configuration from
|
||||
* the
|
||||
* peer Easy Connect configurator. This callback marks the successful end of the Easy Connect
|
||||
* current Easy Connect
|
||||
* session, and no further callbacks will be called. This callback is the successful outcome
|
||||
* of a Easy Connect flow starting with
|
||||
* {@link WifiManager#startEasyConnectAsEnrolleeInitiator(String,
|
||||
* Handler,
|
||||
* EasyConnectStatusCallback)}.
|
||||
*
|
||||
* @param newNetworkId New Wi-Fi configuration with a network ID received from the configurator
|
||||
*/
|
||||
public abstract void onEnrolleeSuccess(int newNetworkId);
|
||||
|
||||
/**
|
||||
* Called when a Easy Connect success event takes place, except for when configuration is
|
||||
* received from
|
||||
* an external Configurator. The callback onSuccessConfigReceived will be used in this case.
|
||||
* This callback marks the successful end of the current Easy Connect session, and no further
|
||||
* callbacks will be called. This callback is the successful outcome of a Easy Connect flow
|
||||
* starting with
|
||||
* {@link WifiManager#startEasyConnectAsConfiguratorInitiator(String, int, int, Handler,
|
||||
* EasyConnectStatusCallback)}.
|
||||
*
|
||||
* @param code Easy Connect success status code.
|
||||
*/
|
||||
public abstract void onConfiguratorSuccess(@EasyConnectSuccessStatusCode int code);
|
||||
|
||||
/**
|
||||
* Called when a Easy Connect Failure event takes place. This callback marks the unsuccessful
|
||||
* end of the
|
||||
* current Easy Connect session, and no further callbacks will be called.
|
||||
*
|
||||
* @param code Easy Connect failure status code.
|
||||
*/
|
||||
public abstract void onFailure(@EasyConnectFailureStatusCode int code);
|
||||
|
||||
/**
|
||||
* Called when Easy Connect events that indicate progress take place. Can be used by UI elements
|
||||
* to show progress.
|
||||
*
|
||||
* @param code Easy Connect progress status code.
|
||||
*/
|
||||
public abstract void onProgress(@EasyConnectProgressStatusCode int code);
|
||||
}
|
||||
@@ -4586,93 +4586,100 @@ public class WifiManager {
|
||||
}
|
||||
}
|
||||
|
||||
/* DPP - Device Provisioning Protocol AKA "Easy Connect" */
|
||||
/* Easy Connect - AKA Device Provisioning Protocol (DPP) */
|
||||
|
||||
/**
|
||||
* DPP Network role: Station.
|
||||
* Easy Connect Network role: Station.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final int DPP_NETWORK_ROLE_STA = 0;
|
||||
public static final int EASY_CONNECT_NETWORK_ROLE_STA = 0;
|
||||
|
||||
/**
|
||||
* DPP Network role: Access Point.
|
||||
* Easy Connect Network role: Access Point.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final int DPP_NETWORK_ROLE_AP = 1;
|
||||
public static final int EASY_CONNECT_NETWORK_ROLE_AP = 1;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = {"DPP_NETWORK_ROLE_"}, value = {
|
||||
DPP_NETWORK_ROLE_STA,
|
||||
DPP_NETWORK_ROLE_AP,
|
||||
@IntDef(prefix = {"EASY_CONNECT_NETWORK_ROLE_"}, value = {
|
||||
EASY_CONNECT_NETWORK_ROLE_STA,
|
||||
EASY_CONNECT_NETWORK_ROLE_AP,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DppNetworkRole {}
|
||||
public @interface EasyConnectNetworkRole {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start DPP in Configurator-Initiator role. The current device will initiate DPP bootstrapping
|
||||
* with a peer, and configure the peer with the SSID and password of the specified network using
|
||||
* the DPP protocol on an encrypted link.
|
||||
* Start Easy Connect (DPP) in Configurator-Initiator role. The current device will initiate
|
||||
* Easy Connect bootstrapping with a peer, and configure the peer with the SSID and password of
|
||||
* the specified network using the Easy Connect protocol on an encrypted link.
|
||||
*
|
||||
* @param enrolleeUri URI of the Enrollee obtained separately (e.g. QR code scanning)
|
||||
* @param selectedNetworkId Selected network ID to be sent to the peer
|
||||
* @param enrolleeUri URI of the Enrollee obtained separately (e.g. QR code scanning)
|
||||
* @param selectedNetworkId Selected network ID to be sent to the peer
|
||||
* @param enrolleeNetworkRole The network role of the enrollee
|
||||
* @param callback Callback for status updates
|
||||
* @param handler The handler on whose thread to execute the callbacks. Null for main thread.
|
||||
* @param callback Callback for status updates
|
||||
* @param handler The handler on whose thread to execute the callbacks. Null for
|
||||
* main thread.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.NETWORK_SETTINGS,
|
||||
android.Manifest.permission.NETWORK_SETUP_WIZARD})
|
||||
public void startDppAsConfiguratorInitiator(@NonNull String enrolleeUri,
|
||||
int selectedNetworkId, @DppNetworkRole int enrolleeNetworkRole,
|
||||
@Nullable Handler handler, @NonNull DppStatusCallback callback) {
|
||||
public void startEasyConnectAsConfiguratorInitiator(@NonNull String enrolleeUri,
|
||||
int selectedNetworkId, @EasyConnectNetworkRole int enrolleeNetworkRole,
|
||||
@Nullable Handler handler, @NonNull EasyConnectStatusCallback callback) {
|
||||
Looper looper = (handler == null) ? Looper.getMainLooper() : handler.getLooper();
|
||||
Binder binder = new Binder();
|
||||
try {
|
||||
mService.startDppAsConfiguratorInitiator(binder, enrolleeUri, selectedNetworkId,
|
||||
enrolleeNetworkRole, new DppCallbackProxy(looper, callback));
|
||||
enrolleeNetworkRole, new EasyConnectCallbackProxy(looper, callback));
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start DPP in Enrollee-Initiator role. The current device will initiate DPP bootstrapping
|
||||
* with a peer, and receive the SSID and password from the peer configurator.
|
||||
* Start Easy Connect (DPP) in Enrollee-Initiator role. The current device will initiate Easy
|
||||
* Connect bootstrapping with a peer, and receive the SSID and password from the peer
|
||||
* configurator.
|
||||
*
|
||||
* @param configuratorUri URI of the Configurator obtained separately (e.g. QR code scanning)
|
||||
* @param callback Callback for status updates
|
||||
* @param handler The handler on whose thread to execute the callbacks. Null for main thread.
|
||||
* @param callback Callback for status updates
|
||||
* @param handler The handler on whose thread to execute the callbacks. Null for main
|
||||
* thread.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.NETWORK_SETTINGS,
|
||||
android.Manifest.permission.NETWORK_SETUP_WIZARD})
|
||||
public void startDppAsEnrolleeInitiator(@NonNull String configuratorUri,
|
||||
@Nullable Handler handler, @NonNull DppStatusCallback callback) {
|
||||
public void startEasyConnectAsEnrolleeInitiator(@NonNull String configuratorUri,
|
||||
@Nullable Handler handler, @NonNull EasyConnectStatusCallback callback) {
|
||||
Looper looper = (handler == null) ? Looper.getMainLooper() : handler.getLooper();
|
||||
Binder binder = new Binder();
|
||||
try {
|
||||
mService.startDppAsEnrolleeInitiator(binder, configuratorUri,
|
||||
new DppCallbackProxy(looper, callback));
|
||||
new EasyConnectCallbackProxy(looper, callback));
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop or abort a current DPP session.
|
||||
* Stop or abort a current Easy Connect (DPP) session.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.NETWORK_SETTINGS,
|
||||
android.Manifest.permission.NETWORK_SETUP_WIZARD})
|
||||
public void stopDppSession() {
|
||||
public void stopEasyConnectSession() {
|
||||
try {
|
||||
/* Request lower layers to stop/abort and clear resources */
|
||||
mService.stopDppSession();
|
||||
@@ -4682,48 +4689,50 @@ public class WifiManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class to support DPP callbacks
|
||||
* Helper class to support Easy Connect (DPP) callbacks
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
private static class DppCallbackProxy extends IDppCallback.Stub {
|
||||
private static class EasyConnectCallbackProxy extends IDppCallback.Stub {
|
||||
private final Handler mHandler;
|
||||
private final DppStatusCallback mDppStatusCallback;
|
||||
private final EasyConnectStatusCallback mEasyConnectStatusCallback;
|
||||
|
||||
DppCallbackProxy(Looper looper, DppStatusCallback dppStatusCallback) {
|
||||
EasyConnectCallbackProxy(Looper looper,
|
||||
EasyConnectStatusCallback easyConnectStatusCallback) {
|
||||
mHandler = new Handler(looper);
|
||||
mDppStatusCallback = dppStatusCallback;
|
||||
mEasyConnectStatusCallback = easyConnectStatusCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccessConfigReceived(int newNetworkId) {
|
||||
Log.d(TAG, "DPP onSuccessConfigReceived callback");
|
||||
Log.d(TAG, "Easy Connect onSuccessConfigReceived callback");
|
||||
mHandler.post(() -> {
|
||||
mDppStatusCallback.onEnrolleeSuccess(newNetworkId);
|
||||
mEasyConnectStatusCallback.onEnrolleeSuccess(newNetworkId);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(int status) {
|
||||
Log.d(TAG, "DPP onSuccess callback");
|
||||
Log.d(TAG, "Easy Connect onSuccess callback");
|
||||
mHandler.post(() -> {
|
||||
mDppStatusCallback.onConfiguratorSuccess(status);
|
||||
mEasyConnectStatusCallback.onConfiguratorSuccess(status);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(int status) {
|
||||
Log.d(TAG, "DPP onFailure callback");
|
||||
Log.d(TAG, "Easy Connect onFailure callback");
|
||||
mHandler.post(() -> {
|
||||
mDppStatusCallback.onFailure(status);
|
||||
mEasyConnectStatusCallback.onFailure(status);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int status) {
|
||||
Log.d(TAG, "DPP onProgress callback");
|
||||
Log.d(TAG, "Easy Connect onProgress callback");
|
||||
mHandler.post(() -> {
|
||||
mDppStatusCallback.onProgress(status);
|
||||
mEasyConnectStatusCallback.onProgress(status);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user