diff --git a/lib/helpers/android.ts b/lib/helpers/android.ts index 5aa4a10b..28572390 100644 --- a/lib/helpers/android.ts +++ b/lib/helpers/android.ts @@ -809,7 +809,7 @@ const AndroidHelpers: AndroidHelpers = { // Reinstall would stop the settings helper process anyway, so // there is no need to continue if the application is still running - if (await adb.processExists(SETTINGS_HELPER_PKG_ID)) { + if (await adb.isSettingsAppServiceRunningInForeground()) { logger.debug( `${SETTINGS_HELPER_PKG_ID} is already running. ` + `There is no need to reset its permissions.` diff --git a/package.json b/package.json index 17c76d5e..ca27fd1b 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "dependencies": { "@appium/support": "^4.2.0", "@colors/colors": "^1.6.0", - "appium-adb": "^11.0.1", + "appium-adb": "^11.1.0", "appium-chromedriver": "^5.5.1", "asyncbox": "^3.0.0", "axios": "^1.x", diff --git a/test/unit/android-helper-specs.js b/test/unit/android-helper-specs.js index 9ae1290d..00f79b8f 100644 --- a/test/unit/android-helper-specs.js +++ b/test/unit/android-helper-specs.js @@ -635,7 +635,7 @@ describe('Android Helpers', function () { withMocks({adb}, (mocks) => { it('should skip granting permissions if the app is already running on over API level 23+ devices', async function () { mocks.adb.expects('installOrUpgrade').once().returns(true); - mocks.adb.expects('processExists').withExactArgs('io.appium.settings').once().returns(true); + mocks.adb.expects('isSettingsAppServiceRunningInForeground').once().returns(true); mocks.adb.expects('getApiLevel').never(); mocks.adb.expects('grantPermissions').never(); await helpers.pushSettingsApp(adb); @@ -643,7 +643,7 @@ describe('Android Helpers', function () { }); it('should not skip granting permissions if the app is already running on under API level 22 devices', async function () { mocks.adb.expects('installOrUpgrade').once().returns(true); - mocks.adb.expects('processExists').once().returns(true); + mocks.adb.expects('isSettingsAppServiceRunningInForeground').once().returns(true); mocks.adb.expects('getApiLevel').never(); mocks.adb.expects('grantPermissions').never(); await helpers.pushSettingsApp(adb); @@ -651,7 +651,7 @@ describe('Android Helpers', function () { }); it('should launch settings app if it isnt running on over API level 24 devices', async function () { mocks.adb.expects('installOrUpgrade').once().returns(true); - mocks.adb.expects('processExists').once().returns(false); + mocks.adb.expects('isSettingsAppServiceRunningInForeground').once().returns(false); mocks.adb.expects('getApiLevel').once().returns(24); mocks.adb.expects('requireRunningSettingsApp').once(); await helpers.pushSettingsApp(adb); @@ -659,7 +659,7 @@ describe('Android Helpers', function () { }); it('should launch settings app if it isnt running on under API level 23 devices', async function () { mocks.adb.expects('installOrUpgrade').once().returns(true); - mocks.adb.expects('processExists').once().returns(false); + mocks.adb.expects('isSettingsAppServiceRunningInForeground').once().returns(false); mocks.adb.expects('getApiLevel').once().returns(23); mocks.adb .expects('grantPermissions')