Handle different error codes in DPP

Show error message for corresponding Wi-Fi DPP error code. And

1. To update error message only from each fragment,
   remove some callbacks which calls from fragment to activity.
2. After clicking 'Share Wi-Fi' button, hide it before Wi-Fi DPP handshake completes.
3. Show 'Done' button for some error codes.
4. Use ViewModel to call startEasyConnectAsConfiguratorInitiator and
   startEasyConnectAsEnrolleeInitiator because a lifecycle object
   does not receive an Executor callback after configurator change.
5. In WifiDppQrCodeScannerFragment, show an error message for 10s instead of 2s
   since new added error messages may carry more information.
6. Show a different error message for enrollee handshake success but Wi-Fi
   connection fail case.
7. stop camera when scanned a Wi-Fi DPP QR code for enrollee.
8. In QR code scanner fragment, support to show error message after
    configuration change.

Bug: 124247872
Bug: 124491247
Test: manual test
      atest WifiQrCodeTest
      atest WifiDppConfiguratorActivityTest
      atest WifiDppEnrolleeActivityTest
      atest WifiDppQrCodeGeneratorFragmentTest
      atest WifiDppQrCodeScannerFragmentTest
      atest WifiNetworkListFragmentTest
      atest WifiDppChooseSavedWifiNetworkFragmentTest

Change-Id: Id130215e9ddafac8bc4c68238deda48ce99b4255
This commit is contained in:
Arc Wang
2019-02-13 20:11:25 +08:00
parent 0acd013f03
commit 7bdcadbe72
12 changed files with 529 additions and 174 deletions

View File

@@ -74,6 +74,16 @@ public class WifiDppUtils {
* indicate test mode UI should be shown. Test UI does not make API calls. Value is a boolean.*/
public static final String EXTRA_TEST = "test";
/**
* Default status code for Easy Connect
*/
public static final int EASY_CONNECT_EVENT_FAILURE_NONE = 0;
/**
* Success status code for Easy Connect.
*/
public static final int EASY_CONNECT_EVENT_SUCCESS = 1;
/**
* Returns whether the device support WiFi DPP.
*/