Merge "Fix null App name in Wi-Fi scanning prompt dialog" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-12 21:27:37 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 1 deletions

View File

@@ -2237,6 +2237,8 @@
<string name="wifi_carrier_content">Connect via <xliff:g id="name">%1$s</xliff:g></string>
<string name="wifi_scan_always_turnon_message">To improve location accuracy and for other purposes, <xliff:g id="app_name">%1$s</xliff:g> wants to turn on network scanning, even when Wi-Fi is off.\n\nAllow this for all apps that want to scan?</string>
<!-- Message to inform user, an unknown app want to enable network scanning. [CHAR LIMIT=200] -->
<string name="wifi_scan_always_turn_on_message_unknown">To improve location accuracy and for other purposes, an unknown app wants to turn on network scanning, even when Wi\u2011Fi is off.\n\nAllow this for all apps that want to scan?</string>
<!-- Message informing the user how to turn off [CHAR LIMIT=200] -->
<string name="wifi_scan_always_turnoff_message">To turn this off, go to Advanced in the overflow menu.</string>
<string name="wifi_scan_always_confirm_allow">Allow</string>

View File

@@ -25,6 +25,7 @@ import android.content.pm.PackageManager;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
@@ -132,7 +133,9 @@ public class WifiScanModeActivity extends FragmentActivity {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity())
.setMessage(getString(R.string.wifi_scan_always_turnon_message, mApp))
.setMessage(TextUtils.isEmpty(mApp) ?
getString(R.string.wifi_scan_always_turn_on_message_unknown) :
getString(R.string.wifi_scan_always_turnon_message, mApp))
.setPositiveButton(R.string.wifi_scan_always_confirm_allow,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {