@yume-chan/android-bin 0.0.20 → 0.0.22
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/LICENSE +21 -0
- package/README.md +40 -14
- package/esm/am.d.ts +17 -0
- package/esm/am.d.ts.map +1 -0
- package/esm/am.js +42 -0
- package/esm/am.js.map +1 -0
- package/esm/bu.d.ts +20 -7
- package/esm/bu.d.ts.map +1 -1
- package/esm/bu.js +47 -8
- package/esm/bu.js.map +1 -1
- package/esm/bug-report.d.ts +82 -21
- package/esm/bug-report.d.ts.map +1 -1
- package/esm/bug-report.js +187 -53
- package/esm/bug-report.js.map +1 -1
- package/esm/cmd.d.ts +4 -6
- package/esm/cmd.d.ts.map +1 -1
- package/esm/cmd.js +36 -21
- package/esm/cmd.js.map +1 -1
- package/esm/demo-mode.d.ts +3 -3
- package/esm/demo-mode.d.ts.map +1 -1
- package/esm/demo-mode.js +14 -15
- package/esm/demo-mode.js.map +1 -1
- package/esm/dumpsys.d.ts +39 -0
- package/esm/dumpsys.d.ts.map +1 -1
- package/esm/dumpsys.js +111 -0
- package/esm/dumpsys.js.map +1 -1
- package/esm/index.d.ts +6 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +6 -0
- package/esm/index.js.map +1 -1
- package/esm/intent.d.ts +10 -0
- package/esm/intent.d.ts.map +1 -0
- package/esm/intent.js +51 -0
- package/esm/intent.js.map +1 -0
- package/esm/logcat.d.ts +1 -0
- package/esm/logcat.d.ts.map +1 -1
- package/esm/logcat.js +20 -18
- package/esm/logcat.js.map +1 -1
- package/esm/overlay-display.d.ts +20 -3
- package/esm/overlay-display.d.ts.map +1 -1
- package/esm/overlay-display.js +34 -61
- package/esm/overlay-display.js.map +1 -1
- package/esm/pm.d.ts +42 -5
- package/esm/pm.d.ts.map +1 -1
- package/esm/pm.js +164 -46
- package/esm/pm.js.map +1 -1
- package/esm/settings.d.ts +22 -8
- package/esm/settings.d.ts.map +1 -1
- package/esm/settings.js +50 -25
- package/esm/settings.js.map +1 -1
- package/esm/string-format.d.ts +40 -0
- package/esm/string-format.d.ts.map +1 -0
- package/esm/string-format.js +153 -0
- package/esm/string-format.js.map +1 -0
- package/esm/utils.d.ts +4 -0
- package/esm/utils.d.ts.map +1 -0
- package/esm/utils.js +23 -0
- package/esm/utils.js.map +1 -0
- package/package.json +13 -8
- package/src/am.ts +69 -0
- package/src/bu.ts +68 -14
- package/src/bug-report.ts +234 -68
- package/src/cmd.ts +64 -30
- package/src/demo-mode.ts +47 -43
- package/src/dumpsys.ts +129 -0
- package/src/index.ts +6 -0
- package/src/intent.ts +63 -0
- package/src/logcat.ts +45 -42
- package/src/overlay-display.ts +82 -85
- package/src/pm.ts +274 -61
- package/src/settings.ts +94 -43
- package/src/string-format.ts +199 -0
- package/src/utils.ts +29 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yume-chan/android-bin",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.0.22",
|
|
6
|
+
"tag": "@yume-chan/android-bin_v0.0.22",
|
|
7
|
+
"date": "Wed, 13 Dec 2023 05:57:27 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Add wrapper for `pm uninstall`"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"comment": "Change `PackageManager#listPackages` to return an async generator"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Add wrapper for `am start`"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"comment": "Add wrapper for `pm resolve-activity`"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"comment": "Add `status` and `health` fields to `DumpSys#battery`"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"version": "0.0.21",
|
|
30
|
+
"tag": "@yume-chan/android-bin_v0.0.21",
|
|
31
|
+
"date": "Fri, 25 Aug 2023 14:05:18 GMT",
|
|
32
|
+
"comments": {
|
|
33
|
+
"none": [
|
|
34
|
+
{
|
|
35
|
+
"comment": "Add wrapper for `bu`"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"comment": "Remove the last `\\n` from `Settings#get`"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"comment": "Add wrappers for `dumpsys diskstats` and `dumpsys battery`"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"comment": "Add wrapper for `pm list packages`"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"comment": "Rewrite `Settings` to use `Cmd` if available"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"comment": "Add support to stop `bugreport`"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"comment": "Merge `bugreport` and `bugreportz` wrappers, providing an `automatic` method to choose the best available bugreport method"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
4
58
|
{
|
|
5
59
|
"version": "0.0.20",
|
|
6
60
|
"tag": "@yume-chan/android-bin_v0.0.20",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
# Change Log - @yume-chan/android-bin
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 13 Dec 2023 05:57:27 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.0.22
|
|
6
|
+
Wed, 13 Dec 2023 05:57:27 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Add wrapper for `pm uninstall`
|
|
11
|
+
- Change `PackageManager#listPackages` to return an async generator
|
|
12
|
+
- Add wrapper for `am start`
|
|
13
|
+
- Add wrapper for `pm resolve-activity`
|
|
14
|
+
- Add `status` and `health` fields to `DumpSys#battery`
|
|
15
|
+
|
|
16
|
+
## 0.0.21
|
|
17
|
+
Fri, 25 Aug 2023 14:05:18 GMT
|
|
18
|
+
|
|
19
|
+
### Updates
|
|
20
|
+
|
|
21
|
+
- Add wrapper for `bu`
|
|
22
|
+
- Remove the last `\n` from `Settings#get`
|
|
23
|
+
- Add wrappers for `dumpsys diskstats` and `dumpsys battery`
|
|
24
|
+
- Add wrapper for `pm list packages`
|
|
25
|
+
- Rewrite `Settings` to use `Cmd` if available
|
|
26
|
+
- Add support to stop `bugreport`
|
|
27
|
+
- Merge `bugreport` and `bugreportz` wrappers, providing an `automatic` method to choose the best available bugreport method
|
|
4
28
|
|
|
5
29
|
## 0.0.20
|
|
6
30
|
Mon, 05 Jun 2023 02:51:41 GMT
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2023 Simon Chan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,20 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="Tango" src="https://raw.githubusercontent.com/yume-chan/ya-webadb/main/.github/logo.svg" width="200">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">@yume-chan/android-bin</h1>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
Wrappers for Android built-in executables.
|
|
9
|
+
</p>
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://github.com/yume-chan/ya-webadb/blob/main/LICENSE">
|
|
13
|
+
<img alt="MIT License" src="https://img.shields.io/github/license/yume-chan/ya-webadb">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://github.com/yume-chan/ya-webadb/releases">
|
|
16
|
+
<img alt="GitHub release" src="https://img.shields.io/github/v/release/yume-chan/ya-webadb?logo=github">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://www.npmjs.com/package/@yume-chan/adb">
|
|
19
|
+
<img alt="npm" src="https://img.shields.io/npm/dm/%40yume-chan/adb?logo=npm">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://discord.gg/26k3ttC2PN">
|
|
22
|
+
<img alt="Discord" src="https://img.shields.io/discord/1120215514732564502?logo=discord&logoColor=%23ffffff&label=Discord">
|
|
23
|
+
</a>
|
|
24
|
+
</p>
|
|
8
25
|
|
|
9
|
-
|
|
10
|
-
* `bugreportz`
|
|
11
|
-
* `settings`
|
|
12
|
-
* Demo mode
|
|
13
|
-
* `logcat`
|
|
26
|
+
This package is part of [Tango ADB](https://github.com/yume-chan/ya-webadb). Generally you need multiple packages to build a complete ADB client that can run on Web browsers and Node.js. Read the documentation for more information.
|
|
14
27
|
|
|
15
|
-
##
|
|
28
|
+
## Documentation
|
|
16
29
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
Check the latest documentation at https://tango-adb.github.io/docs/
|
|
31
|
+
|
|
32
|
+
## Sponsors
|
|
33
|
+
|
|
34
|
+
[Become a backer](https://opencollective.com/ya-webadb) and get your image on our README on Github with a link to your site.
|
|
35
|
+
|
|
36
|
+
<a href="https://opencollective.com/ya-webadb/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/0/avatar.svg?requireActive=false"></a>
|
|
37
|
+
<a href="https://opencollective.com/ya-webadb/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/1/avatar.svg?requireActive=false"></a>
|
|
38
|
+
<a href="https://opencollective.com/ya-webadb/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/2/avatar.svg?requireActive=false"></a>
|
|
39
|
+
<a href="https://opencollective.com/ya-webadb/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/3/avatar.svg?requireActive=false"></a>
|
|
40
|
+
<a href="https://opencollective.com/ya-webadb/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/4/avatar.svg?requireActive=false"></a>
|
|
41
|
+
<a href="https://opencollective.com/ya-webadb/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/5/avatar.svg?requireActive=false"></a>
|
|
42
|
+
<a href="https://opencollective.com/ya-webadb/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/6/avatar.svg?requireActive=false"></a>
|
|
43
|
+
<a href="https://opencollective.com/ya-webadb/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/7/avatar.svg?requireActive=false"></a>
|
|
44
|
+
<a href="https://opencollective.com/ya-webadb/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/8/avatar.svg?requireActive=false"></a>
|
|
45
|
+
<a href="https://opencollective.com/ya-webadb/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/9/avatar.svg?requireActive=false"></a>
|
|
46
|
+
<a href="https://opencollective.com/ya-webadb/backer/10/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/10/avatar.svg?requireActive=false"></a>
|
package/esm/am.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Adb } from "@yume-chan/adb";
|
|
2
|
+
import { AdbCommandBase } from "@yume-chan/adb";
|
|
3
|
+
import type { IntentBuilder } from "./intent.js";
|
|
4
|
+
import type { SingleUser } from "./utils.js";
|
|
5
|
+
export interface ActivityManagerStartActivityOptions {
|
|
6
|
+
displayId?: number;
|
|
7
|
+
windowingMode?: number;
|
|
8
|
+
forceStop?: boolean;
|
|
9
|
+
user?: SingleUser;
|
|
10
|
+
intent: IntentBuilder;
|
|
11
|
+
}
|
|
12
|
+
export declare class ActivityManager extends AdbCommandBase {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(adb: Adb);
|
|
15
|
+
startActivity(options: ActivityManagerStartActivityOptions): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=am.d.ts.map
|
package/esm/am.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"am.d.ts","sourceRoot":"","sources":["../src/am.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,MAAM,WAAW,mCAAmC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;CACzB;AAWD,qBAAa,eAAgB,SAAQ,cAAc;;gBAGnC,GAAG,EAAE,GAAG;IAcd,aAAa,CAAC,OAAO,EAAE,mCAAmC;CAyBnE"}
|
package/esm/am.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AdbCommandBase } from "@yume-chan/adb";
|
|
2
|
+
import { ConcatStringStream, DecodeUtf8Stream } from "@yume-chan/stream-extra";
|
|
3
|
+
import { Cmd } from "./cmd.js";
|
|
4
|
+
import { buildArguments } from "./utils.js";
|
|
5
|
+
const START_ACTIVITY_OPTIONS_MAP = {
|
|
6
|
+
displayId: "--display",
|
|
7
|
+
windowingMode: "--windowingMode",
|
|
8
|
+
forceStop: "-S",
|
|
9
|
+
user: "--user",
|
|
10
|
+
};
|
|
11
|
+
export class ActivityManager extends AdbCommandBase {
|
|
12
|
+
#cmd;
|
|
13
|
+
constructor(adb) {
|
|
14
|
+
super(adb);
|
|
15
|
+
this.#cmd = new Cmd(adb);
|
|
16
|
+
}
|
|
17
|
+
async #cmdOrSubprocess(args) {
|
|
18
|
+
if (this.#cmd.supportsCmd) {
|
|
19
|
+
args.shift();
|
|
20
|
+
return await this.#cmd.spawn(false, "activity", ...args);
|
|
21
|
+
}
|
|
22
|
+
return this.adb.subprocess.spawn(args);
|
|
23
|
+
}
|
|
24
|
+
async startActivity(options) {
|
|
25
|
+
let args = buildArguments(["am", "start-activity", "-W"], options, START_ACTIVITY_OPTIONS_MAP);
|
|
26
|
+
args = args.concat(options.intent.build());
|
|
27
|
+
const process = await this.#cmdOrSubprocess(args);
|
|
28
|
+
const output = await process.stdout
|
|
29
|
+
.pipeThrough(new DecodeUtf8Stream())
|
|
30
|
+
.pipeThrough(new ConcatStringStream())
|
|
31
|
+
.then((output) => output.trim());
|
|
32
|
+
for (const line of output) {
|
|
33
|
+
if (line.startsWith("Error:")) {
|
|
34
|
+
throw new Error(line.substring("Error:".length).trim());
|
|
35
|
+
}
|
|
36
|
+
if (line === "Complete") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=am.js.map
|
package/esm/am.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"am.js","sourceRoot":"","sources":["../src/am.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAU5C,MAAM,0BAA0B,GAE5B;IACA,SAAS,EAAE,WAAW;IACtB,aAAa,EAAE,iBAAiB;IAChC,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAC/C,IAAI,CAAM;IAEV,YAAY,GAAQ;QAChB,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,IAAc;QACjC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAA4C;QAC5D,IAAI,IAAI,GAAG,cAAc,CACrB,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAC9B,OAAO,EACP,0BAA0B,CAC7B,CAAC;QAEF,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAE3C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM;aAC9B,WAAW,CAAC,IAAI,gBAAgB,EAAE,CAAC;aACnC,WAAW,CAAC,IAAI,kBAAkB,EAAE,CAAC;aACrC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAErC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YACxB,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5D,CAAC;YACD,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;gBACtB,OAAO;YACX,CAAC;QACL,CAAC;IACL,CAAC;CACJ"}
|
package/esm/bu.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { AdbCommandBase } from "@yume-chan/adb";
|
|
2
|
+
import type { Consumable, ReadableStream } from "@yume-chan/stream-extra";
|
|
2
3
|
export interface AdbBackupOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
user: number;
|
|
5
|
+
saveSharedStorage?: boolean;
|
|
6
|
+
saveWidgets?: boolean;
|
|
7
|
+
packages: string[] | "user" | "all";
|
|
8
|
+
savePackageApk: boolean;
|
|
9
|
+
savePackageObb: boolean;
|
|
10
|
+
savePackageKeyValue: boolean;
|
|
8
11
|
compress: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface AdbRestoreOptions {
|
|
9
14
|
user: number;
|
|
15
|
+
file: ReadableStream<Consumable<Uint8Array>>;
|
|
10
16
|
}
|
|
11
17
|
export declare class AdbBackup extends AdbCommandBase {
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
/**
|
|
19
|
+
* User must confirm backup on device within 60 seconds.
|
|
20
|
+
*/
|
|
21
|
+
backup(options: AdbBackupOptions): Promise<ReadableStream<Uint8Array>>;
|
|
22
|
+
/**
|
|
23
|
+
* User must enter the password (if any) and
|
|
24
|
+
* confirm restore on device within 60 seconds.
|
|
25
|
+
*/
|
|
26
|
+
restore(options: AdbRestoreOptions): Promise<string>;
|
|
14
27
|
}
|
|
15
28
|
//# sourceMappingURL=bu.d.ts.map
|
package/esm/bu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bu.d.ts","sourceRoot":"","sources":["../src/bu.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bu.d.ts","sourceRoot":"","sources":["../src/bu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG1E,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC;IACpC,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;CAChD;AAED,qBAAa,SAAU,SAAQ,cAAc;IACzC;;OAEG;IACG,MAAM,CACR,OAAO,EAAE,gBAAgB,GAC1B,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAmCtC;;;OAGG;IACG,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CAc7D"}
|
package/esm/bu.js
CHANGED
|
@@ -1,14 +1,53 @@
|
|
|
1
|
-
// cspell: ignore apks
|
|
2
|
-
// cspell: ignore obbs
|
|
3
1
|
import { AdbCommandBase } from "@yume-chan/adb";
|
|
2
|
+
import { ConcatStringStream, DecodeUtf8Stream } from "@yume-chan/stream-extra";
|
|
4
3
|
export class AdbBackup extends AdbCommandBase {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* User must confirm backup on device within 60 seconds.
|
|
6
|
+
*/
|
|
7
|
+
async backup(options) {
|
|
8
|
+
const args = ["bu", "backup"];
|
|
9
|
+
if (options.user !== undefined) {
|
|
10
|
+
args.push("--user", options.user.toString());
|
|
11
|
+
}
|
|
12
|
+
args.push(options.saveSharedStorage ? "--shared" : "--no-shared");
|
|
13
|
+
args.push(options.saveWidgets ? "--widgets" : "--no-widgets");
|
|
14
|
+
args.push(options.savePackageApk ? "--apk" : "--no-apk");
|
|
15
|
+
args.push(options.savePackageObb ? "--obb" : "--no-obb");
|
|
16
|
+
args.push(options.savePackageKeyValue ? "--key-value" : "--no-key-value");
|
|
17
|
+
args.push(options.compress ? "--compress" : "--no-compress");
|
|
18
|
+
if (typeof options.packages === "string") {
|
|
19
|
+
switch (options.packages) {
|
|
20
|
+
case "user":
|
|
21
|
+
args.push("--all", "--no-system");
|
|
22
|
+
break;
|
|
23
|
+
case "all":
|
|
24
|
+
args.push("--all", "--system");
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
args.push(...options.packages);
|
|
30
|
+
}
|
|
31
|
+
const process = await this.adb.subprocess.spawn(args);
|
|
32
|
+
return process.stdout;
|
|
8
33
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
34
|
+
/**
|
|
35
|
+
* User must enter the password (if any) and
|
|
36
|
+
* confirm restore on device within 60 seconds.
|
|
37
|
+
*/
|
|
38
|
+
async restore(options) {
|
|
39
|
+
const args = ["bu", "restore"];
|
|
40
|
+
if (options.user !== undefined) {
|
|
41
|
+
args.push("--user", options.user.toString());
|
|
42
|
+
}
|
|
43
|
+
const process = await this.adb.subprocess.spawn(args);
|
|
44
|
+
const [output] = await Promise.all([
|
|
45
|
+
process.stdout
|
|
46
|
+
.pipeThrough(new DecodeUtf8Stream())
|
|
47
|
+
.pipeThrough(new ConcatStringStream()),
|
|
48
|
+
options.file.pipeTo(process.stdin),
|
|
49
|
+
]);
|
|
50
|
+
return output;
|
|
12
51
|
}
|
|
13
52
|
}
|
|
14
53
|
//# sourceMappingURL=bu.js.map
|
package/esm/bu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bu.js","sourceRoot":"","sources":["../src/bu.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"bu.js","sourceRoot":"","sources":["../src/bu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAkB/E,MAAM,OAAO,SAAU,SAAQ,cAAc;IACzC;;OAEG;IACH,KAAK,CAAC,MAAM,CACR,OAAyB;QAEzB,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE9B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAE9D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,CACL,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CACjE,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAE7D,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACvC,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACvB,KAAK,MAAM;oBACP,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;oBAClC,MAAM;gBACV,KAAK,KAAK;oBACN,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC/B,MAAM;YACd,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,OAA0B;QACpC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC/B,OAAO,CAAC,MAAM;iBACT,WAAW,CAAC,IAAI,gBAAgB,EAAE,CAAC;iBACnC,WAAW,CAAC,IAAI,kBAAkB,EAAE,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACrC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
package/esm/bug-report.d.ts
CHANGED
|
@@ -1,38 +1,99 @@
|
|
|
1
|
+
import type { Adb } from "@yume-chan/adb";
|
|
1
2
|
import { AdbCommandBase } from "@yume-chan/adb";
|
|
2
|
-
import type { ReadableStream } from "@yume-chan/stream-extra";
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import type { AbortSignal, ReadableStream } from "@yume-chan/stream-extra";
|
|
4
|
+
export interface BugReportCapabilities {
|
|
5
|
+
supportsBugReport: boolean;
|
|
6
|
+
bugReportZVersion?: string | undefined;
|
|
7
|
+
supportsBugReportZ: boolean;
|
|
8
|
+
supportsBugReportZProgress: boolean;
|
|
9
|
+
supportsBugReportZStream: boolean;
|
|
8
10
|
}
|
|
9
|
-
export
|
|
11
|
+
export interface BugReportZOptions {
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
/**
|
|
14
|
+
* A callback that will be called when progress is updated.
|
|
15
|
+
*
|
|
16
|
+
* Specify `onProgress` when `supportsBugReportZProgress` is `false` will throw an error.
|
|
17
|
+
*/
|
|
18
|
+
onProgress?: ((completed: string, total: string) => void) | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare class BugReport extends AdbCommandBase {
|
|
21
|
+
#private;
|
|
10
22
|
static VERSION_REGEX: RegExp;
|
|
11
23
|
static BEGIN_REGEX: RegExp;
|
|
12
24
|
static PROGRESS_REGEX: RegExp;
|
|
13
25
|
static OK_REGEX: RegExp;
|
|
14
26
|
static FAIL_REGEX: RegExp;
|
|
15
27
|
/**
|
|
16
|
-
*
|
|
28
|
+
* Queries the device's bugreport capabilities.
|
|
29
|
+
*/
|
|
30
|
+
static queryCapabilities(adb: Adb): Promise<BugReport>;
|
|
31
|
+
/**
|
|
32
|
+
* Gets whether the device supports flat (text file, non-zipped) bugreport.
|
|
33
|
+
*
|
|
34
|
+
* Should be `true` for Android version <= 11.
|
|
35
|
+
*/
|
|
36
|
+
get supportsBugReport(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the version of BugReportZ.
|
|
39
|
+
*
|
|
40
|
+
* Will be `undefined` if BugReportZ is not supported.
|
|
41
|
+
*/
|
|
42
|
+
get bugReportZVersion(): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Gets whether the device supports zipped bugreport.
|
|
45
|
+
*
|
|
46
|
+
* Should be `true` for Android version >= 7.
|
|
47
|
+
*/
|
|
48
|
+
get supportsBugReportZ(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Gets whether the device supports progress report for zipped bugreport.
|
|
17
51
|
*
|
|
18
|
-
*
|
|
52
|
+
* Should be `true` for Android version >= 8.
|
|
19
53
|
*/
|
|
20
|
-
|
|
21
|
-
supportProgress(major: number, minor: number): boolean;
|
|
54
|
+
get supportsBugReportZProgress(): boolean;
|
|
22
55
|
/**
|
|
23
|
-
*
|
|
56
|
+
* Gets whether the device supports streaming zipped bugreport.
|
|
24
57
|
*
|
|
25
|
-
*
|
|
58
|
+
* Should be `true` for Android version >= 12.
|
|
59
|
+
*/
|
|
60
|
+
get supportsBugReportZStream(): boolean;
|
|
61
|
+
constructor(adb: Adb, capabilities: BugReportCapabilities);
|
|
62
|
+
/**
|
|
63
|
+
* Creates a legacy, non-zipped bugreport file, or throws an error if `supportsBugReport` is `false`.
|
|
64
|
+
*
|
|
65
|
+
* @returns A flat (text file, non-zipped) bugreport.
|
|
66
|
+
*/
|
|
67
|
+
bugReport(): ReadableStream<Uint8Array>;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a zipped bugreport file, or throws an error if `supportsBugReportZ` is `false`.
|
|
70
|
+
*
|
|
71
|
+
* Compare to `bugReportZStream`, this method will write the output to a file on device.
|
|
26
72
|
* You can pull it later using sync protocol.
|
|
27
73
|
*
|
|
28
|
-
* @
|
|
29
|
-
* @returns The path of the bugreport file.
|
|
74
|
+
* @returns The path to the generated bugreport file on device filesystem.
|
|
30
75
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
76
|
+
bugReportZ(options?: BugReportZOptions): Promise<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a zipped bugreport file, or throws an error if `supportsBugReportZStream` is `false`.
|
|
79
|
+
*
|
|
80
|
+
* @returns The content of the generated bugreport file.
|
|
81
|
+
*/
|
|
82
|
+
bugReportZStream(): ReadableStream<Uint8Array>;
|
|
83
|
+
/**
|
|
84
|
+
* Automatically choose the best bugreport method.
|
|
85
|
+
*
|
|
86
|
+
* * If `supportsBugReportZStream` is `true`, this method will return a stream of zipped bugreport.
|
|
87
|
+
* * If `supportsBugReportZ` is `true`, this method will return a stream of zipped bugreport, and will delete the file on device after the stream is closed.
|
|
88
|
+
* * If `supportsBugReport` is `true`, this method will return a stream of flat bugreport.
|
|
89
|
+
*
|
|
90
|
+
* @param onProgress
|
|
91
|
+
* If `supportsBugReportZStream` is `false` and `supportsBugReportZProgress` is `true`,
|
|
92
|
+
* this callback will be called when progress is updated.
|
|
93
|
+
*/
|
|
94
|
+
automatic(onProgress?: (completed: string, total: string) => void): {
|
|
95
|
+
type: "bugreport" | "bugreportz";
|
|
96
|
+
stream: ReadableStream<Uint8Array>;
|
|
97
|
+
};
|
|
37
98
|
}
|
|
38
99
|
//# sourceMappingURL=bug-report.d.ts.map
|
package/esm/bug-report.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bug-report.d.ts","sourceRoot":"","sources":["../src/bug-report.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAA8B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"bug-report.d.ts","sourceRoot":"","sources":["../src/bug-report.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAW,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAA8B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAU3E,MAAM,WAAW,qBAAqB;IAClC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,0BAA0B,EAAE,OAAO,CAAC;IACpC,wBAAwB,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACzE;AAED,qBAAa,SAAU,SAAQ,cAAc;;IACzC,MAAM,CAAC,aAAa,SAAkB;IAEtC,MAAM,CAAC,WAAW,SAAgB;IAElC,MAAM,CAAC,cAAc,SAAyB;IAE9C,MAAM,CAAC,QAAQ,SAAa;IAE5B,MAAM,CAAC,UAAU,SAAe;IAEhC;;OAEG;WACU,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC;IAmD5D;;;;OAIG;IACH,IAAI,iBAAiB,YAEpB;IAGD;;;;OAIG;IACH,IAAI,iBAAiB,uBAEpB;IAGD;;;;OAIG;IACH,IAAI,kBAAkB,YAErB;IAGD;;;;OAIG;IACH,IAAI,0BAA0B,YAE7B;IAGD;;;;OAIG;IACH,IAAI,wBAAwB,YAE3B;gBAEW,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,qBAAqB;IAWzD;;;;OAIG;IACH,SAAS,IAAI,cAAc,CAAC,UAAU,CAAC;IAcvC;;;;;;;OAOG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAwE9D;;;;OAIG;IACH,gBAAgB,IAAI,cAAc,CAAC,UAAU,CAAC;IAiC9C;;;;;;;;;;OAUG;IACH,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG;QAChE,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC;QACjC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;KACtC;CAsCJ"}
|