@yume-chan/android-bin 0.0.0-20240714132542
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.md +129 -0
- package/LICENSE +21 -0
- package/README.md +49 -0
- 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 +28 -0
- package/esm/bu.d.ts.map +1 -0
- package/esm/bu.js +53 -0
- package/esm/bu.js.map +1 -0
- package/esm/bug-report.d.ts +99 -0
- package/esm/bug-report.d.ts.map +1 -0
- package/esm/bug-report.js +271 -0
- package/esm/bug-report.js.map +1 -0
- package/esm/cmd.d.ts +25 -0
- package/esm/cmd.d.ts.map +1 -0
- package/esm/cmd.js +81 -0
- package/esm/cmd.js.map +1 -0
- package/esm/demo-mode.d.ts +44 -0
- package/esm/demo-mode.d.ts.map +1 -0
- package/esm/demo-mode.js +179 -0
- package/esm/demo-mode.js.map +1 -0
- package/esm/dumpsys.d.ts +51 -0
- package/esm/dumpsys.d.ts.map +1 -0
- package/esm/dumpsys.js +114 -0
- package/esm/dumpsys.js.map +1 -0
- package/esm/index.d.ts +13 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +14 -0
- package/esm/index.js.map +1 -0
- package/esm/intent.d.ts +11 -0
- package/esm/intent.d.ts.map +1 -0
- package/esm/intent.js +59 -0
- package/esm/intent.js.map +1 -0
- package/esm/logcat.d.ts +93 -0
- package/esm/logcat.d.ts.map +1 -0
- package/esm/logcat.js +300 -0
- package/esm/logcat.js.map +1 -0
- package/esm/overlay-display.d.ts +38 -0
- package/esm/overlay-display.d.ts.map +1 -0
- package/esm/overlay-display.js +51 -0
- package/esm/overlay-display.js.map +1 -0
- package/esm/pm.d.ts +211 -0
- package/esm/pm.d.ts.map +1 -0
- package/esm/pm.js +382 -0
- package/esm/pm.js.map +1 -0
- package/esm/settings.d.ts +27 -0
- package/esm/settings.d.ts.map +1 -0
- package/esm/settings.js +66 -0
- package/esm/settings.js.map +1 -0
- package/esm/string-format.d.ts +43 -0
- package/esm/string-format.d.ts.map +1 -0
- package/esm/string-format.js +152 -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 +49 -0
- package/src/am.ts +71 -0
- package/src/bu.ts +80 -0
- package/src/bug-report.ts +348 -0
- package/src/cmd.ts +113 -0
- package/src/demo-mode.ts +232 -0
- package/src/dumpsys.ts +153 -0
- package/src/index.ts +14 -0
- package/src/intent.ts +73 -0
- package/src/logcat.ts +509 -0
- package/src/overlay-display.ts +112 -0
- package/src/pm.ts +674 -0
- package/src/settings.ts +128 -0
- package/src/string-format.ts +197 -0
- package/src/utils.ts +29 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.build.tsbuildinfo +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Change Log - @yume-chan/android-bin
|
|
2
|
+
|
|
3
|
+
## 0.0.0-20240714132542
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Switch to PNPM workspace and changesets
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @yume-chan/stream-extra@0.0.0-20240714132542
|
|
10
|
+
- @yume-chan/struct@0.0.0-20240714132542
|
|
11
|
+
- @yume-chan/adb@0.0.0-20240714132542
|
|
12
|
+
|
|
13
|
+
This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
|
|
14
|
+
|
|
15
|
+
## 0.0.24
|
|
16
|
+
|
|
17
|
+
Tue, 18 Jun 2024 02:49:43 GMT
|
|
18
|
+
|
|
19
|
+
### Updates
|
|
20
|
+
|
|
21
|
+
- Allow streams to accept both `Uint8Array` and `Consumable<Uint8Array>` as inputs
|
|
22
|
+
- Add all supported fields to `DumpSys.Battery.Info`
|
|
23
|
+
|
|
24
|
+
## 0.0.23
|
|
25
|
+
|
|
26
|
+
Thu, 21 Mar 2024 03:15:10 GMT
|
|
27
|
+
|
|
28
|
+
### Updates
|
|
29
|
+
|
|
30
|
+
- Add support for pm install session
|
|
31
|
+
|
|
32
|
+
## 0.0.22
|
|
33
|
+
|
|
34
|
+
Wed, 13 Dec 2023 05:57:27 GMT
|
|
35
|
+
|
|
36
|
+
### Updates
|
|
37
|
+
|
|
38
|
+
- Add wrapper for `pm uninstall`
|
|
39
|
+
- Change `PackageManager#listPackages` to return an async generator
|
|
40
|
+
- Add wrapper for `am start`
|
|
41
|
+
- Add wrapper for `pm resolve-activity`
|
|
42
|
+
- Add `status` and `health` fields to `DumpSys#battery`
|
|
43
|
+
|
|
44
|
+
## 0.0.21
|
|
45
|
+
|
|
46
|
+
Fri, 25 Aug 2023 14:05:18 GMT
|
|
47
|
+
|
|
48
|
+
### Updates
|
|
49
|
+
|
|
50
|
+
- Add wrapper for `bu`
|
|
51
|
+
- Remove the last `\n` from `Settings#get`
|
|
52
|
+
- Add wrappers for `dumpsys diskstats` and `dumpsys battery`
|
|
53
|
+
- Add wrapper for `pm list packages`
|
|
54
|
+
- Rewrite `Settings` to use `Cmd` if available
|
|
55
|
+
- Add support to stop `bugreport`
|
|
56
|
+
- Merge `bugreport` and `bugreportz` wrappers, providing an `automatic` method to choose the best available bugreport method
|
|
57
|
+
|
|
58
|
+
## 0.0.20
|
|
59
|
+
|
|
60
|
+
Mon, 05 Jun 2023 02:51:41 GMT
|
|
61
|
+
|
|
62
|
+
_Version update only_
|
|
63
|
+
|
|
64
|
+
## 0.0.19
|
|
65
|
+
|
|
66
|
+
Sun, 09 Apr 2023 05:55:33 GMT
|
|
67
|
+
|
|
68
|
+
### Updates
|
|
69
|
+
|
|
70
|
+
- Add wrapper for `cmd`, with support for Android Binder Bridge (abb)
|
|
71
|
+
- Add `OverlayDisplay` wrapper for managing overlay displays
|
|
72
|
+
|
|
73
|
+
## 0.0.18
|
|
74
|
+
|
|
75
|
+
Wed, 25 Jan 2023 21:33:49 GMT
|
|
76
|
+
|
|
77
|
+
_Version update only_
|
|
78
|
+
|
|
79
|
+
## 0.0.17
|
|
80
|
+
|
|
81
|
+
Tue, 18 Oct 2022 09:32:30 GMT
|
|
82
|
+
|
|
83
|
+
### Updates
|
|
84
|
+
|
|
85
|
+
- Update to use new stream util package
|
|
86
|
+
|
|
87
|
+
## 0.0.16
|
|
88
|
+
|
|
89
|
+
Sat, 28 May 2022 03:56:37 GMT
|
|
90
|
+
|
|
91
|
+
### Updates
|
|
92
|
+
|
|
93
|
+
- Upgrade TypeScript to 4.7.2 to enable Node.js ESM
|
|
94
|
+
- Improve performance of `Logcat#binary()` by up to 150%
|
|
95
|
+
|
|
96
|
+
## 0.0.15
|
|
97
|
+
|
|
98
|
+
Mon, 02 May 2022 04:18:01 GMT
|
|
99
|
+
|
|
100
|
+
_Version update only_
|
|
101
|
+
|
|
102
|
+
## 0.0.14
|
|
103
|
+
|
|
104
|
+
Sat, 30 Apr 2022 14:05:48 GMT
|
|
105
|
+
|
|
106
|
+
_Version update only_
|
|
107
|
+
|
|
108
|
+
## 0.0.13
|
|
109
|
+
|
|
110
|
+
Thu, 28 Apr 2022 01:23:53 GMT
|
|
111
|
+
|
|
112
|
+
### Updates
|
|
113
|
+
|
|
114
|
+
- Add support for bugreport/bugreportz
|
|
115
|
+
- Add basic support for logcat
|
|
116
|
+
|
|
117
|
+
## 0.0.12
|
|
118
|
+
|
|
119
|
+
Sun, 03 Apr 2022 11:18:47 GMT
|
|
120
|
+
|
|
121
|
+
_Version update only_
|
|
122
|
+
|
|
123
|
+
## 0.0.11
|
|
124
|
+
|
|
125
|
+
Sun, 03 Apr 2022 10:54:15 GMT
|
|
126
|
+
|
|
127
|
+
### Updates
|
|
128
|
+
|
|
129
|
+
- Improve compatibility with Node.js 12 ESM format
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2024 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
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@yume-chan/android-bin</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Wrappers for Android built-in executables.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
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://bundlephobia.com/package/@yume-chan/android-bin">
|
|
19
|
+
<img alt="Package Size" src="https://img.shields.io/bundlephobia/minzip/%40yume-chan%2Fandroid-bin">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://www.npmjs.com/package/@yume-chan/android-bin">
|
|
22
|
+
<img alt="npm" src="https://img.shields.io/npm/dm/%40yume-chan/android-bin?logo=npm">
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://discord.gg/26k3ttC2PN">
|
|
25
|
+
<img alt="Discord" src="https://img.shields.io/discord/1120215514732564502?logo=discord&logoColor=%23ffffff&label=Discord">
|
|
26
|
+
</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
Check the latest documentation at https://tango-adb.github.io/docs/
|
|
34
|
+
|
|
35
|
+
## Sponsors
|
|
36
|
+
|
|
37
|
+
[Become a backer](https://opencollective.com/ya-webadb) and get your image on our README on Github with a link to your site.
|
|
38
|
+
|
|
39
|
+
<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>
|
|
40
|
+
<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>
|
|
41
|
+
<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>
|
|
42
|
+
<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>
|
|
43
|
+
<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>
|
|
44
|
+
<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>
|
|
45
|
+
<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>
|
|
46
|
+
<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>
|
|
47
|
+
<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>
|
|
48
|
+
<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>
|
|
49
|
+
<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,CACf,OAAO,EAAE,mCAAmC,GAC7C,OAAO,CAAC,IAAI,CAAC;CAyBnB"}
|
package/esm/am.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AdbCommandBase } from "@yume-chan/adb";
|
|
2
|
+
import { ConcatStringStream, TextDecoderStream } 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 TextDecoderStream())
|
|
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,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAU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,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
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AdbCommandBase } from "@yume-chan/adb";
|
|
2
|
+
import type { MaybeConsumable, ReadableStream } from "@yume-chan/stream-extra";
|
|
3
|
+
export interface AdbBackupOptions {
|
|
4
|
+
user: number;
|
|
5
|
+
saveSharedStorage?: boolean;
|
|
6
|
+
saveWidgets?: boolean;
|
|
7
|
+
packages: string[] | "user" | "all";
|
|
8
|
+
savePackageApk: boolean;
|
|
9
|
+
savePackageObb: boolean;
|
|
10
|
+
savePackageKeyValue: boolean;
|
|
11
|
+
compress: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface AdbRestoreOptions {
|
|
14
|
+
user: number;
|
|
15
|
+
file: ReadableStream<MaybeConsumable<Uint8Array>>;
|
|
16
|
+
}
|
|
17
|
+
export declare class AdbBackup extends AdbCommandBase {
|
|
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>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=bu.d.ts.map
|
package/esm/bu.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG/E,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,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;CACrD;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
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AdbCommandBase } from "@yume-chan/adb";
|
|
2
|
+
import { ConcatStringStream, TextDecoderStream } from "@yume-chan/stream-extra";
|
|
3
|
+
export class AdbBackup extends AdbCommandBase {
|
|
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;
|
|
33
|
+
}
|
|
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 TextDecoderStream())
|
|
47
|
+
.pipeThrough(new ConcatStringStream()),
|
|
48
|
+
options.file.pipeTo(process.stdin),
|
|
49
|
+
]);
|
|
50
|
+
return output;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=bu.js.map
|
package/esm/bu.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bu.js","sourceRoot":"","sources":["../src/bu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAA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AC,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,iBAAiB,EAAE,CAAC;iBACpC,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"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Adb } from "@yume-chan/adb";
|
|
2
|
+
import { AdbCommandBase } from "@yume-chan/adb";
|
|
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;
|
|
10
|
+
}
|
|
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;
|
|
22
|
+
static VERSION_REGEX: RegExp;
|
|
23
|
+
static BEGIN_REGEX: RegExp;
|
|
24
|
+
static PROGRESS_REGEX: RegExp;
|
|
25
|
+
static OK_REGEX: RegExp;
|
|
26
|
+
static FAIL_REGEX: RegExp;
|
|
27
|
+
/**
|
|
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.
|
|
51
|
+
*
|
|
52
|
+
* Should be `true` for Android version >= 8.
|
|
53
|
+
*/
|
|
54
|
+
get supportsBugReportZProgress(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Gets whether the device supports streaming zipped bugreport.
|
|
57
|
+
*
|
|
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.
|
|
72
|
+
* You can pull it later using sync protocol.
|
|
73
|
+
*
|
|
74
|
+
* @returns The path to the generated bugreport file on device filesystem.
|
|
75
|
+
*/
|
|
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
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=bug-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,MAAM,CAAkB;IAE9C,MAAM,CAAC,WAAW,EAAE,MAAM,CAAgB;IAE1C,MAAM,CAAC,cAAc,EAAE,MAAM,CAAyB;IAEtD,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAa;IAEpC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAe;IAExC;;OAEG;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