Skip to content

Commit

Permalink
feat: Document the helper method to simulate the low-memory event (#714)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Jan 11, 2024
1 parent 62bacaf commit d9c9863
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,19 @@ The actual mode value. Supported values for different UI modes are:
- `night`: yes,no,auto,custom_schedule,custom_bedtime
- `car`: yes,no

### mobile: sendTrimMemory

Simulates the [onTrimMemory()](https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)) event for the given package, which allows to verify the app functinality under different RAM-related circumstances.
Read [Manage your app's memory](https://developer.android.com/topic/performance/memory) for more details.
Available since driver version 2.41

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
pkg | string | yes | The package name to send the `trimMemory` event to. | com.my.company
level | 'COMPLETE' or 'MODERATE' or 'BACKGROUND' or 'UI_HIDDEN' or 'RUNNING_CRITICAL' or 'RUNNING_LOW' or 'RUNNING_MODERATE' | yes | The actual memory trim level to simulate | RUNNING_CRITICAL


## Applications Management

Expand Down
8 changes: 8 additions & 0 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,14 @@ export const executeMethodMap = {
optional: ['opts'],
},
},

'mobile: sendTrimMemory': {
command: 'mobileSendTrimMemory',
params: {
optional: ['opts'],
}
},

} as const;

export type Uiautomator2ExecuteMethodMap = typeof executeMethodMap;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"dependencies": {
"appium-adb": "^11.0.1",
"appium-android-driver": "^7.6.1",
"appium-android-driver": "^7.7.0",
"appium-chromedriver": "^5.6.5",
"appium-uiautomator2-server": "^6.0.3",
"asyncbox": "^3.0.0",
Expand Down

0 comments on commit d9c9863

Please sign in to comment.