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

Commit eb41cc4c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Uinput command: allow duplicate configuration entries for a type"

parents 78c33bb4 8177d7fa
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Arrays;
import java.util.stream.IntStream;


import src.com.android.commands.uinput.InputAbsInfo;
import src.com.android.commands.uinput.InputAbsInfo;


@@ -338,7 +339,7 @@ public class Event {
                mReader.beginArray();
                mReader.beginArray();
                while (mReader.hasNext()) {
                while (mReader.hasNext()) {
                    int type = 0;
                    int type = 0;
                    int[] data = null;
                    IntStream data = null;
                    mReader.beginObject();
                    mReader.beginObject();
                    while (mReader.hasNext()) {
                    while (mReader.hasNext()) {
                        String name = mReader.nextName();
                        String name = mReader.nextName();
@@ -347,8 +348,7 @@ public class Event {
                                type = readInt();
                                type = readInt();
                                break;
                                break;
                            case "data":
                            case "data":
                                data = readIntList().stream()
                                data = readIntList().stream().mapToInt(Integer::intValue);
                                            .mapToInt(Integer::intValue).toArray();
                                break;
                                break;
                            default:
                            default:
                                consumeRemainingElements();
                                consumeRemainingElements();
@@ -359,7 +359,9 @@ public class Event {
                    }
                    }
                    mReader.endObject();
                    mReader.endObject();
                    if (data != null) {
                    if (data != null) {
                        configuration.put(type, data);
                        final int[] existing = configuration.get(type);
                        configuration.put(type, existing == null ? data.toArray()
                                : IntStream.concat(IntStream.of(existing), data).toArray());
                    }
                    }
                }
                }
                mReader.endArray();
                mReader.endArray();