Improve Wi-Fi Easy Connect lock screen UI information

1. Change lock screen title and remove description
2. In QR code generator screen, change summary and show password under QR code picture

Bug: 128920152
Bug: 128576809
Test: manual test
Change-Id: Id096d7f417308df14ffe50c618644750aa991df8
This commit is contained in:
Arc Wang
2019-03-20 16:34:00 +08:00
parent 64df6a3073
commit abfd8ab726
8 changed files with 49 additions and 34 deletions

View File

@@ -768,14 +768,7 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
* 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());
}
/**

View File

@@ -21,6 +21,7 @@ import android.app.settings.SettingsEnums;
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;
@@ -29,6 +30,7 @@ import android.view.MenuItem;
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;
@@ -43,6 +45,7 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
private static final String TAG = "WifiDppQrCodeGeneratorFragment";
private ImageView mQrCodeView;
private TextView mPasswordView;
private String mQrCode;
@Override
@@ -138,12 +141,27 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
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();

View File

@@ -29,6 +29,8 @@ import android.os.Looper;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import com.android.settings.R;
import com.android.settingslib.wifi.AccessPoint;
import java.util.List;
@@ -273,13 +275,10 @@ public class WifiDppUtils {
* 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);
@@ -299,8 +298,7 @@ public class WifiDppUtils {
};
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);

View File

@@ -104,13 +104,7 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
}
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