mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-07-03 07:31:43 +00:00
fix: IndexOutOfBoundsException in displayInfoList
This commit is contained in:
parent
e6c92d55c1
commit
451ebee56f
2 changed files with 4 additions and 4 deletions
|
@ -7,7 +7,7 @@ android {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 11900
|
versionCode 11900
|
||||||
versionName "1.19-ws1"
|
versionName "1.19-ws2"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class WebSocketConnection extends Connection {
|
||||||
+ 4; // client id
|
+ 4; // client id
|
||||||
int additionalLength = 0;
|
int additionalLength = 0;
|
||||||
int[] displayIds = Device.getDisplayIds();
|
int[] displayIds = Device.getDisplayIds();
|
||||||
List<DisplayInfo> displayInfoList = new ArrayList<>();
|
HashMap<Integer, DisplayInfo> displayInfoHashMap = new HashMap<>();
|
||||||
HashMap<Integer, Integer> connectionsCount = new HashMap<>();
|
HashMap<Integer, Integer> connectionsCount = new HashMap<>();
|
||||||
HashMap<Integer, byte[]> displayInfoMap = new HashMap<>();
|
HashMap<Integer, byte[]> displayInfoMap = new HashMap<>();
|
||||||
HashMap<Integer, byte[]> videoSettingsBytesMap = new HashMap<>();
|
HashMap<Integer, byte[]> videoSettingsBytesMap = new HashMap<>();
|
||||||
|
@ -127,7 +127,7 @@ public class WebSocketConnection extends Connection {
|
||||||
|
|
||||||
for (int displayId : displayIds) {
|
for (int displayId : displayIds) {
|
||||||
DisplayInfo displayInfo = Device.getDisplayInfo(displayId);
|
DisplayInfo displayInfo = Device.getDisplayInfo(displayId);
|
||||||
displayInfoList.add(displayId, displayInfo);
|
displayInfoHashMap.put(displayId, displayInfo);
|
||||||
byte[] displayInfoBytes = displayInfo.toByteArray();
|
byte[] displayInfoBytes = displayInfo.toByteArray();
|
||||||
additionalLength += displayInfoBytes.length;
|
additionalLength += displayInfoBytes.length;
|
||||||
displayInfoMap.put(displayId, displayInfoBytes);
|
displayInfoMap.put(displayId, displayInfoBytes);
|
||||||
|
@ -163,7 +163,7 @@ public class WebSocketConnection extends Connection {
|
||||||
initialInfo.put(DEVICE_NAME_BYTES, 0, Math.min(DEVICE_NAME_FIELD_LENGTH - 1, DEVICE_NAME_BYTES.length));
|
initialInfo.put(DEVICE_NAME_BYTES, 0, Math.min(DEVICE_NAME_FIELD_LENGTH - 1, DEVICE_NAME_BYTES.length));
|
||||||
initialInfo.position(MAGIC_BYTES_INITIAL.length + DEVICE_NAME_FIELD_LENGTH);
|
initialInfo.position(MAGIC_BYTES_INITIAL.length + DEVICE_NAME_FIELD_LENGTH);
|
||||||
initialInfo.putInt(displayIds.length);
|
initialInfo.putInt(displayIds.length);
|
||||||
for (DisplayInfo displayInfo : displayInfoList) {
|
for (DisplayInfo displayInfo : displayInfoHashMap.values()) {
|
||||||
int displayId = displayInfo.getDisplayId();
|
int displayId = displayInfo.getDisplayId();
|
||||||
if (displayInfoMap.containsKey(displayId)) {
|
if (displayInfoMap.containsKey(displayId)) {
|
||||||
initialInfo.put(displayInfoMap.get(displayId));
|
initialInfo.put(displayInfoMap.get(displayId));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue