From fcfa0409e4f1d1caaaa226f9b7c288d1b983254d Mon Sep 17 00:00:00 2001 From: Barney Huang Date: Fri, 20 Jul 2018 03:27:12 -0700 Subject: [PATCH] fix null device reference Summary: Force device type from BaseDevice to AndroidDevice, because we need to access adb inside AndroidDevice. In long term, we should use DeviceShell from BaseDevice, but that need much more changes. Differential Revision: D8876082 fbshipit-source-id: 0772a0ac361c5e3eca9c7a590281ffa786501e15 --- src/device-plugins/cpu/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/device-plugins/cpu/index.js b/src/device-plugins/cpu/index.js index 4cf679852..fb809fd80 100644 --- a/src/device-plugins/cpu/index.js +++ b/src/device-plugins/cpu/index.js @@ -19,7 +19,9 @@ import { } from 'sonar'; type ADBClient = any; -type AndroidDevice = any; +type AndroidDevice = { + adb: ADBClient, +}; type TableRows = any; // we keep vairable name with underline for to physical path mappings on device @@ -102,7 +104,6 @@ export default class CPUFrequencyTable extends SonarDevicePlugin { adbClient: ADBClient; intervalID: ?IntervalID; - device: AndroidDevice; state = { cpuFreq: [], @@ -111,7 +112,8 @@ export default class CPUFrequencyTable extends SonarDevicePlugin { }; init() { - this.adbClient = this.device.adb; + let device = ((this.device: any): AndroidDevice); + this.adbClient = device.adb; // check how many cores we have on this device this.executeShell((output: string) => {