Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support of UiModeManager service commands #947

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,28 @@ component | string | no | The name of the tile component. It is only required fo

The actual downstream command output. It depends on the selected command and might be empty.

### mobile: setUiMode

Set the device UI appearance. A thin wrapper over `adb shell cmd uimode` CLI.
Works on Android 10 and newer. Available since driver version 2.29

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
mode | string | yes | One of the supported UI mode names: `night` or `car`. | night
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

### mobile: getUiMode

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.29

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
mode | string | yes | One of the supported UI mode names: `night` or `car`. | night


## Backdoor Extension Usage

Expand Down
3 changes: 3 additions & 0 deletions lib/commands/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ extensions.executeMobile = async function executeMobile (mobileCommand, opts = {
statusBar: 'mobilePerformStatusBarCommand',

screenshots: 'mobileScreenshots',

setUiMode: 'mobileSetUiMode',
getUiMode: 'mobileGetUiMode',
};

if (!_.has(mobileCommandsMapping, mobileCommand)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
],
"dependencies": {
"appium-adb": "^11.0.1",
"appium-android-driver": "^7.2.1",
"appium-android-driver": "^7.3.0",
"asyncbox": "^3.0.0",
"bluebird": "^3.5.0",
"lodash": "^4.17.11",
Expand Down