diff --git a/resource/config.json b/resource/config.json index b2b7a48f5b..ca9b20bc55 100644 --- a/resource/config.json +++ b/resource/config.json @@ -40,7 +40,8 @@ "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p", + "screencap": "[Adb] -s [Address] exec-out \"screencap | gzip -1\"", + "screencapGzip": true, "release": "[Adb] kill-server" } }, @@ -61,7 +62,7 @@ "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] shell screencap | gzip -1", + "screencap": "[Adb] -s [Address] exec-out \"screencap | gzip -1\"", "screencapGzip": true, "release": "[Adb] kill-server" } @@ -83,7 +84,8 @@ "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p", + "screencap": "[Adb] -s [Address] exec-out \"screencap | gzip -1\"", + "screencapGzip": true, "release": "[Adb] kill-server" } }, @@ -105,7 +107,8 @@ "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] shell screencap -p", + "screencap": "[Adb] -s [Address] shell \"screencap | gzip -1\"", + "screencapGzip": true, "release": "[Adb] kill-server" } }, @@ -127,7 +130,8 @@ "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p", + "screencap": "[Adb] -s [Address] exec-out \"screencap | gzip -1\"", + "screencapGzip": true, "release": "[Adb] kill-server" } }, @@ -148,7 +152,8 @@ "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", "display": "[Adb] -s [Address] shell dumpsys window displays | grep init=", "displayFormat": " init=%dx%d", - "screencap": "[Adb] -s [Address] shell screencap -p", + "screencap": "[Adb] -s [Address] shell \"screencap | gzip -1\"", + "screencapGzip": true, "release": "[Adb] kill-server" } }, @@ -167,9 +172,10 @@ "connect": "[Adb] connect [Address]", "click": "[Adb] -s [Address] shell input tap [x] [y]", "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init=", + "displayFormat": " init=%dx%d", + "screencap": "[Adb] -s [Address] exec-out \"screencap | gzip -1\"", + "screencapGzip": true, "release": "[Adb] kill-server" } } diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index cddc0952c3..0ccbe99d83 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -578,12 +578,13 @@ bool asst::Controller::screencap() std::function&)> decode_func = nullptr; if (adb.screencap_gzip) { decode_func = [&](const std::vector& data) -> bool { - auto dst = gzip::decompress(data.data(), data.size()); - if (dst.empty()) { + auto unzip_data = gzip::decompress(data.data(), data.size()); + Log.trace("unzip data size:", unzip_data.size()); + if (unzip_data.empty()) { return false; } constexpr static int BmpHeaderSize = 12; - m_cache_image = cv::Mat(adb.display_height, adb.display_width, CV_8UC4, dst.data() + BmpHeaderSize); + m_cache_image = cv::Mat(adb.display_height, adb.display_width, CV_8UC4, unzip_data.data() + BmpHeaderSize); cv::cvtColor(m_cache_image, m_cache_image, cv::COLOR_RGB2BGR); return !m_cache_image.empty(); };