@midscene/android 0.17.4-beta-20250528162713.0 → 0.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -160,8 +160,21 @@ ${Object.keys(size).filter((key) => size[key]).map(
160
160
  debugPage(`Using Physical size: ${physicalSize[1].trim()}`);
161
161
  size.physical = physicalSize[1].trim();
162
162
  }
163
+ let orientation = 0;
164
+ try {
165
+ const orientationStdout = await adb.shell(
166
+ "dumpsys input | grep SurfaceOrientation"
167
+ );
168
+ const orientationMatch = orientationStdout.match(
169
+ /SurfaceOrientation:\s*(\d)/
170
+ );
171
+ orientation = orientationMatch ? Number(orientationMatch[1]) : 0;
172
+ debugPage(`Screen orientation: ${orientation}`);
173
+ } catch (e) {
174
+ debugPage("Failed to get orientation, default to 0");
175
+ }
163
176
  if (size.override || size.physical) {
164
- return size;
177
+ return { ...size, orientation };
165
178
  }
166
179
  throw new Error(`Failed to get screen size, output: ${stdout}`);
167
180
  }
@@ -177,8 +190,9 @@ ${Object.keys(size).filter((key) => size[key]).map(
177
190
  if (!match || match.length < 3) {
178
191
  throw new Error(`Unable to parse screen size: ${screenSize}`);
179
192
  }
180
- const width = Number.parseInt(match[1], 10);
181
- const height = Number.parseInt(match[2], 10);
193
+ const isLandscape = screenSize.orientation === 1 || screenSize.orientation === 3;
194
+ const width = Number.parseInt(match[isLandscape ? 2 : 1], 10);
195
+ const height = Number.parseInt(match[isLandscape ? 1 : 2], 10);
182
196
  const densityNum = await adb.getScreenDensity();
183
197
  this.deviceRatio = Number(densityNum) / 160;
184
198
  const { x: logicalWidth, y: logicalHeight } = this.reverseAdjustCoordinates(
package/dist/lib/index.js CHANGED
@@ -200,8 +200,21 @@ ${Object.keys(size).filter((key) => size[key]).map(
200
200
  debugPage(`Using Physical size: ${physicalSize[1].trim()}`);
201
201
  size.physical = physicalSize[1].trim();
202
202
  }
203
+ let orientation = 0;
204
+ try {
205
+ const orientationStdout = await adb.shell(
206
+ "dumpsys input | grep SurfaceOrientation"
207
+ );
208
+ const orientationMatch = orientationStdout.match(
209
+ /SurfaceOrientation:\s*(\d)/
210
+ );
211
+ orientation = orientationMatch ? Number(orientationMatch[1]) : 0;
212
+ debugPage(`Screen orientation: ${orientation}`);
213
+ } catch (e) {
214
+ debugPage("Failed to get orientation, default to 0");
215
+ }
203
216
  if (size.override || size.physical) {
204
- return size;
217
+ return { ...size, orientation };
205
218
  }
206
219
  throw new Error(`Failed to get screen size, output: ${stdout}`);
207
220
  }
@@ -217,8 +230,9 @@ ${Object.keys(size).filter((key) => size[key]).map(
217
230
  if (!match || match.length < 3) {
218
231
  throw new Error(`Unable to parse screen size: ${screenSize}`);
219
232
  }
220
- const width = Number.parseInt(match[1], 10);
221
- const height = Number.parseInt(match[2], 10);
233
+ const isLandscape = screenSize.orientation === 1 || screenSize.orientation === 3;
234
+ const width = Number.parseInt(match[isLandscape ? 2 : 1], 10);
235
+ const height = Number.parseInt(match[isLandscape ? 1 : 2], 10);
222
236
  const densityNum = await adb.getScreenDensity();
223
237
  this.deviceRatio = Number(densityNum) / 160;
224
238
  const { x: logicalWidth, y: logicalHeight } = this.reverseAdjustCoordinates(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android",
3
- "version": "0.17.4-beta-20250528162713.0",
3
+ "version": "0.17.4",
4
4
  "description": "Android automation library for Midscene",
5
5
  "keywords": [
6
6
  "Android UI automation",
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "appium-adb": "12.12.1",
27
- "@midscene/shared": "0.17.4-beta-20250528162713.0",
28
- "@midscene/core": "0.17.4-beta-20250528162713.0",
29
- "@midscene/web": "0.17.4-beta-20250528162713.0"
27
+ "@midscene/shared": "0.17.4",
28
+ "@midscene/core": "0.17.4",
29
+ "@midscene/web": "0.17.4"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@modern-js/module-tools": "2.60.6",