Add architecture and sdk version information

Summary: This diff adds abilist and sdk version information in the AndroidDevice.

Reviewed By: mweststrate

Differential Revision: D22210225

fbshipit-source-id: cda3dea9d89fdaa62a08aa000c93e39177c67bdd
This commit is contained in:
Pritesh Nandgaonkar
2020-06-25 04:24:03 -07:00
committed by Facebook GitHub Bot
parent ca64e2455a
commit dafe493930
2 changed files with 17 additions and 1 deletions

View File

@@ -21,10 +21,14 @@ export default class AndroidDevice extends BaseDevice {
deviceType: DeviceType, deviceType: DeviceType,
title: string, title: string,
adb: ADBClient, adb: ADBClient,
abiList: Array<string>,
sdkVersion: string,
) { ) {
super(serial, deviceType, title, 'Android'); super(serial, deviceType, title, 'Android');
this.adb = adb; this.adb = adb;
this.icon = 'icons/android.svg'; this.icon = 'icons/android.svg';
this.abiList = abiList;
this.sdkVersion = sdkVersion;
this.adb.openLogcat(this.serial).then((reader) => { this.adb.openLogcat(this.serial).then((reader) => {
reader.on('entry', (entry) => { reader.on('entry', (entry) => {
let type: LogLevel = 'unknown'; let type: LogLevel = 'unknown';
@@ -60,6 +64,8 @@ export default class AndroidDevice extends BaseDevice {
} }
adb: ADBClient; adb: ADBClient;
abiList: Array<string> = [];
sdkVersion: string | undefined = undefined;
pidAppMapping: {[key: number]: string} = {}; pidAppMapping: {[key: number]: string} = {};
private recordingProcess?: Promise<string>; private recordingProcess?: Promise<string>;

View File

@@ -36,6 +36,9 @@ function createDevice(
.then(async (props) => { .then(async (props) => {
try { try {
let name = props['ro.product.model']; let name = props['ro.product.model'];
const abiString = props['ro.product.cpu.abilist'];
const sdkVersion = props['ro.build.version.sdk'];
const abiList = abiString.length > 0 ? abiString.split(',') : [];
if (type === 'emulator') { if (type === 'emulator') {
name = (await getRunningEmulatorName(device.id)) || name; name = (await getRunningEmulatorName(device.id)) || name;
} }
@@ -44,7 +47,14 @@ function createDevice(
); );
const androidLikeDevice = new (isKaiOSDevice const androidLikeDevice = new (isKaiOSDevice
? KaiOSDevice ? KaiOSDevice
: AndroidDevice)(device.id, type, name, adbClient); : AndroidDevice)(
device.id,
type,
name,
adbClient,
abiList,
sdkVersion,
);
if (ports) { if (ports) {
await androidLikeDevice await androidLikeDevice
.reverse([ports.secure, ports.insecure]) .reverse([ports.secure, ports.insecure])