Socket
Socket
Sign inDemoInstall

appium-adb

Package Overview
Dependencies
238
Maintainers
7
Versions
417
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 11.0.9 to 11.1.0

16

build/lib/tools/settings-client-commands.d.ts

@@ -65,2 +65,12 @@ export default commands;

/**
* If the io.appium.settings package has running foreground service.
* It returns the io.appium.settings's process existence for api level 25 and lower
* since it does not have the foreground service.
*
* @this {import('../adb.js').ADB}
* @throws {Error} If the method gets an error in the adb shell execution.
* @returns {Promise<boolean>} Return true if the device has running settings app foreground service.
*/
function isSettingsAppServiceRunningInForeground(this: import("../adb.js").ADB): Promise<boolean>;
/**
* @typedef {Object} SettingsAppStartupOptions

@@ -74,4 +84,8 @@ * @property {number} [timeout=5000] The maximum number of milliseconds

* Ensures that Appium Settings helper application is running
* and starts it if necessary
* and starts it if necessary.
*
* The settings app process could keep working by 'android.service.notification.NotificationListenerService cmp=io.appium.settings/.NLService'
* while the app process was killed, or forcefully stopped, or the app was just installed.
* In the case, the io.appium.settings process exists but the foreground service hasn't been started yet.
*
* @this {import('../adb.js').ADB}

@@ -78,0 +92,0 @@ * @param {SettingsAppStartupOptions} [opts={}]

@@ -44,4 +44,25 @@ "use strict";

const GPS_COORDINATES_PATTERN = /data="(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)"/;
const FOREGROUND_APP_KEYWORD = 'isForeground=true';
const commands = {};
/**
* If the io.appium.settings package has running foreground service.
* It returns the io.appium.settings's process existence for api level 25 and lower
* since it does not have the foreground service.
*
* @this {import('../adb.js').ADB}
* @throws {Error} If the method gets an error in the adb shell execution.
* @returns {Promise<boolean>} Return true if the device has running settings app foreground service.
*/
commands.isSettingsAppServiceRunningInForeground = async function isSettingsAppServiceRunningInForeground() {
if (await this.getApiLevel() < 26) {
return await this.processExists(SETTINGS_HELPER_ID);
}
// The foreground service is available since api level 26,
// thus this method works only for api level 26+.
// 'dumpsys activity services <package>' had slightly better performance
// than 'dumpsys activity services' and parsing the foreground apps.
const output = await this.shell(['dumpsys', 'activity', 'services', SETTINGS_HELPER_ID]);
return output.includes(FOREGROUND_APP_KEYWORD);
};
/**
* @typedef {Object} SettingsAppStartupOptions

@@ -55,4 +76,8 @@ * @property {number} [timeout=5000] The maximum number of milliseconds

* Ensures that Appium Settings helper application is running
* and starts it if necessary
* and starts it if necessary.
*
* The settings app process could keep working by 'android.service.notification.NotificationListenerService cmp=io.appium.settings/.NLService'
* while the app process was killed, or forcefully stopped, or the app was just installed.
* In the case, the io.appium.settings process exists but the foreground service hasn't been started yet.
*
* @this {import('../adb.js').ADB}

@@ -64,3 +89,3 @@ * @param {SettingsAppStartupOptions} [opts={}]

commands.requireRunningSettingsApp = async function requireRunningSettingsApp(opts = {}) {
if (await this.processExists(SETTINGS_HELPER_ID)) {
if (await this.isSettingsAppServiceRunningInForeground()) {
return this;

@@ -88,3 +113,3 @@ }

try {
await (0, asyncbox_1.waitForCondition)(async () => await this.processExists(SETTINGS_HELPER_ID), {
await (0, asyncbox_1.waitForCondition)(async () => await this.isSettingsAppServiceRunningInForeground(), {
waitMs: timeout,

@@ -91,0 +116,0 @@ intervalMs: 300,

@@ -0,1 +1,8 @@

## [11.1.0](https://github.com/appium/appium-adb/compare/v11.0.9...v11.1.0) (2024-01-09)
### Features
* add isSettingsAppServiceRunningInForeground to check the settings' service existence better ([#715](https://github.com/appium/appium-adb/issues/715)) ([be0502e](https://github.com/appium/appium-adb/commit/be0502e28a15916bd4bcb079d569aa7b7d5803fe))
## [11.0.9](https://github.com/appium/appium-adb/compare/v11.0.8...v11.0.9) (2023-12-27)

@@ -2,0 +9,0 @@

@@ -42,5 +42,30 @@ import log from '../logger.js';

const FOREGROUND_APP_KEYWORD = 'isForeground=true';
const commands = {};
/**
* If the io.appium.settings package has running foreground service.
* It returns the io.appium.settings's process existence for api level 25 and lower
* since it does not have the foreground service.
*
* @this {import('../adb.js').ADB}
* @throws {Error} If the method gets an error in the adb shell execution.
* @returns {Promise<boolean>} Return true if the device has running settings app foreground service.
*/
commands.isSettingsAppServiceRunningInForeground = async function isSettingsAppServiceRunningInForeground () {
if (await this.getApiLevel() < 26) {
return await this.processExists(SETTINGS_HELPER_ID);
}
// The foreground service is available since api level 26,
// thus this method works only for api level 26+.
// 'dumpsys activity services <package>' had slightly better performance
// than 'dumpsys activity services' and parsing the foreground apps.
const output = await this.shell(['dumpsys', 'activity', 'services', SETTINGS_HELPER_ID]);
return output.includes(FOREGROUND_APP_KEYWORD);
};
/**
* @typedef {Object} SettingsAppStartupOptions

@@ -55,4 +80,8 @@ * @property {number} [timeout=5000] The maximum number of milliseconds

* Ensures that Appium Settings helper application is running
* and starts it if necessary
* and starts it if necessary.
*
* The settings app process could keep working by 'android.service.notification.NotificationListenerService cmp=io.appium.settings/.NLService'
* while the app process was killed, or forcefully stopped, or the app was just installed.
* In the case, the io.appium.settings process exists but the foreground service hasn't been started yet.
*
* @this {import('../adb.js').ADB}

@@ -64,3 +93,3 @@ * @param {SettingsAppStartupOptions} [opts={}]

commands.requireRunningSettingsApp = async function requireRunningSettingsApp (opts = {}) {
if (await this.processExists(SETTINGS_HELPER_ID)) {
if (await this.isSettingsAppServiceRunningInForeground()) {
return this;

@@ -91,3 +120,3 @@ }

try {
await waitForCondition(async () => await this.processExists(SETTINGS_HELPER_ID), {
await waitForCondition(async () => await this.isSettingsAppServiceRunningInForeground(), {
waitMs: timeout,

@@ -94,0 +123,0 @@ intervalMs: 300,

2

package.json
{
"name": "appium-adb",
"version": "11.0.9",
"version": "11.1.0",
"description": "Android Debug Bridge interface",

@@ -5,0 +5,0 @@ "main": "./build/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc