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

am: ab3fed9b69

Change-Id: Ifb497131b4bab035840e23b14987eb40f7088810
This commit is contained in:
cosmohsieh
2019-04-12 14:55:23 -07:00
committed by android-build-merger
2 changed files with 6 additions and 1 deletions

View File

@@ -2243,6 +2243,8 @@
<string name="wifi_carrier_content">Connect via <xliff:g id="name">%1$s</xliff:g></string> <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> <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] --> <!-- 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_turnoff_message">To turn this off, go to Advanced in the overflow menu.</string>
<string name="wifi_scan_always_confirm_allow">Allow</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.net.wifi.WifiManager;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.text.TextUtils;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
@@ -132,7 +133,9 @@ public class WifiScanModeActivity extends FragmentActivity {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()) 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, .setPositiveButton(R.string.wifi_scan_always_confirm_allow,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {