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

Commit 825c4d82 authored by Balraj Selvaraj's avatar Balraj Selvaraj Committed by Linux Build Service Account
Browse files

Bluetooth: GAP: Rejecting the empty string in Bluetooth rename

Fix for rejecting the empty string in bluetooth
rename dialogue as part of DONE button as well as
trimming the empty string at head and tail end of
the valid string as part of both rename tab and
DONE button.

CRs-Fixed: 910174
Change-Id: I0b7472ad7777ff0b0b7e197f3c6b822e0afbb0d4
parent dd595f0d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ public final class BluetoothNameDialogFragment extends DialogFragment implements
                .setPositiveButton(R.string.bluetooth_rename_button,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                String deviceName = mDeviceNameView.getText().toString();
                                String deviceName = mDeviceNameView.getText().toString().trim();
                                setDeviceName(deviceName);
                            }
                        })
@@ -137,7 +137,11 @@ public final class BluetoothNameDialogFragment extends DialogFragment implements
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    setDeviceName(v.getText().toString());
                    // Rejecting Empty String
                    if (v.length() != 0 && !(v.getText().toString().trim().isEmpty()))
                    {
                        setDeviceName(v.getText().toString().trim());
                    }
                    mAlertDialog.dismiss();
                    return true;    // action handled
                } else {