Merge "Implement receiver flow of WiFi sharing feature II"
This commit is contained in:
committed by
Android (Google) Code Review
commit
c86fa1eb2a
@@ -2071,6 +2071,8 @@
|
|||||||
<string name="wifi_dpp_scan_qr_code">Scan QR code</string>
|
<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] -->
|
<!-- 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>
|
<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] -->
|
<!-- Title for the fragment to share Wi-Fi [CHAR LIMIT=50] -->
|
||||||
<string name="wifi_dpp_share_wifi">Share Wi\u2011Fi</string>
|
<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] -->
|
<!-- Hint for the user to use another device to scan QR code on screen to join Wi-Fi [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -73,7 +73,7 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
|
|||||||
scannerButton.setOnClickListener((View v) -> {
|
scannerButton.setOnClickListener((View v) -> {
|
||||||
// Launch QR code scanner to join a network.
|
// Launch QR code scanner to join a network.
|
||||||
getContext().startActivity(
|
getContext().startActivity(
|
||||||
WifiDppUtils.getConfiguratorQRCodeScannerIntent(/* ssid */ null));
|
WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -86,9 +86,13 @@ public class WifiDialog extends AlertDialog implements WifiConfigUiBase,
|
|||||||
if (scannerButton != null) {
|
if (scannerButton != null) {
|
||||||
scannerButton.setVisibility(View.VISIBLE);
|
scannerButton.setVisibility(View.VISIBLE);
|
||||||
scannerButton.setOnClickListener((View v) -> {
|
scannerButton.setOnClickListener((View v) -> {
|
||||||
|
String ssid = null;
|
||||||
|
if (mAccessPoint != null) {
|
||||||
|
ssid = mAccessPoint.getSsidStr();
|
||||||
|
}
|
||||||
// Launch QR code scanner to join a network.
|
// Launch QR code scanner to join a network.
|
||||||
getContext().startActivity(
|
getContext().startActivity(
|
||||||
WifiDppUtils.getConfiguratorQRCodeScannerIntent(/* ssid */ null));
|
WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -244,7 +244,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
mAddPreference.setButtonOnClickListener((View v) -> {
|
mAddPreference.setButtonOnClickListener((View v) -> {
|
||||||
// Launch QR code scanner to join a network.
|
// Launch QR code scanner to join a network.
|
||||||
getContext().startActivity(
|
getContext().startActivity(
|
||||||
WifiDppUtils.getConfiguratorQRCodeScannerIntent(/* ssid */ null));
|
WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
mStatusMessagePreference = (LinkablePreference) findPreference(PREF_KEY_STATUS_MESSAGE);
|
mStatusMessagePreference = (LinkablePreference) findPreference(PREF_KEY_STATUS_MESSAGE);
|
||||||
|
@@ -549,11 +549,8 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
|||||||
* Show QR code to share the network represented by this preference.
|
* Show QR code to share the network represented by this preference.
|
||||||
*/
|
*/
|
||||||
public void launchQRCodeGenerator() {
|
public void launchQRCodeGenerator() {
|
||||||
final Intent intent = new Intent(
|
Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntent(mAccessPoint.getSsidStr(),
|
||||||
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
|
|
||||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SECURITY,
|
|
||||||
mAccessPoint.getSecurityString(/* concise */ false));
|
mAccessPoint.getSecurityString(/* concise */ false));
|
||||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SSID, mAccessPoint.getSsidStr());
|
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ import com.android.settings.R;
|
|||||||
* To provision "this" device with specified Wi-Fi network.
|
* 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
|
* 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 {
|
public class WifiDppEnrolleeActivity extends InstrumentedActivity {
|
||||||
private static final String TAG = "WifiDppEnrolleeActivity";
|
private static final String TAG = "WifiDppEnrolleeActivity";
|
||||||
|
@@ -34,7 +34,7 @@ import com.android.settings.wifi.qrcode.QrDecorateView;
|
|||||||
import com.android.settings.R;
|
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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -23,6 +23,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Size;
|
import android.util.Size;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -87,7 +88,14 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
setDescription(getString(R.string.wifi_dpp_center_qr_code, wifiNetworkConfig.getSsid()));
|
setDescription(getString(R.string.wifi_dpp_center_qr_code, wifiNetworkConfig.getSsid()));
|
||||||
} else {
|
} else {
|
||||||
setTitle(getString(R.string.wifi_dpp_scan_qr_code));
|
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();
|
ActionBar actionBar = getActivity().getActionBar();
|
||||||
|
@@ -88,14 +88,14 @@ public class WifiDppUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @param ssid The data corresponding to {@code WifiConfiguration} SSID
|
||||||
* @return Intent for launching QR code scanner
|
* @return Intent for launching QR code scanner
|
||||||
*/
|
*/
|
||||||
public static Intent getConfiguratorQRCodeScannerIntent(String ssid) {
|
public static Intent getEnrolleeQrCodeScannerIntent(String ssid) {
|
||||||
final Intent intent = new Intent(
|
final Intent intent = new Intent(
|
||||||
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER);
|
WifiDppEnrolleeActivity.ACTION_ENROLLEE_QR_CODE_SCANNER);
|
||||||
if (!TextUtils.isEmpty(ssid)) {
|
if (!TextUtils.isEmpty(ssid)) {
|
||||||
intent.putExtra(EXTRA_WIFI_SSID, ssid);
|
intent.putExtra(EXTRA_WIFI_SSID, ssid);
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,8 @@ public class WifiDppUtils {
|
|||||||
* @param Security The data is from {@code AccessPoint.securityToString}
|
* @param Security The data is from {@code AccessPoint.securityToString}
|
||||||
* @return Intent for launching QR code generator
|
* @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(
|
final Intent intent = new Intent(
|
||||||
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
|
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
|
||||||
if (!TextUtils.isEmpty(ssid)) {
|
if (!TextUtils.isEmpty(ssid)) {
|
||||||
|
Reference in New Issue
Block a user