@yume-chan/adb 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +54 -0
- package/CHANGELOG.md +25 -1
- package/README.md +220 -103
- package/esm/adb.d.ts +43 -60
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +68 -249
- package/esm/adb.js.map +1 -1
- package/esm/banner.d.ts +17 -0
- package/esm/banner.d.ts.map +1 -0
- package/esm/banner.js +67 -0
- package/esm/banner.js.map +1 -0
- package/esm/commands/base.d.ts +6 -6
- package/esm/commands/base.d.ts.map +1 -1
- package/esm/commands/base.js +8 -8
- package/esm/commands/framebuffer.d.ts +53 -53
- package/esm/commands/framebuffer.d.ts.map +1 -1
- package/esm/commands/framebuffer.js +46 -46
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +7 -8
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +7 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/power.d.ts +22 -22
- package/esm/commands/power.js +48 -48
- package/esm/commands/reverse.d.ts +40 -28
- package/esm/commands/reverse.d.ts.map +1 -1
- package/esm/commands/reverse.js +130 -100
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/command.d.ts +57 -51
- package/esm/commands/subprocess/command.d.ts.map +1 -1
- package/esm/commands/subprocess/command.js +86 -80
- package/esm/commands/subprocess/command.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +3 -3
- package/esm/commands/subprocess/index.js +3 -3
- package/esm/commands/subprocess/protocols/index.d.ts +3 -3
- package/esm/commands/subprocess/protocols/index.js +3 -3
- package/esm/commands/subprocess/protocols/none.d.ts +30 -35
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/none.js +65 -55
- package/esm/commands/subprocess/protocols/none.js.map +1 -1
- package/esm/commands/subprocess/protocols/shell.d.ts +33 -38
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/shell.js +172 -162
- package/esm/commands/subprocess/protocols/shell.js.map +1 -1
- package/esm/commands/subprocess/protocols/types.d.ts +48 -49
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/types.js +1 -1
- package/esm/commands/subprocess/utils.d.ts +1 -1
- package/esm/commands/subprocess/utils.js +18 -18
- package/esm/commands/sync/index.d.ts +8 -7
- package/esm/commands/sync/index.d.ts.map +1 -1
- package/esm/commands/sync/index.js +8 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +42 -40
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +67 -47
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +13 -11
- package/esm/commands/sync/pull.d.ts.map +1 -1
- package/esm/commands/sync/pull.js +35 -37
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +57 -7
- package/esm/commands/sync/push.d.ts.map +1 -1
- package/esm/commands/sync/push.js +89 -22
- package/esm/commands/sync/push.js.map +1 -1
- package/esm/commands/sync/request.d.ts +26 -23
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +40 -42
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +19 -19
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +54 -54
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/socket.d.ts +22 -0
- package/esm/commands/sync/socket.d.ts.map +1 -0
- package/esm/commands/sync/socket.js +69 -0
- package/esm/commands/sync/socket.js.map +1 -0
- package/esm/commands/sync/stat.d.ts +72 -72
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +116 -104
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +65 -60
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +123 -149
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/commands/tcpip.d.ts +5 -5
- package/esm/commands/tcpip.d.ts.map +1 -1
- package/esm/commands/tcpip.js +20 -18
- package/esm/commands/tcpip.js.map +1 -1
- package/esm/{auth.d.ts → daemon/auth.d.ts} +50 -51
- package/esm/daemon/auth.d.ts.map +1 -0
- package/esm/{auth.js → daemon/auth.js} +95 -96
- package/esm/daemon/auth.js.map +1 -0
- package/esm/daemon/connection.d.ts +11 -0
- package/esm/daemon/connection.d.ts.map +1 -0
- package/esm/daemon/connection.js +2 -0
- package/esm/daemon/connection.js.map +1 -0
- package/esm/{crypto.d.ts → daemon/crypto.d.ts} +36 -36
- package/esm/daemon/crypto.d.ts.map +1 -0
- package/esm/{crypto.js → daemon/crypto.js} +244 -248
- package/esm/daemon/crypto.js.map +1 -0
- package/esm/daemon/device.d.ts +9 -0
- package/esm/daemon/device.d.ts.map +1 -0
- package/esm/daemon/device.js +2 -0
- package/esm/daemon/device.js.map +1 -0
- package/esm/daemon/dispatcher.d.ts +42 -0
- package/esm/daemon/dispatcher.d.ts.map +1 -0
- package/esm/{socket → daemon}/dispatcher.js +225 -234
- package/esm/daemon/dispatcher.js.map +1 -0
- package/esm/daemon/index.d.ts +8 -0
- package/esm/daemon/index.d.ts.map +1 -0
- package/esm/daemon/index.js +8 -0
- package/esm/daemon/index.js.map +1 -0
- package/esm/{packet.d.ts → daemon/packet.d.ts} +45 -46
- package/esm/daemon/packet.d.ts.map +1 -0
- package/esm/{packet.js → daemon/packet.js} +43 -48
- package/esm/daemon/packet.js.map +1 -0
- package/esm/daemon/socket.d.ts +58 -0
- package/esm/daemon/socket.d.ts.map +1 -0
- package/esm/{socket → daemon}/socket.js +121 -118
- package/esm/daemon/socket.js.map +1 -0
- package/esm/daemon/transport.d.ts +45 -0
- package/esm/daemon/transport.d.ts.map +1 -0
- package/esm/daemon/transport.js +184 -0
- package/esm/daemon/transport.js.map +1 -0
- package/esm/features.d.ts +10 -7
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +13 -10
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +7 -9
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +7 -9
- package/esm/index.js.map +1 -1
- package/esm/server/client.d.ts +78 -0
- package/esm/server/client.d.ts.map +1 -0
- package/esm/server/client.js +329 -0
- package/esm/server/client.js.map +1 -0
- package/esm/server/index.d.ts +3 -0
- package/esm/server/index.d.ts.map +1 -0
- package/esm/server/index.js +3 -0
- package/esm/server/index.js.map +1 -0
- package/esm/server/transport.d.ts +19 -0
- package/esm/server/transport.d.ts.map +1 -0
- package/esm/server/transport.js +44 -0
- package/esm/server/transport.js.map +1 -0
- package/esm/utils/auto-reset-event.d.ts +8 -9
- package/esm/utils/auto-reset-event.d.ts.map +1 -1
- package/esm/utils/auto-reset-event.js +33 -33
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +27 -27
- package/esm/utils/base64.js +246 -246
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/conditional-variable.d.ts +8 -0
- package/esm/utils/conditional-variable.d.ts.map +1 -0
- package/esm/utils/conditional-variable.js +34 -0
- package/esm/utils/conditional-variable.js.map +1 -0
- package/esm/utils/hex.d.ts +3 -0
- package/esm/utils/hex.d.ts.map +1 -0
- package/esm/utils/hex.js +55 -0
- package/esm/utils/hex.js.map +1 -0
- package/esm/utils/index.d.ts +6 -3
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +6 -3
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/no-op.d.ts +7 -0
- package/esm/utils/no-op.d.ts.map +1 -0
- package/esm/utils/no-op.js +12 -0
- package/esm/utils/no-op.js.map +1 -0
- package/package.json +14 -12
- package/src/adb.ts +47 -248
- package/src/banner.ts +82 -0
- package/src/commands/base.ts +1 -1
- package/src/commands/framebuffer.ts +4 -4
- package/src/commands/index.ts +7 -8
- package/src/commands/power.ts +2 -2
- package/src/commands/reverse.ts +90 -70
- package/src/commands/subprocess/command.ts +12 -4
- package/src/commands/subprocess/index.ts +3 -3
- package/src/commands/subprocess/protocols/index.ts +3 -3
- package/src/commands/subprocess/protocols/none.ts +36 -23
- package/src/commands/subprocess/protocols/shell.ts +94 -74
- package/src/commands/subprocess/protocols/types.ts +7 -7
- package/src/commands/subprocess/utils.ts +1 -1
- package/src/commands/sync/index.ts +8 -7
- package/src/commands/sync/list.ts +44 -25
- package/src/commands/sync/pull.ts +40 -45
- package/src/commands/sync/push.ts +158 -39
- package/src/commands/sync/request.ts +21 -16
- package/src/commands/sync/response.ts +10 -9
- package/src/commands/sync/socket.ts +99 -0
- package/src/commands/sync/stat.ts +47 -42
- package/src/commands/sync/sync.ts +73 -116
- package/src/commands/tcpip.ts +9 -7
- package/src/{auth.ts → daemon/auth.ts} +24 -23
- package/src/{crypto.ts → daemon/crypto.ts} +25 -33
- package/src/daemon/device.ts +14 -0
- package/src/{socket → daemon}/dispatcher.ts +95 -117
- package/src/daemon/index.ts +7 -0
- package/src/daemon/packet.ts +75 -0
- package/src/{socket → daemon}/socket.ts +71 -56
- package/src/daemon/transport.ts +269 -0
- package/src/features.ts +9 -6
- package/src/index.ts +3 -5
- package/src/server/client.ts +476 -0
- package/src/server/index.ts +2 -0
- package/src/server/transport.ts +77 -0
- package/src/utils/auto-reset-event.ts +14 -15
- package/src/utils/conditional-variable.ts +45 -0
- package/src/utils/hex.ts +58 -0
- package/src/utils/index.ts +6 -3
- package/src/utils/no-op.ts +12 -0
- package/tsconfig.build.json +12 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/auth.d.ts.map +0 -1
- package/esm/auth.js.map +0 -1
- package/esm/backend.d.ts +0 -9
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -2
- package/esm/backend.js.map +0 -1
- package/esm/commands/install.d.ts +0 -4
- package/esm/commands/install.d.ts.map +0 -1
- package/esm/commands/install.js +0 -29
- package/esm/commands/install.js.map +0 -1
- package/esm/crypto.d.ts.map +0 -1
- package/esm/crypto.js.map +0 -1
- package/esm/packet.d.ts.map +0 -1
- package/esm/packet.js.map +0 -1
- package/esm/socket/dispatcher.d.ts +0 -60
- package/esm/socket/dispatcher.d.ts.map +0 -1
- package/esm/socket/dispatcher.js.map +0 -1
- package/esm/socket/index.d.ts +0 -3
- package/esm/socket/index.d.ts.map +0 -1
- package/esm/socket/index.js +0 -3
- package/esm/socket/index.js.map +0 -1
- package/esm/socket/socket.d.ts +0 -60
- package/esm/socket/socket.d.ts.map +0 -1
- package/esm/socket/socket.js.map +0 -1
- package/src/backend.ts +0 -14
- package/src/commands/install.ts +0 -40
- package/src/packet.ts +0 -90
- package/src/socket/index.ts +0 -2
package/esm/utils/base64.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,WAAW,GAAa,EAAE,CAAC;AACjC,MAAM,WAAW,GAAa,EAAE,CAAC;AACjC,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAEtC,SAAS,QAAQ,CAAC,KAAa,EAAE,GAAW;IACxC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEtC,KAAK,IAAI,QAAQ,GAAG,aAAa,EAAE,QAAQ,IAAI,WAAW,EAAE,QAAQ,IAAI,CAAC,EAAE;QACvE,WAAW,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC;QAC3C,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAC9B;AACL,CAAC;AAED,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACnB,QAAQ,CAAC,GAAG,EAAE,GAAG,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ait(condition: () => boolean): Promise<void>;
|
|
5
|
+
notifyOne(): void;
|
|
6
|
+
dispose(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=conditional-variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-variable.d.ts","sourceRoot":"","sources":["../../src/utils/conditional-variable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAOnD,qBAAa,mBAAoB,YAAW,UAAU;;IAI3C,IAAI,CAAC,SAAS,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAa7C,SAAS;IAWT,OAAO,IAAI,IAAI;CAQzB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
+
export class ConditionalVariable {
|
|
3
|
+
#locked = false;
|
|
4
|
+
#queue = [];
|
|
5
|
+
wait(condition) {
|
|
6
|
+
if (!this.#locked) {
|
|
7
|
+
this.#locked = true;
|
|
8
|
+
if (this.#queue.length === 0 && condition()) {
|
|
9
|
+
return Promise.resolve();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const resolver = new PromiseResolver();
|
|
13
|
+
this.#queue.push({ condition, resolver });
|
|
14
|
+
return resolver.promise;
|
|
15
|
+
}
|
|
16
|
+
notifyOne() {
|
|
17
|
+
const entry = this.#queue.shift();
|
|
18
|
+
if (entry) {
|
|
19
|
+
if (entry.condition()) {
|
|
20
|
+
entry.resolver.resolve();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.#locked = false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
dispose() {
|
|
28
|
+
for (const item of this.#queue) {
|
|
29
|
+
item.resolver.reject(new Error("The ConditionalVariable has been disposed"));
|
|
30
|
+
}
|
|
31
|
+
this.#queue.length = 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=conditional-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-variable.js","sourceRoot":"","sources":["../../src/utils/conditional-variable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAQnD,MAAM,OAAO,mBAAmB;IAC5B,OAAO,GAAG,KAAK,CAAC;IACP,MAAM,GAAgB,EAAE,CAAC;IAE3B,IAAI,CAAC,SAAwB;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,EAAE,EAAE;gBACzC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;aAC5B;SACJ;QAED,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAQ,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1C,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC5B,CAAC;IAEM,SAAS;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClC,IAAI,KAAK,EAAE;YACP,IAAI,KAAK,CAAC,SAAS,EAAE,EAAE;gBACnB,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;aAC5B;SACJ;aAAM;YACH,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACxB;IACL,CAAC;IAEM,OAAO;QACV,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAChB,IAAI,KAAK,CAAC,2CAA2C,CAAC,CACzD,CAAC;SACL;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../src/utils/hex.ts"],"names":[],"mappings":"AA8BA,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAMpD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,cAmBxC"}
|
package/esm/utils/hex.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
function hexCharToNumber(char) {
|
|
2
|
+
if (char < 48) {
|
|
3
|
+
throw new Error(`Invalid hex char ${char}`);
|
|
4
|
+
}
|
|
5
|
+
if (char < 58) {
|
|
6
|
+
// 0-9
|
|
7
|
+
return char - 48;
|
|
8
|
+
}
|
|
9
|
+
if (char < 65) {
|
|
10
|
+
throw new Error(`Invalid hex char ${char}`);
|
|
11
|
+
}
|
|
12
|
+
if (char < 71) {
|
|
13
|
+
// A-F
|
|
14
|
+
return char - 55;
|
|
15
|
+
}
|
|
16
|
+
if (char < 97) {
|
|
17
|
+
throw new Error(`Invalid hex char ${char}`);
|
|
18
|
+
}
|
|
19
|
+
if (char < 103) {
|
|
20
|
+
// a-f
|
|
21
|
+
return char - 87;
|
|
22
|
+
}
|
|
23
|
+
throw new Error(`Invalid hex char ${char}`);
|
|
24
|
+
}
|
|
25
|
+
// It's 22x faster than converting `data` to string then `Number.parseInt`
|
|
26
|
+
// https://jsbench.me/dglha94ozl/1
|
|
27
|
+
export function hexToNumber(data) {
|
|
28
|
+
let result = 0;
|
|
29
|
+
for (let i = 0; i < data.length; i += 1) {
|
|
30
|
+
result = (result << 4) | hexCharToNumber(data[i]);
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
export function numberToHex(value) {
|
|
35
|
+
const result = new Uint8Array(4);
|
|
36
|
+
let index = 3;
|
|
37
|
+
while (index >= 0 && value > 0) {
|
|
38
|
+
const digit = value & 0xf;
|
|
39
|
+
value >>= 4;
|
|
40
|
+
if (digit < 10) {
|
|
41
|
+
result[index] = digit + 48;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
result[index] = digit + 87;
|
|
45
|
+
}
|
|
46
|
+
index -= 1;
|
|
47
|
+
}
|
|
48
|
+
while (index >= 0) {
|
|
49
|
+
// '0'
|
|
50
|
+
result[index] = 48;
|
|
51
|
+
index -= 1;
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=hex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.js","sourceRoot":"","sources":["../../src/utils/hex.ts"],"names":[],"mappings":"AAAA,SAAS,eAAe,CAAC,IAAY;IACjC,IAAI,IAAI,GAAG,EAAE,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;KAC/C;IACD,IAAI,IAAI,GAAG,EAAE,EAAE;QACX,MAAM;QACN,OAAO,IAAI,GAAG,EAAE,CAAC;KACpB;IAED,IAAI,IAAI,GAAG,EAAE,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;KAC/C;IACD,IAAI,IAAI,GAAG,EAAE,EAAE;QACX,MAAM;QACN,OAAO,IAAI,GAAG,EAAE,CAAC;KACpB;IAED,IAAI,IAAI,GAAG,EAAE,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;KAC/C;IACD,IAAI,IAAI,GAAG,GAAG,EAAE;QACZ,MAAM;QACN,OAAO,IAAI,GAAG,EAAE,CAAC;KACpB;IAED,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,0EAA0E;AAC1E,kCAAkC;AAClC,MAAM,UAAU,WAAW,CAAC,IAAgB;IACxC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACrC,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC;KACtD;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE;QAC5B,MAAM,KAAK,GAAG,KAAK,GAAG,GAAG,CAAC;QAC1B,KAAK,KAAK,CAAC,CAAC;QACZ,IAAI,KAAK,GAAG,EAAE,EAAE;YACZ,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;SAC9B;aAAM;YACH,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;SAC9B;QACD,KAAK,IAAI,CAAC,CAAC;KACd;IACD,OAAO,KAAK,IAAI,CAAC,EAAE;QACf,MAAM;QACN,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACnB,KAAK,IAAI,CAAC,CAAC;KACd;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/esm/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { decodeUtf8, encodeUtf8 } from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export { decodeUtf8, encodeUtf8 } from "@yume-chan/struct";
|
|
2
|
+
export * from "./auto-reset-event.js";
|
|
3
|
+
export * from "./base64.js";
|
|
4
|
+
export * from "./conditional-variable.js";
|
|
5
|
+
export * from "./hex.js";
|
|
6
|
+
export * from "./no-op.js";
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/esm/utils/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { decodeUtf8, encodeUtf8 } from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export { decodeUtf8, encodeUtf8 } from "@yume-chan/struct";
|
|
2
|
+
export * from "./auto-reset-event.js";
|
|
3
|
+
export * from "./base64.js";
|
|
4
|
+
export * from "./conditional-variable.js";
|
|
5
|
+
export * from "./hex.js";
|
|
6
|
+
export * from "./no-op.js";
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
package/esm/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const NOOP: () => void;
|
|
2
|
+
/**
|
|
3
|
+
* When used in `Promise#catch`, means the promise should never throw errors.
|
|
4
|
+
* An explicit way to suppress ESLint floating promise warnings.
|
|
5
|
+
*/
|
|
6
|
+
export declare function unreachable(...args: unknown[]): never;
|
|
7
|
+
//# sourceMappingURL=no-op.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op.d.ts","sourceRoot":"","sources":["../../src/utils/no-op.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,YAEhB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAGrD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const NOOP = () => {
|
|
2
|
+
// no-op
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* When used in `Promise#catch`, means the promise should never throw errors.
|
|
6
|
+
* An explicit way to suppress ESLint floating promise warnings.
|
|
7
|
+
*/
|
|
8
|
+
export function unreachable(...args) {
|
|
9
|
+
// Trigger runtime's unhandled rejection event.
|
|
10
|
+
throw new Error("Unreachable. Arguments:\n" + args.join("\n"));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=no-op.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op.js","sourceRoot":"","sources":["../../src/utils/no-op.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE;IACrB,QAAQ;AACZ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,GAAG,IAAe;IAC1C,+CAA+C;IAC/C,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yume-chan/adb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "TypeScript implementation of Android Debug Bridge (ADB) protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adb",
|
|
@@ -26,27 +26,29 @@
|
|
|
26
26
|
"types": "esm/index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@yume-chan/async": "^2.2.0",
|
|
29
|
-
"@yume-chan/dataview-bigint-polyfill": "^0.0.
|
|
30
|
-
"@yume-chan/event": "^0.0.
|
|
31
|
-
"@yume-chan/stream-extra": "^0.0.
|
|
32
|
-
"@yume-chan/struct": "^0.0.
|
|
33
|
-
"tslib": "^2.
|
|
29
|
+
"@yume-chan/dataview-bigint-polyfill": "^0.0.20",
|
|
30
|
+
"@yume-chan/event": "^0.0.20",
|
|
31
|
+
"@yume-chan/stream-extra": "^0.0.20",
|
|
32
|
+
"@yume-chan/struct": "^0.0.20",
|
|
33
|
+
"tslib": "^2.5.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@jest/globals": "^29.
|
|
37
|
-
"@types/node": "^
|
|
36
|
+
"@jest/globals": "^29.5.0",
|
|
37
|
+
"@types/node": "^20.2.1",
|
|
38
38
|
"@yume-chan/eslint-config": "^1.0.0",
|
|
39
39
|
"@yume-chan/tsconfig": "^1.0.0",
|
|
40
40
|
"cross-env": "^7.0.3",
|
|
41
|
-
"eslint": "^8.
|
|
42
|
-
"jest": "^29.
|
|
41
|
+
"eslint": "^8.41.0",
|
|
42
|
+
"jest": "^29.5.0",
|
|
43
|
+
"prettier": "^2.8.8",
|
|
43
44
|
"ts-jest": "^29.0.4",
|
|
44
|
-
"typescript": "^
|
|
45
|
+
"typescript": "^5.0.3",
|
|
46
|
+
"web-streams-polyfill": "^4.0.0-beta.3"
|
|
45
47
|
},
|
|
46
48
|
"scripts": {
|
|
47
49
|
"build": "tsc -b tsconfig.build.json",
|
|
48
50
|
"build:watch": "tsc -b tsconfig.build.json",
|
|
49
51
|
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
50
|
-
"lint": "eslint src/**/*.ts --fix"
|
|
52
|
+
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4"
|
|
51
53
|
}
|
|
52
54
|
}
|
package/src/adb.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Consumable, ReadableWritablePair } from "@yume-chan/stream-extra";
|
|
2
|
+
import { DecodeUtf8Stream, GatherStringStream } from "@yume-chan/stream-extra";
|
|
3
|
+
import type { ValueOrPromise } from "@yume-chan/struct";
|
|
2
4
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
AbortController,
|
|
6
|
-
DecodeUtf8Stream,
|
|
7
|
-
GatherStringStream,
|
|
8
|
-
WritableStream,
|
|
9
|
-
type ReadableWritablePair,
|
|
10
|
-
} from "@yume-chan/stream-extra";
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
ADB_DEFAULT_AUTHENTICATORS,
|
|
14
|
-
AdbAuthenticationProcessor,
|
|
15
|
-
type AdbCredentialStore,
|
|
16
|
-
} from "./auth.js";
|
|
5
|
+
import type { AdbBanner } from "./banner.js";
|
|
6
|
+
import type { AdbFrameBuffer } from "./commands/index.js";
|
|
17
7
|
import {
|
|
18
8
|
AdbPower,
|
|
19
9
|
AdbReverseCommand,
|
|
@@ -22,181 +12,61 @@ import {
|
|
|
22
12
|
AdbTcpIpCommand,
|
|
23
13
|
escapeArg,
|
|
24
14
|
framebuffer,
|
|
25
|
-
install,
|
|
26
|
-
type AdbFrameBuffer,
|
|
27
15
|
} from "./commands/index.js";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
AdbCommand,
|
|
31
|
-
calculateChecksum,
|
|
32
|
-
type AdbPacketData,
|
|
33
|
-
type AdbPacketInit,
|
|
34
|
-
} from "./packet.js";
|
|
35
|
-
import {
|
|
36
|
-
AdbPacketDispatcher,
|
|
37
|
-
type AdbIncomingSocketHandler,
|
|
38
|
-
type AdbSocket,
|
|
39
|
-
type Closeable,
|
|
40
|
-
} from "./socket/index.js";
|
|
41
|
-
import { decodeUtf8, encodeUtf8 } from "./utils/index.js";
|
|
16
|
+
import type { AdbFeature } from "./features.js";
|
|
42
17
|
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Features = "features",
|
|
18
|
+
export interface AdbSocket
|
|
19
|
+
extends ReadableWritablePair<Uint8Array, Consumable<Uint8Array>>,
|
|
20
|
+
Closeable {
|
|
21
|
+
readonly service: string;
|
|
48
22
|
}
|
|
49
23
|
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* It's possible to call `authenticate` multiple times on a single connection,
|
|
55
|
-
* every time the device receives a `CNXN` packet, it resets its internal state,
|
|
56
|
-
* and starts a new authentication process.
|
|
57
|
-
*/
|
|
58
|
-
public static async authenticate(
|
|
59
|
-
connection: ReadableWritablePair<AdbPacketData, AdbPacketInit>,
|
|
60
|
-
credentialStore: AdbCredentialStore,
|
|
61
|
-
authenticators = ADB_DEFAULT_AUTHENTICATORS
|
|
62
|
-
): Promise<Adb> {
|
|
63
|
-
// Initially, set to highest-supported version and payload size.
|
|
64
|
-
let version = 0x01000001;
|
|
65
|
-
let maxPayloadSize = 0x100000;
|
|
24
|
+
export type AdbIncomingSocketHandler = (
|
|
25
|
+
socket: AdbSocket
|
|
26
|
+
) => ValueOrPromise<void>;
|
|
66
27
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
credentialStore
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
// Here is similar to `AdbPacketDispatcher`,
|
|
74
|
-
// But the received packet types and send packet processing are different.
|
|
75
|
-
const abortController = new AbortController();
|
|
76
|
-
const pipe = connection.readable
|
|
77
|
-
.pipeTo(
|
|
78
|
-
new WritableStream({
|
|
79
|
-
async write(packet) {
|
|
80
|
-
switch (packet.command) {
|
|
81
|
-
case AdbCommand.Connect:
|
|
82
|
-
version = Math.min(version, packet.arg0);
|
|
83
|
-
maxPayloadSize = Math.min(
|
|
84
|
-
maxPayloadSize,
|
|
85
|
-
packet.arg1
|
|
86
|
-
);
|
|
87
|
-
resolver.resolve(decodeUtf8(packet.payload));
|
|
88
|
-
break;
|
|
89
|
-
case AdbCommand.Auth: {
|
|
90
|
-
const response = await authProcessor.process(
|
|
91
|
-
packet
|
|
92
|
-
);
|
|
93
|
-
await sendPacket(response);
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
default:
|
|
97
|
-
// Maybe the previous ADB client exited without reading all packets,
|
|
98
|
-
// so they are still waiting in OS internal buffer.
|
|
99
|
-
// Just ignore them.
|
|
100
|
-
// Because a `Connect` packet will reset the device,
|
|
101
|
-
// Eventually there will be `Connect` and `Auth` response packets.
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
}),
|
|
106
|
-
{
|
|
107
|
-
// Don't cancel the source ReadableStream on AbortSignal abort.
|
|
108
|
-
preventCancel: true,
|
|
109
|
-
signal: abortController.signal,
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
.catch((e) => {
|
|
113
|
-
resolver.reject(e);
|
|
114
|
-
});
|
|
28
|
+
export interface Closeable {
|
|
29
|
+
close(): ValueOrPromise<void>;
|
|
30
|
+
}
|
|
115
31
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// Always send checksum in auth steps
|
|
119
|
-
// Because we don't know if the device needs it or not.
|
|
120
|
-
await writer.write(calculateChecksum(init));
|
|
121
|
-
}
|
|
32
|
+
export interface AdbTransport extends Closeable {
|
|
33
|
+
readonly serial: string;
|
|
122
34
|
|
|
123
|
-
|
|
124
|
-
try {
|
|
125
|
-
// https://android.googlesource.com/platform/packages/modules/adb/+/79010dc6d5ca7490c493df800d4421730f5466ca/transport.cpp#1252
|
|
126
|
-
// There are some other feature constants, but some of them are only used by ADB server, not devices (daemons).
|
|
127
|
-
const features = [
|
|
128
|
-
AdbFeatures.ShellV2,
|
|
129
|
-
AdbFeatures.Cmd,
|
|
130
|
-
AdbFeatures.StatV2,
|
|
131
|
-
AdbFeatures.ListV2,
|
|
132
|
-
AdbFeatures.FixedPushMkdir,
|
|
133
|
-
"apex",
|
|
134
|
-
"abb",
|
|
135
|
-
// only tells the client the symlink timestamp issue in `adb push --sync` has been fixed.
|
|
136
|
-
// No special handling required.
|
|
137
|
-
"fixed_push_symlink_timestamp",
|
|
138
|
-
"abb_exec",
|
|
139
|
-
"remount_shell",
|
|
140
|
-
"track_app",
|
|
141
|
-
"sendrecv_v2",
|
|
142
|
-
"sendrecv_v2_brotli",
|
|
143
|
-
"sendrecv_v2_lz4",
|
|
144
|
-
"sendrecv_v2_zstd",
|
|
145
|
-
"sendrecv_v2_dry_run_send",
|
|
146
|
-
].join(",");
|
|
35
|
+
readonly maxPayloadSize: number;
|
|
147
36
|
|
|
148
|
-
|
|
149
|
-
command: AdbCommand.Connect,
|
|
150
|
-
arg0: version,
|
|
151
|
-
arg1: maxPayloadSize,
|
|
152
|
-
// The terminating `;` is required in formal definition
|
|
153
|
-
// But ADB daemon (all versions) can still work without it
|
|
154
|
-
payload: encodeUtf8(`host::features=${features};`),
|
|
155
|
-
});
|
|
37
|
+
readonly banner: AdbBanner;
|
|
156
38
|
|
|
157
|
-
|
|
158
|
-
} finally {
|
|
159
|
-
// When failed, release locks on `connection` so the caller can try again.
|
|
160
|
-
// When success, also release locks so `AdbPacketDispatcher` can use them.
|
|
161
|
-
abortController.abort();
|
|
162
|
-
writer.releaseLock();
|
|
39
|
+
readonly disconnected: Promise<void>;
|
|
163
40
|
|
|
164
|
-
|
|
165
|
-
await pipe;
|
|
166
|
-
}
|
|
41
|
+
connect(service: string): ValueOrPromise<AdbSocket>;
|
|
167
42
|
|
|
168
|
-
|
|
169
|
-
|
|
43
|
+
addReverseTunnel(
|
|
44
|
+
handler: AdbIncomingSocketHandler,
|
|
45
|
+
address?: string
|
|
46
|
+
): ValueOrPromise<string>;
|
|
170
47
|
|
|
171
|
-
|
|
48
|
+
removeReverseTunnel(address: string): ValueOrPromise<void>;
|
|
172
49
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
50
|
+
clearReverseTunnels(): ValueOrPromise<void>;
|
|
51
|
+
}
|
|
176
52
|
|
|
177
|
-
|
|
178
|
-
public
|
|
179
|
-
return this._protocolVersion;
|
|
180
|
-
}
|
|
53
|
+
export class Adb implements Closeable {
|
|
54
|
+
public readonly transport: AdbTransport;
|
|
181
55
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return this._product;
|
|
56
|
+
public get serial() {
|
|
57
|
+
return this.transport.serial;
|
|
185
58
|
}
|
|
186
59
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return this._model;
|
|
60
|
+
public get maxPayloadSize() {
|
|
61
|
+
return this.transport.maxPayloadSize;
|
|
190
62
|
}
|
|
191
63
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return this._device;
|
|
64
|
+
public get banner() {
|
|
65
|
+
return this.transport.banner;
|
|
195
66
|
}
|
|
196
67
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return this._features;
|
|
68
|
+
public get disconnected() {
|
|
69
|
+
return this.transport.disconnected;
|
|
200
70
|
}
|
|
201
71
|
|
|
202
72
|
public readonly subprocess: AdbSubprocess;
|
|
@@ -204,31 +74,8 @@ export class Adb implements Closeable {
|
|
|
204
74
|
public readonly reverse: AdbReverseCommand;
|
|
205
75
|
public readonly tcpip: AdbTcpIpCommand;
|
|
206
76
|
|
|
207
|
-
public constructor(
|
|
208
|
-
|
|
209
|
-
version: number,
|
|
210
|
-
maxPayloadSize: number,
|
|
211
|
-
banner: string
|
|
212
|
-
) {
|
|
213
|
-
this.parseBanner(banner);
|
|
214
|
-
|
|
215
|
-
let calculateChecksum: boolean;
|
|
216
|
-
let appendNullToServiceString: boolean;
|
|
217
|
-
if (version >= VERSION_OMIT_CHECKSUM) {
|
|
218
|
-
calculateChecksum = false;
|
|
219
|
-
appendNullToServiceString = false;
|
|
220
|
-
} else {
|
|
221
|
-
calculateChecksum = true;
|
|
222
|
-
appendNullToServiceString = true;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
this.dispatcher = new AdbPacketDispatcher(connection, {
|
|
226
|
-
calculateChecksum,
|
|
227
|
-
appendNullToServiceString,
|
|
228
|
-
maxPayloadSize,
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
this._protocolVersion = version;
|
|
77
|
+
public constructor(transport: AdbTransport) {
|
|
78
|
+
this.transport = transport;
|
|
232
79
|
|
|
233
80
|
this.subprocess = new AdbSubprocess(this);
|
|
234
81
|
this.power = new AdbPower(this);
|
|
@@ -236,50 +83,12 @@ export class Adb implements Closeable {
|
|
|
236
83
|
this.tcpip = new AdbTcpIpCommand(this);
|
|
237
84
|
}
|
|
238
85
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (pieces.length > 1) {
|
|
242
|
-
const props = pieces[1]!;
|
|
243
|
-
for (const prop of props.split(";")) {
|
|
244
|
-
if (!prop) {
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const keyValue = prop.split("=");
|
|
249
|
-
if (keyValue.length !== 2) {
|
|
250
|
-
continue;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const [key, value] = keyValue;
|
|
254
|
-
switch (key) {
|
|
255
|
-
case AdbPropKey.Product:
|
|
256
|
-
this._product = value;
|
|
257
|
-
break;
|
|
258
|
-
case AdbPropKey.Model:
|
|
259
|
-
this._model = value;
|
|
260
|
-
break;
|
|
261
|
-
case AdbPropKey.Device:
|
|
262
|
-
this._device = value;
|
|
263
|
-
break;
|
|
264
|
-
case AdbPropKey.Features:
|
|
265
|
-
this._features = value!.split(",") as AdbFeatures[];
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Add a handler for incoming socket.
|
|
274
|
-
* @param handler A function to call with new incoming sockets. It must return `true` if it accepts the socket.
|
|
275
|
-
* @returns A function to remove the handler.
|
|
276
|
-
*/
|
|
277
|
-
public onIncomingSocket(handler: AdbIncomingSocketHandler) {
|
|
278
|
-
return this.dispatcher.onIncomingSocket(handler);
|
|
86
|
+
public supportsFeature(feature: AdbFeature): boolean {
|
|
87
|
+
return this.banner.features.includes(feature);
|
|
279
88
|
}
|
|
280
89
|
|
|
281
90
|
public async createSocket(service: string): Promise<AdbSocket> {
|
|
282
|
-
return this.
|
|
91
|
+
return this.transport.connect(service);
|
|
283
92
|
}
|
|
284
93
|
|
|
285
94
|
public async createSocketAndWait(service: string): Promise<string> {
|
|
@@ -300,18 +109,15 @@ export class Adb implements Closeable {
|
|
|
300
109
|
}
|
|
301
110
|
|
|
302
111
|
public async rm(...filenames: string[]): Promise<string> {
|
|
112
|
+
// https://android.googlesource.com/platform/packages/modules/adb/+/1a0fb8846d4e6b671c8aa7f137a8c21d7b248716/client/adb_install.cpp#984
|
|
303
113
|
const stdout = await this.subprocess.spawnAndWaitLegacy([
|
|
304
114
|
"rm",
|
|
305
|
-
"-rf",
|
|
306
115
|
...filenames.map((arg) => escapeArg(arg)),
|
|
116
|
+
"</dev/null",
|
|
307
117
|
]);
|
|
308
118
|
return stdout;
|
|
309
119
|
}
|
|
310
120
|
|
|
311
|
-
public install() {
|
|
312
|
-
return install(this);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
121
|
public async sync(): Promise<AdbSync> {
|
|
316
122
|
const socket = await this.createSocket("sync:");
|
|
317
123
|
return new AdbSync(this, socket);
|
|
@@ -321,14 +127,7 @@ export class Adb implements Closeable {
|
|
|
321
127
|
return framebuffer(this);
|
|
322
128
|
}
|
|
323
129
|
|
|
324
|
-
/**
|
|
325
|
-
* Close the ADB connection.
|
|
326
|
-
*
|
|
327
|
-
* Note that it won't close the streams from backends.
|
|
328
|
-
* The streams are both physically and logically intact,
|
|
329
|
-
* and can be reused.
|
|
330
|
-
*/
|
|
331
130
|
public async close(): Promise<void> {
|
|
332
|
-
await this.
|
|
131
|
+
await this.transport.close();
|
|
333
132
|
}
|
|
334
133
|
}
|