android:id="@+id/error_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
android:textAlignment="center"
- android:layout_marginTop="8dp"
- android:visibility="invisible"
- android:textColor="?android:attr/colorError"/>
+ android:textColor="?android:attr/colorError"
+ android:visibility="invisible"/>
</LinearLayout>
android:layout_height="@dimen/qrcode_size"
android:src="@android:color/transparent"/>
+ <TextView
+ android:id="@+id/password"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:textAlignment="center"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</ScrollView>
android:id="@+id/error_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
android:textAlignment="center"
- android:layout_marginTop="8dp"
- android:visibility="invisible"
- android:textColor="?android:attr/colorError"/>
+ android:textColor="?android:attr/colorError"
+ android:visibility="invisible"/>
</LinearLayout>
<!-- 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] -->
- <string name="wifi_dpp_scan_qr_code_with_another_device">Scan this QR code with another device to join \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
+ <string name="wifi_dpp_scan_qr_code_with_another_device">Scan this QR code to connect to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d and share the password</string>
+ <!-- Hint for the user to use another device to scan QR code on screen to join a open Wi-Fi [CHAR LIMIT=NONE] -->
+ <string name="wifi_dpp_scan_open_network_qr_code_with_another_device">Scan this QR code to connect to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
<!-- Hint for QR code detection [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_could_not_detect_valid_qr_code">Couldn\u2019t read QR code. Re-center code and try again</string>
<!-- Hint for Wi-Fi DPP handshake failure [CHAR LIMIT=NONE] -->
<string name="wifi_dpp_connecting">Connecting\u2026</string>
<!-- Title for the fragment to show that the QR code is for sharing Wi-Fi hotspot network [CHAR LIMIT=50] -->
<string name="wifi_dpp_share_hotspot">Share hotspot</string>
- <!-- Hint for the user to share Wi-Fi hotspot network [CHAR LIMIT=NONE] -->
- <string name="wifi_dpp_scan_qr_code_to_share_hotspot">Scan this QR code with another device to join hotspot \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
+ <!-- Title for Wi-Fi DPP lockscreen title [CHAR LIMIT=50] -->
+ <string name="wifi_dpp_lockscreen_title">Verify it\u0027s you</string>
+ <!-- Hint for Wi-Fi password [CHAR LIMIT=50] -->
+ <string name="wifi_dpp_wifi_password">Wi\u2011Fi password: <xliff:g id="password" example="my password">%1$s</xliff:g></string>
+ <!-- Hint for Wi-Fi hotspot password [CHAR LIMIT=50] -->
+ <string name="wifi_dpp_hotspot_password">Hotspot password: <xliff:g id="password" example="my password">%1$s</xliff:g></string>
<!-- Label for the try again button [CHAR LIMIT=20]-->
<string name="retry">Retry</string>
<!-- Label for the check box to share a network with other users on the same device -->
<string name="lockpassword_choose_your_pattern_header_for_face">To use face authentication, set pattern</string>
<!-- Header on first screen of choose password/PIN as backup for face authentication flow. If this string cannot be translated in under 40 characters, please translate "Set face authentication backup" [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_pin_header_for_face">To use face authentication, set PIN</string>
- <!-- Message on Wi-Fi Sharing screen [CHAR LIMIT=NONE] -->
- <string name="wifi_sharing_message">Your Wi\u2011Fi name and password for \"<xliff:g id="SSID" example="GoogleGuest">%1$s</xliff:g>\" will be shared.</string>
<!-- Message to be used to explain the user that he needs to enter his pattern to continue a
particular operation. [CHAR LIMIT=70]-->
* Share the wifi network with QR code.
*/
private void shareNetwork() {
- final String title = mContext.getString(
- R.string.lockpassword_confirm_your_pattern_header);
- final String description = String.format(
- mContext.getString(R.string.wifi_sharing_message),
- mAccessPoint.getSsidStr());
-
- WifiDppUtils.showLockScreen(mContext, title, description,
- () -> launchWifiDppConfiguratorActivity());
+ WifiDppUtils.showLockScreen(mContext, () -> launchWifiDppConfiguratorActivity());
}
/**
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
+import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
+import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.wifi.qrcode.QrCodeGenerator;
private static final String TAG = "WifiDppQrCodeGeneratorFragment";
private ImageView mQrCodeView;
+ private TextView mPasswordView;
private String mQrCode;
@Override
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
if (wifiNetworkConfig.isHotspot()) {
mTitle.setText(R.string.wifi_dpp_share_hotspot);
- mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_to_share_hotspot,
- wifiNetworkConfig.getSsid()));
} else {
mTitle.setText(R.string.wifi_dpp_share_wifi);
+ }
+
+ final String password = wifiNetworkConfig.getPreSharedKey();
+ mPasswordView = view.findViewById(R.id.password);
+ if (TextUtils.isEmpty(password)) {
+ mSummary.setText(getString(
+ R.string.wifi_dpp_scan_open_network_qr_code_with_another_device,
+ wifiNetworkConfig.getSsid()));
+
+ mPasswordView.setVisibility(View.GONE);
+ } else {
mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
wifiNetworkConfig.getSsid()));
+
+ if (wifiNetworkConfig.isHotspot()) {
+ mPasswordView.setText(getString(R.string.wifi_dpp_hotspot_password, password));
+ } else {
+ mPasswordView.setText(getString(R.string.wifi_dpp_wifi_password, password));
+ }
}
mQrCode = wifiNetworkConfig.getQrCode();
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
+import com.android.settings.R;
+
import com.android.settingslib.wifi.AccessPoint;
import java.util.List;
* user of the device.
*
* @param context The {@code Context} used to get {@code KeyguardManager} service
- * @param title The title on lock screen
- * @param description The description on lock screen
* @param successRunnable The {@code Runnable} which will be executed if the user does not setup
* device security or if lock screen is unlocked
*/
- public static void showLockScreen(Context context, String title, String description,
- Runnable successRunnable) {
+ public static void showLockScreen(Context context, Runnable successRunnable) {
final KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(
Context.KEYGUARD_SERVICE);
};
final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(context)
- .setTitle(title)
- .setDescription(description);
+ .setTitle(context.getText(R.string.wifi_dpp_lockscreen_title));
if (keyguardManager.isDeviceSecure()) {
builder.setDeviceCredentialAllowed(true);
}
private void shareHotspotNetwork(Intent intent) {
- final String title = mContext.getString(
- R.string.lockpassword_confirm_your_pattern_header);
- final String description = String.format(
- mContext.getString(R.string.wifi_sharing_message), mSSID);
-
- WifiDppUtils.showLockScreen(mContext, title, description,
- () -> mContext.startActivity(intent));
+ WifiDppUtils.showLockScreen(mContext, () -> mContext.startActivity(intent));
}
@VisibleForTesting