| 943 | } |
| 944 | |
| 945 | private ArrayList<String> getGameControllers() { |
| 946 | ArrayList<String> gameControllerDeviceIds = new ArrayList<>(); |
| 947 | int[] deviceIds = InputDevice.getDeviceIds(); |
| 948 | for (int deviceId : deviceIds) { |
| 949 | InputDevice dev = InputDevice.getDevice(deviceId); |
| 950 | int sources = dev.getSources(); |
| 951 | String devNameId = dev.getName() + "[" + deviceId + "]"; |
| 952 | |
| 953 | // Verify that the device has gamepad buttons, control sticks, or both. |
| 954 | if (((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) |
| 955 | || ((sources & InputDevice.SOURCE_JOYSTICK) |
| 956 | == InputDevice.SOURCE_JOYSTICK)) { |
| 957 | // This device is a game controller. Store its device ID. |
| 958 | if (!gameControllerDeviceIds.contains(devNameId)) { |
| 959 | gameControllerDeviceIds.add(devNameId); |
| 960 | } |
| 961 | } |
| 962 | } |
| 963 | return gameControllerDeviceIds; |
| 964 | } |
| 965 | |
| 966 | public final String getAndroidOSName() { |
| 967 | final String codename; |