Initial support for KaiOS device plugins

Summary: Introduces basic KaiOSDevice class. Since kaios phones support adb, it is inherited from AndroidDevice

Reviewed By: jknoxville

Differential Revision: D17608605

fbshipit-source-id: 6b2c5834a1f5862b864c8e76202d0d401e58cbcc
This commit is contained in:
Alexander Putilin
2019-09-27 06:09:40 -07:00
committed by Facebook Github Bot
parent 1c9fc75457
commit dda800c4a3
2 changed files with 25 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import AndroidDevice from './AndroidDevice';
export default class KaiOSDevice extends AndroidDevice {
async screenCaptureAvailable() {
// The default way of capturing screenshots through adb does not seem to work
// There is a way of getting a screenshot through KaiOS dev tools though
return false;
}
}

View File

@@ -6,6 +6,7 @@
*/
import AndroidDevice from '../devices/AndroidDevice';
import KaiOSDevice from '../devices/KaiOSDevice';
import child_process from 'child_process';
import {Store} from '../reducers/index';
import BaseDevice from '../devices/BaseDevice';
@@ -33,11 +34,16 @@ function createDevice(
if (type === 'emulator') {
name = (await getRunningEmulatorName(device.id)) || name;
}
const androidDevice = new AndroidDevice(device.id, type, name, adbClient);
const isKaiOSDevice = Object.keys(props).some(
name => name.startsWith('kaios') || name.startsWith('ro.kaios'),
);
const androidLikeDevice = new (isKaiOSDevice
? KaiOSDevice
: AndroidDevice)(device.id, type, name, adbClient);
if (ports) {
androidDevice.reverse([ports.secure, ports.insecure]);
androidLikeDevice.reverse([ports.secure, ports.insecure]);
}
resolve(androidDevice);
resolve(androidLikeDevice);
});
});
}