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

Commit 67d15955 authored by Marcel Bokhorst's avatar Marcel Bokhorst
Browse files

bluetooth: prevent Android restart with buggy devices

Change-Id: Ic15687b6870dcbe44e6bf54755174ed8aadffc9b
parent 7cef0fb0
Loading
Loading
Loading
Loading
+29 −8
Original line number Diff line number Diff line
@@ -58,16 +58,37 @@ class BluetoothDeviceProperties {
                }
                if (name.equals("UUIDs") || name.equals("Nodes")) {
                    StringBuilder str = new StringBuilder();
                    len = Integer.valueOf(properties[++i]);
                    i++;
                    if (i < properties.length) {
                        len = Integer.valueOf(properties[i]);
                        for (int j = 0; j < len; j++) {
                        str.append(properties[++i]);
                            i++;
                            if (i < properties.length) {
                                str.append(properties[i]);
                                str.append(",");
                            } else {
                                Log.e(TAG, "Error: Remote Device Property Value at index "
                                    + i + " is missing");
                                continue;
                            }
                        }
                        if (len > 0) {
                            newValue = str.toString();
                        }
                    } else {
                    newValue = properties[++i];
                        Log.e(TAG, "Error: Remote Device Property Value at index "
                            + i + " is missing");
                        continue;
                    }
                } else {
                    i++;
                    if (i < properties.length) {
                        newValue = properties[i];
                    } else {
                        Log.e(TAG, "Error: Remote Device Property Value at index "
                            + i + " is missing");
                        continue;
                    }
                }

                propertyValues.put(name, newValue);