Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74d85949 authored by Sanket Padawe's avatar Sanket Padawe Committed by Android Git Automerger
Browse files

am e05f7143: Check for special char when renaming device for Wi-Fi direct.

* commit 'e05f7143':
  Check for special char when renaming device for Wi-Fi direct.
parents a6c8a0e6 e05f7143
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -206,6 +206,19 @@ public class WifiP2pSettings extends SettingsPreferenceFragment
            public void onClick(DialogInterface dialog, int which) {
                if (which == DialogInterface.BUTTON_POSITIVE) {
                    if (mWifiP2pManager != null) {
                        String name = mDeviceNameText.getText().toString();
                        if (name != null) {
                            for (int i = 0; i < name.length(); i++) {
                                char cur = name.charAt(i);
                                if(!Character.isDigit(cur) && !Character.isLetter(cur)
                                        && cur != '-' && cur != '_' && cur != ' ') {
                                    Toast.makeText(getActivity(),
                                            R.string.wifi_p2p_failed_rename_message,
                                            Toast.LENGTH_LONG).show();
                                    return;
                                }
                            }
                        }
                        mWifiP2pManager.setDeviceName(mChannel,
                                mDeviceNameText.getText().toString(),
                                new WifiP2pManager.ActionListener() {