Skip to content

Commit 89303f0

Browse files
feat: Add support of UiModeManager service commands (#691)
1 parent 9703a3d commit 89303f0

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,36 @@ A dictionary where each key is the diplay identifier and the value has the follo
14251425
- `isDefault`: Whether this display is the default one
14261426
- `payload`: The actual PNG screenshot data encoded to base64 string
14271427

1428+
### mobile: setUiMode
1429+
1430+
Set the device UI appearance. A thin wrapper over `adb shell cmd uimode` CLI.
1431+
Works on Android 10 and newer. Available since driver version 2.34
1432+
1433+
#### Arguments
1434+
1435+
Name | Type | Required | Description | Example
1436+
--- | --- | --- | --- | ---
1437+
mode | string | yes | One of the supported UI mode names: `night` or `car`. | night
1438+
value | string | yes | The actual mode value to set. Supported values for different UI modes are: `night`: yes,no,auto,custom_schedule,custom_bedtime, `car`: yes,no. For example, to switch the device UI to the dark mode you should set `mode` to `night` and `value` to `yes`, or to `no` in order to switch back to the light mode. | yes
1439+
1440+
### mobile: getUiMode
1441+
1442+
Gets the device UI appearance for the given mode. A thin wrapper over `adb shell cmd uimode` CLI. Works on Android 10 and newer. Available since driver version 2.34
1443+
1444+
#### Arguments
1445+
1446+
Name | Type | Required | Description | Example
1447+
--- | --- | --- | --- | ---
1448+
mode | string | yes | One of the supported UI mode names: `night` or `car`. | night
1449+
1450+
#### Returned Result
1451+
1452+
The actual mode value. Supported values for different UI modes are:
1453+
1454+
- `night`: yes,no,auto,custom_schedule,custom_bedtime
1455+
- `car`: yes,no
1456+
1457+
14281458
## Applications Management
14291459

14301460
UiAutomator2 driver supports Appium endpoints for applications management:

lib/execute-method-map.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -562,20 +562,31 @@ export const executeMethodMap = {
562562
optional: ['opts'],
563563
},
564564
},
565-
566565
'mobile: getActionHistory': {
567566
command: 'mobileGetActionHistory',
568567
params: {
569568
optional: ['opts'],
570569
},
571570
},
572-
573571
'mobile: unscheduleAction': {
574572
command: 'mobileUnscheduleAction',
575573
params: {
576574
optional: ['opts'],
577575
},
578576
},
577+
578+
'mobile: getUiMode': {
579+
command: 'mobileGetUiMode',
580+
params: {
581+
optional: ['opts'],
582+
},
583+
},
584+
'mobile: setUiMode': {
585+
command: 'mobileSetUiMode',
586+
params: {
587+
optional: ['opts'],
588+
},
589+
},
579590
} as const;
580591

581592
export type Uiautomator2ExecuteMethodMap = typeof executeMethodMap;

package.json

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

0 commit comments

Comments
 (0)