Wi-Fi DPP code refine

1. call Activity#setResult only for RESULT_OK case
2. refine @VisibleForTesting usage
     remove redundant assignment otherwise = PRIVATE
     set all @VisibleForTesting annotated methods package scope
3. rename WifiQrCode#SECURITY_WPA to WifiQrCode#SECURITY_WPA_PSK

Bug: 120645817
Test: atest WifiQrCodeTest
      atest WifiDppConfiguratorActivityTest
      atest WifiDppEnrolleeActivityTest
      atest WifiDppQrCodeGeneratorFragmentTest
      atest WifiDppQrCodeScannerFragmentTest
      atest WifiNetworkListFragmentTest
      atest WifiDppChooseSavedWifiNetworkFragmentTest

Change-Id: Id5de7eadc73185716422fc0d197f82bdd025ce45
This commit is contained in:
Arc Wang
2019-01-25 14:12:03 +08:00
parent 4ab826ac5b
commit 8de242ada6
8 changed files with 23 additions and 30 deletions

View File

@@ -63,7 +63,11 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
mButtonRight.setText(R.string.done);
mButtonRight.setOnClickListener(v -> getActivity().finish());
mButtonRight.setOnClickListener(v -> {
final Activity activity = getActivity();
activity.setResult(Activity.RESULT_OK);
activity.finish();
});
}
@Override
@@ -138,10 +142,7 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
mButtonLeft = view.findViewById(R.id.button_left);
mButtonLeft.setText(R.string.cancel);
mButtonLeft.setOnClickListener(v -> {
getActivity().setResult(Activity.RESULT_CANCELED);
getActivity().finish();
});
mButtonLeft.setOnClickListener(v -> getActivity().finish());
mButtonRight = view.findViewById(R.id.button_right);
mButtonRight.setText(R.string.wifi_dpp_share_wifi);