Skip to content

Commit 5c59c10

Browse files
feat: Add 'mobile: deviceidle' extension (#673)
1 parent 65c62e5 commit 5c59c10

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,19 @@ Starts Android logcat broadcast websocket on the same host and port where Appium
381381

382382
Stops the previously started logcat broadcasting websocket server. This method will return immediately if no server is running. Read [Using Mobile Execution Commands to Continuously Stream Device Logs with Appium](https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium) for more details.
383383

384+
### mobile: deviceidle
385+
386+
This is a wrapper to 'adb shell dumpsys deviceidle' interface.
387+
Read [Diving Into Android 'M' Doze](https://www.protechtraining.com/blog/post/diving-into-android-m-doze-875) for more details.
388+
This API only exists since Android 6.
389+
390+
#### Arguments
391+
392+
Name | Type | Required | Description | Example
393+
--- | --- | --- | --- | ---
394+
action | whitelistAdd or whitelistRemove | yes | The name of the action to perform | whitelistAdd
395+
packages | string or string[] | yes | One or more package names to perfom the above action on | 'com.mycompany'
396+
384397
### mobile: acceptAlert
385398

386399
Tries to accept an Android alert. This method might not always be reliable as there is no single standard for how Android alerts should look like within the Accessibility representation.

lib/execute-method-map.ts

+8
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ export const executeMethodMap = {
112112
command: 'mobileStopLogsBroadcast',
113113
},
114114

115+
'mobile: deviceidle': {
116+
command: 'mobileDeviceidle',
117+
params: {
118+
required: ['action'],
119+
optional: ['packages'],
120+
},
121+
},
122+
115123
'mobile: acceptAlert': {
116124
command: 'mobileAcceptAlert',
117125
params: {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
},
6464
"dependencies": {
6565
"appium-adb": "^9.14.12",
66-
"appium-android-driver": "^7.0.1",
66+
"appium-android-driver": "^7.1.0",
6767
"appium-chromedriver": "^5.6.5",
6868
"appium-uiautomator2-server": "^5.12.2",
6969
"asyncbox": "^2.3.1",

0 commit comments

Comments
 (0)