[DPP R2] Added support for DPP R2 events
Added support for DPP R2 events that provide additional details about the onboarding process of a remote enrollee. Specifically, DPP R2 configurator waits for response from the enrollee, which reports back the SSID, tried channels and band support in case it cannot find the AP. When it reports success, then it means that it is acutally connected. Bug: 139381558 Test: Manual tests with DPP R1 and R2 enrollees Test: atest DppManagerTest Test: act.py -c ../WifiDppConfig.json -tc WifiDppTest Change-Id: If19fc6906ec5abbdceef0742dc52b42c7d0acfe0
This commit is contained in:
@@ -2056,6 +2056,12 @@
|
|||||||
<string name="wifi_dpp_failure_generic">Make sure the device has been plugged in, charged, and turned on. If the issue continues, contact the device manufacturer</string>
|
<string name="wifi_dpp_failure_generic">Make sure the device has been plugged in, charged, and turned on. If the issue continues, contact the device manufacturer</string>
|
||||||
<!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE] -->
|
<!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE] -->
|
||||||
<string name="wifi_dpp_failure_not_supported">Adding \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d isn\u2019t supported by this device</string>
|
<string name="wifi_dpp_failure_not_supported">Adding \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d isn\u2019t supported by this device</string>
|
||||||
|
<!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="wifi_dpp_failure_cannot_find_network">Try moving the device closer to your Wi\u2011Fi access point/router</string>
|
||||||
|
<!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="wifi_dpp_failure_enrollee_authentication">Check the password and try again</string>
|
||||||
|
<!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="wifi_dpp_failure_enrollee_rejected_configuration">Contact the device manufacturer</string>
|
||||||
<!-- Hint for Wi-Fi connection fail [CHAR LIMIT=NONE] -->
|
<!-- Hint for Wi-Fi connection fail [CHAR LIMIT=NONE] -->
|
||||||
<string name="wifi_dpp_check_connection_try_again">Check connection and try again</string>
|
<string name="wifi_dpp_check_connection_try_again">Check connection and try again</string>
|
||||||
<!-- Title for the fragment choose network [CHAR LIMIT=50] -->
|
<!-- Title for the fragment choose network [CHAR LIMIT=50] -->
|
||||||
|
@@ -24,6 +24,7 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.SparseArray;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -61,8 +62,22 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(int code) {
|
public void onFailure(int code, String ssid, SparseArray<int[]> channelListArray,
|
||||||
Log.d(TAG, "EasyConnectConfiguratorStatusCallback.onFailure " + code);
|
int[] operatingClassArray) {
|
||||||
|
Log.d(TAG, "EasyConnectConfiguratorStatusCallback.onFailure: " + code);
|
||||||
|
if (!TextUtils.isEmpty(ssid)) {
|
||||||
|
Log.d(TAG, "Tried SSID: " + ssid);
|
||||||
|
}
|
||||||
|
if (channelListArray.size() != 0) {
|
||||||
|
Log.d(TAG, "Tried channels: " + channelListArray);
|
||||||
|
}
|
||||||
|
if (operatingClassArray != null && operatingClassArray.length > 0) {
|
||||||
|
StringBuilder sb = new StringBuilder("Supported bands: ");
|
||||||
|
for (int i = 0; i < operatingClassArray.length; i++) {
|
||||||
|
sb.append(operatingClassArray[i] + " ");
|
||||||
|
}
|
||||||
|
Log.d(TAG, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
showErrorUi(code, /* isConfigurationChange */ false);
|
showErrorUi(code, /* isConfigurationChange */ false);
|
||||||
}
|
}
|
||||||
@@ -150,6 +165,20 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
throw(new IllegalStateException("Wi-Fi DPP configurator used a non-PSK/non-SAE"
|
throw(new IllegalStateException("Wi-Fi DPP configurator used a non-PSK/non-SAE"
|
||||||
+ "network to handshake"));
|
+ "network to handshake"));
|
||||||
|
|
||||||
|
case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK:
|
||||||
|
summaryCharSequence = getText(R.string.wifi_dpp_failure_cannot_find_network);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION:
|
||||||
|
summaryCharSequence = getText(R.string.wifi_dpp_failure_enrollee_authentication);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EasyConnectStatusCallback
|
||||||
|
.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION:
|
||||||
|
summaryCharSequence =
|
||||||
|
getText(R.string.wifi_dpp_failure_enrollee_rejected_configuration);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw(new IllegalStateException("Unexpected Wi-Fi DPP error"));
|
throw(new IllegalStateException("Unexpected Wi-Fi DPP error"));
|
||||||
}
|
}
|
||||||
@@ -218,7 +247,8 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
if (code == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
|
if (code == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
|
||||||
new EasyConnectConfiguratorStatusCallback().onConfiguratorSuccess(code);
|
new EasyConnectConfiguratorStatusCallback().onConfiguratorSuccess(code);
|
||||||
} else {
|
} else {
|
||||||
new EasyConnectConfiguratorStatusCallback().onFailure(code);
|
new EasyConnectConfiguratorStatusCallback().onFailure(code, model.getTriedSsid(),
|
||||||
|
model.getTriedChannels(), model.getBandArray());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -19,14 +19,18 @@ package com.android.settings.wifi.dpp;
|
|||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.net.wifi.EasyConnectStatusCallback;
|
import android.net.wifi.EasyConnectStatusCallback;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
|
||||||
import androidx.lifecycle.AndroidViewModel;
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
public class WifiDppInitiatorViewModel extends AndroidViewModel {
|
public class WifiDppInitiatorViewModel extends AndroidViewModel {
|
||||||
private MutableLiveData<Integer> mEnrolleeSuccessNetworkId;
|
private MutableLiveData<Integer> mEnrolleeSuccessNetworkId;
|
||||||
private MutableLiveData<Integer> mStatusCode;
|
private MutableLiveData<Integer> mStatusCode;
|
||||||
private boolean mIsWifiDppHandshaking;
|
private boolean mIsWifiDppHandshaking;
|
||||||
|
private String mTriedSsid;
|
||||||
|
private SparseArray<int[]> mTriedChannels;
|
||||||
|
private int[] mBandArray;
|
||||||
|
|
||||||
public WifiDppInitiatorViewModel(Application application) {
|
public WifiDppInitiatorViewModel(Application application) {
|
||||||
super(application);
|
super(application);
|
||||||
@@ -48,6 +52,18 @@ public class WifiDppInitiatorViewModel extends AndroidViewModel {
|
|||||||
return mStatusCode;
|
return mStatusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getTriedSsid() {
|
||||||
|
return mTriedSsid;
|
||||||
|
}
|
||||||
|
|
||||||
|
SparseArray<int[]> getTriedChannels() {
|
||||||
|
return mTriedChannels;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] getBandArray() {
|
||||||
|
return mBandArray;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isWifiDppHandshaking() {
|
boolean isWifiDppHandshaking() {
|
||||||
return mIsWifiDppHandshaking;
|
return mIsWifiDppHandshaking;
|
||||||
}
|
}
|
||||||
@@ -83,8 +99,12 @@ public class WifiDppInitiatorViewModel extends AndroidViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(int code) {
|
public void onFailure(int code, String ssid, SparseArray<int[]> channelListArray,
|
||||||
|
int[] operatingClassArray) {
|
||||||
mIsWifiDppHandshaking = false;
|
mIsWifiDppHandshaking = false;
|
||||||
|
mTriedSsid = ssid;
|
||||||
|
mTriedChannels = channelListArray;
|
||||||
|
mBandArray = operatingClassArray;
|
||||||
mStatusCode.setValue(code);
|
mStatusCode.setValue(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user