Hiroyuki Ikezoe
bdd6379e19
Bug 1469054 - Adapt device.js in the adbhelper addon into devtools. r=jdescottes
...
The diff;
--- /home/hiro/adbhelper/device.js 2018-07-19 06:18:41.613011481 +0900
+++ devtools/shared/adb/adb-device.js 2018-08-06 10:18:38.808496752 +0900
@@ -4,9 +4,7 @@
"use strict";
-const { ConnectionManager } =
- require("./devtools-require")("devtools/shared/client/connection-manager");
-const adb = require("./adb");
+const { ADB } = require("devtools/shared/adb/adb");
/**
* A Device instance is created and registered with the Devices module whenever
@@ -21,34 +19,18 @@ function Device(id) {
}
Device.prototype = {
- /**
- * DEPRECATED: This is specific to how we connect to Firefox OS. Use cases
- * that interact with other kinds of devices should likely use the more
- * general |forwardPort| method directly.
- */
- connect(remotePort) {
- let port = ConnectionManager.getFreeTCPPort();
- let local = "tcp:" + port;
- let remote = "localfilesystem:/data/local/debugger-socket";
- if (remotePort) {
- remote = "tcp:" + remotePort;
- }
- return adb.forwardPort(local, remote)
- .then(() => port);
- },
-
type: "adb",
- shell: adb.shell.bind(adb),
- forwardPort: adb.forwardPort.bind(adb),
- push: adb.push.bind(adb),
- pull: adb.pull.bind(adb),
- reboot: adb.reboot.bind(adb),
- rebootRecovery: adb.rebootRecovery.bind(adb),
- rebootBootloader: adb.rebootBootloader.bind(adb),
+ shell: ADB.shell.bind(ADB),
+ forwardPort: ADB.forwardPort.bind(ADB),
+ push: ADB.push.bind(ADB),
+ pull: ADB.pull.bind(ADB),
+ reboot: ADB.reboot.bind(ADB),
+ rebootRecovery: ADB.rebootRecovery.bind(ADB),
+ rebootBootloader: ADB.rebootBootloader.bind(ADB),
isRoot() {
- return adb.shell("id").then(stdout => {
+ return ADB.shell("id").then(stdout => {
if (stdout) {
let uid = stdout.match(/uid=(\d+)/)[1];
return uid == "0";
@@ -58,7 +40,7 @@ Device.prototype = {
},
summonRoot() {
- return adb.root();
+ return ADB.root();
},
getModel() {
MozReview-Commit-ID: FlbKPm6VDs5
--HG--
extra : rebase_source : 92a4d061963a1d261243fb6865cdeea283c8870d
2018-08-09 14:27:56 +09:00