Skip to content

Commit 80f482d

Browse files
chore: Switch to dumpsys usage if main app activity resolves to android/com.android.internal.app.ResolverActivity (#750)
1 parent 1b2b8fc commit 80f482d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/commands/app-management.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { APP_STATE } from '../android-helpers';
55
import { errors } from 'appium/driver';
66

77
const APP_EXTENSIONS = ['.apk', '.apks'];
8+
const RESOLVER_ACTIVITY_NAME = 'android/com.android.internal.app.ResolverActivity';
89

910
let commands = {};
1011

@@ -77,6 +78,16 @@ commands.activateApp = async function activateApp (appId) {
7778
return;
7879
}
7980

81+
let activityName = await this.adb.resolveLaunchableActivity(appId);
82+
if (activityName === RESOLVER_ACTIVITY_NAME) {
83+
// https://github.com/appium/appium/issues/17128
84+
this.log.debug(
85+
`The launchable activity name of '${appId}' was resolved to '${activityName}'. ` +
86+
`Switching the resolver to not use cmd`
87+
);
88+
activityName = await this.adb.resolveLaunchableActivity(appId, {preferCmd: false});
89+
}
90+
8091
const stdout = await this.adb.shell([
8192
'am', (apiLevel < 26) ? 'start' : 'start-activity',
8293
'-a', 'android.intent.action.MAIN',
@@ -85,7 +96,7 @@ commands.activateApp = async function activateApp (appId) {
8596
// https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_NEW_TASK
8697
// https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
8798
'-f', '0x10200000',
88-
'-n', await this.adb.resolveLaunchableActivity(appId),
99+
'-n', activityName,
89100
]);
90101
this.log.debug(stdout);
91102
if (/^error:/mi.test(stdout)) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
],
3737
"dependencies": {
3838
"@babel/runtime": "^7.0.0",
39-
"appium-adb": "^9.6.0",
39+
"appium-adb": "^9.9.0",
4040
"appium-chromedriver": "^5.0.1",
4141
"asyncbox": "^2.8.0",
4242
"axios": "^0.x",

0 commit comments

Comments
 (0)