in src/util/adb.js [104:133]
async discoverInstalledFirefoxAPKs(deviceId, firefoxApk) {
const userId = await this.getCurrentUser(deviceId);
log.debug(`Listing installed Firefox APKs on ${deviceId}`);
const pmList = await this.runShellCommand(deviceId, [
'pm',
'list',
'packages',
'--user',
`${userId}`,
]);
return pmList
.split('\n')
.map((line) => line.replace('package:', '').trim())
.filter((line) => {
// Look for an exact match if firefoxApk is defined.
if (firefoxApk) {
return line === firefoxApk;
}
// Match any package name that starts with the package name of a Firefox for Android browser.
for (const browser of packageIdentifiers) {
if (line.startsWith(browser)) {
return true;
}
}
return false;
});
}