<string name="wifi_dpp_scan_qr_code">Scan QR code</string>
<!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_scan_qr_code_join_network">Join \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d by scanning a QR code</string>
+ <!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
+ <string name="wifi_dpp_scan_qr_code_join_unknown_network">Join Wi\u2011Fi by scanning a QR code</string>
<!-- Title for the fragment to share Wi-Fi [CHAR LIMIT=50] -->
<string name="wifi_dpp_share_wifi">Share Wi\u2011Fi</string>
<!-- Hint for the user to use another device to scan QR code on screen to join Wi-Fi [CHAR LIMIT=NONE] -->
scannerButton.setOnClickListener((View v) -> {
// Launch QR code scanner to join a network.
getContext().startActivity(
- WifiDppUtils.getConfiguratorQRCodeScannerIntent(/* ssid */ null));
+ WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
});
}
}
if (scannerButton != null) {
scannerButton.setVisibility(View.VISIBLE);
scannerButton.setOnClickListener((View v) -> {
+ String ssid = null;
+ if (mAccessPoint != null) {
+ ssid = mAccessPoint.getSsidStr();
+ }
// Launch QR code scanner to join a network.
getContext().startActivity(
- WifiDppUtils.getConfiguratorQRCodeScannerIntent(/* ssid */ null));
+ WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid));
});
}
}
mAddPreference.setButtonOnClickListener((View v) -> {
// Launch QR code scanner to join a network.
getContext().startActivity(
- WifiDppUtils.getConfiguratorQRCodeScannerIntent(/* ssid */ null));
+ WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
});
}
mStatusMessagePreference = (LinkablePreference) findPreference(PREF_KEY_STATUS_MESSAGE);
* Show QR code to share the network represented by this preference.
*/
public void launchQRCodeGenerator() {
- final Intent intent = new Intent(
- WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
- intent.putExtra(WifiDppUtils.EXTRA_WIFI_SECURITY,
+ Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntent(mAccessPoint.getSsidStr(),
mAccessPoint.getSecurityString(/* concise */ false));
- intent.putExtra(WifiDppUtils.EXTRA_WIFI_SSID, mAccessPoint.getSsidStr());
mContext.startActivity(intent);
}
* To provision "this" device with specified Wi-Fi network.
*
* To use intent action {@code ACTION_ENROLLEE_QR_CODE_SCANNER}, specify the SSID string of the
- * Wi-Fi network to be provisioned in {@code WifiDppUtils.EXTRA_QR_CODE}.
+ * Wi-Fi network to be provisioned in {@code WifiDppUtils.EXTRA_WIFI_SSID}.
*/
public class WifiDppEnrolleeActivity extends InstrumentedActivity {
private static final String TAG = "WifiDppEnrolleeActivity";
import com.android.settings.R;
/**
- * TODO: Should refine code to only initiate UI component in each child fragment.
+ * TODO: b/120645817 should refine code to only initiate UI component in each child fragment.
*/
/**
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
+import android.text.TextUtils;
import android.util.Size;
import android.view.Menu;
import android.view.MenuInflater;
setDescription(getString(R.string.wifi_dpp_center_qr_code, wifiNetworkConfig.getSsid()));
} else {
setTitle(getString(R.string.wifi_dpp_scan_qr_code));
- setDescription(getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid));
+
+ String description;
+ if (TextUtils.isEmpty(mSsid)) {
+ description = getString(R.string.wifi_dpp_scan_qr_code_join_unknown_network, mSsid);
+ } else {
+ description = getString(R.string.wifi_dpp_scan_qr_code_join_network, mSsid);
+ }
+ setDescription(description);
}
ActionBar actionBar = getActivity().getActionBar();
}
/**
- * Returns an intent to launch QR code scanner.
+ * Returns an intent to launch QR code scanner for Wi-Fi DPP enrollee.
*
* @param ssid The data corresponding to {@code WifiConfiguration} SSID
* @return Intent for launching QR code scanner
*/
- public static Intent getConfiguratorQRCodeScannerIntent(String ssid) {
+ public static Intent getEnrolleeQrCodeScannerIntent(String ssid) {
final Intent intent = new Intent(
- WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER);
+ WifiDppEnrolleeActivity.ACTION_ENROLLEE_QR_CODE_SCANNER);
if (!TextUtils.isEmpty(ssid)) {
intent.putExtra(EXTRA_WIFI_SSID, ssid);
}
* @param Security The data is from {@code AccessPoint.securityToString}
* @return Intent for launching QR code generator
*/
- public static Intent getConfiguratorQRCodeGeneratorIntent(String ssid, String Security) {
+ public static Intent getConfiguratorQrCodeGeneratorIntent(String ssid, String Security) {
+ //TODO: b/118794858#comment6 should put password & hideSsid in intent extra
final Intent intent = new Intent(
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
if (!TextUtils.isEmpty(ssid)) {