@yume-chan/android-bin 0.0.17 → 0.0.19
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 +21 -0
- package/CHANGELOG.md +14 -1
- package/README.md +15 -0
- package/esm/bu.d.ts +14 -14
- package/esm/bu.d.ts.map +1 -1
- package/esm/bu.js +13 -9
- package/esm/bu.js.map +1 -1
- package/esm/bug-report.d.ts +37 -37
- package/esm/bug-report.d.ts.map +1 -1
- package/esm/bug-report.js +136 -124
- package/esm/bug-report.js.map +1 -1
- package/esm/cmd.d.ts +15 -0
- package/esm/cmd.d.ts.map +1 -0
- package/esm/cmd.js +54 -0
- package/esm/cmd.js.map +1 -0
- package/esm/demo-mode.d.ts +43 -42
- package/esm/demo-mode.d.ts.map +1 -1
- package/esm/demo-mode.js +179 -146
- package/esm/demo-mode.js.map +1 -1
- package/esm/index.d.ts +6 -4
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +7 -5
- package/esm/index.js.map +1 -1
- package/esm/logcat.d.ts +91 -89
- package/esm/logcat.d.ts.map +1 -1
- package/esm/logcat.js +288 -192
- package/esm/logcat.js.map +1 -1
- package/esm/overlay-display.d.ts +21 -0
- package/esm/overlay-display.d.ts.map +1 -0
- package/esm/overlay-display.js +78 -0
- package/esm/overlay-display.js.map +1 -0
- package/esm/pm.d.ts +139 -0
- package/esm/pm.d.ts.map +1 -0
- package/esm/pm.js +125 -0
- package/esm/pm.js.map +1 -0
- package/esm/settings.d.ts +12 -12
- package/esm/settings.d.ts.map +1 -1
- package/esm/settings.js +29 -24
- package/esm/settings.js.map +1 -1
- package/package.json +15 -11
- package/src/bu.ts +7 -3
- package/src/bug-report.ts +74 -48
- package/src/cmd.ts +67 -0
- package/src/demo-mode.ts +111 -62
- package/src/index.ts +6 -4
- package/src/logcat.ts +359 -97
- package/src/overlay-display.ts +115 -0
- package/src/pm.ts +281 -0
- package/src/settings.ts +45 -16
- package/tsconfig.build.json +3 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/.rush/temp/package-deps_build.json +0 -17
- package/.rush/temp/package-deps_build_watch.json +0 -17
- package/.rush/temp/shrinkwrap-deps.json +0 -5
- package/android-bin.build.log +0 -1
- package/tsconfig.json +0 -11
package/src/bug-report.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
// cspell: ignore bugreport
|
|
2
2
|
// cspell: ignore bugreportz
|
|
3
3
|
|
|
4
|
-
import { AdbCommandBase, AdbSubprocessShellProtocol } from
|
|
5
|
-
import {
|
|
4
|
+
import { AdbCommandBase, AdbSubprocessShellProtocol } from "@yume-chan/adb";
|
|
5
|
+
import type { ReadableStream } from "@yume-chan/stream-extra";
|
|
6
|
+
import {
|
|
7
|
+
DecodeUtf8Stream,
|
|
8
|
+
PushReadableStream,
|
|
9
|
+
SplitStringStream,
|
|
10
|
+
WrapReadableStream,
|
|
11
|
+
WritableStream,
|
|
12
|
+
} from "@yume-chan/stream-extra";
|
|
6
13
|
|
|
7
14
|
export interface BugReportZVersion {
|
|
8
15
|
major: number;
|
|
@@ -34,8 +41,11 @@ export class BugReportZ extends AdbCommandBase {
|
|
|
34
41
|
return undefined;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
|
-
const { stderr, exitCode } = await this.adb.subprocess.spawnAndWait([
|
|
38
|
-
|
|
44
|
+
const { stderr, exitCode } = await this.adb.subprocess.spawnAndWait([
|
|
45
|
+
"bugreportz",
|
|
46
|
+
"-v",
|
|
47
|
+
]);
|
|
48
|
+
if (exitCode !== 0 || stderr === "") {
|
|
39
49
|
return undefined;
|
|
40
50
|
}
|
|
41
51
|
|
|
@@ -68,10 +78,12 @@ export class BugReportZ extends AdbCommandBase {
|
|
|
68
78
|
* @param onProgress Progress callback. Only specify this if `supportsProgress` is `true`.
|
|
69
79
|
* @returns The path of the bugreport file.
|
|
70
80
|
*/
|
|
71
|
-
public async generate(
|
|
81
|
+
public async generate(
|
|
82
|
+
onProgress?: (progress: string, total: string) => void
|
|
83
|
+
): Promise<string> {
|
|
72
84
|
const process = await this.adb.subprocess.spawn([
|
|
73
|
-
|
|
74
|
-
...(onProgress ? [
|
|
85
|
+
"bugreportz",
|
|
86
|
+
...(onProgress ? ["-p"] : []),
|
|
75
87
|
]);
|
|
76
88
|
|
|
77
89
|
let filename: string | undefined;
|
|
@@ -79,40 +91,42 @@ export class BugReportZ extends AdbCommandBase {
|
|
|
79
91
|
|
|
80
92
|
await process.stdout
|
|
81
93
|
.pipeThrough(new DecodeUtf8Stream())
|
|
82
|
-
.pipeThrough(new SplitStringStream(
|
|
83
|
-
.pipeTo(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
.pipeThrough(new SplitStringStream("\n"))
|
|
95
|
+
.pipeTo(
|
|
96
|
+
new WritableStream<string>({
|
|
97
|
+
write(line) {
|
|
98
|
+
// `BEGIN:` and `PROGRESS:` only appear when `-p` is specified.
|
|
99
|
+
let match = line.match(BugReportZ.PROGRESS_REGEX);
|
|
100
|
+
if (match) {
|
|
101
|
+
onProgress?.(match[1]!, match[2]!);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
match = line.match(BugReportZ.BEGIN_REGEX);
|
|
105
|
+
if (match) {
|
|
106
|
+
filename = match[1]!;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
match = line.match(BugReportZ.OK_REGEX);
|
|
110
|
+
if (match) {
|
|
111
|
+
filename = match[1];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
match = line.match(BugReportZ.FAIL_REGEX);
|
|
115
|
+
if (match) {
|
|
116
|
+
// Don't report error now
|
|
117
|
+
// We want to gather all output.
|
|
118
|
+
error = match[1];
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
);
|
|
109
123
|
|
|
110
124
|
if (error) {
|
|
111
125
|
throw new Error(error);
|
|
112
126
|
}
|
|
113
127
|
|
|
114
128
|
if (!filename) {
|
|
115
|
-
throw new Error(
|
|
129
|
+
throw new Error("bugreportz did not return file name");
|
|
116
130
|
}
|
|
117
131
|
|
|
118
132
|
// Design choice: we don't automatically pull the file to avoid more dependency on `@yume-chan/adb`
|
|
@@ -125,22 +139,34 @@ export class BugReportZ extends AdbCommandBase {
|
|
|
125
139
|
|
|
126
140
|
public stream(): ReadableStream<Uint8Array> {
|
|
127
141
|
return new PushReadableStream(async (controller) => {
|
|
128
|
-
const process = await this.adb.subprocess.spawn([
|
|
142
|
+
const process = await this.adb.subprocess.spawn([
|
|
143
|
+
"bugreportz",
|
|
144
|
+
"-s",
|
|
145
|
+
]);
|
|
129
146
|
process.stdout
|
|
130
|
-
.pipeTo(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
.pipeTo(
|
|
148
|
+
new WritableStream({
|
|
149
|
+
async write(chunk) {
|
|
150
|
+
await controller.enqueue(chunk);
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
)
|
|
154
|
+
.catch((e) => {
|
|
155
|
+
void e;
|
|
156
|
+
});
|
|
135
157
|
process.stderr
|
|
136
158
|
.pipeThrough(new DecodeUtf8Stream())
|
|
137
|
-
.pipeTo(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
159
|
+
.pipeTo(
|
|
160
|
+
new WritableStream({
|
|
161
|
+
write(chunk) {
|
|
162
|
+
controller.error(new Error(chunk));
|
|
163
|
+
},
|
|
164
|
+
})
|
|
165
|
+
)
|
|
166
|
+
.catch((e) => {
|
|
167
|
+
void e;
|
|
168
|
+
});
|
|
142
169
|
await process.exit;
|
|
143
|
-
controller.close();
|
|
144
170
|
});
|
|
145
171
|
}
|
|
146
172
|
}
|
|
@@ -149,7 +175,7 @@ export class BugReportZ extends AdbCommandBase {
|
|
|
149
175
|
export class BugReport extends AdbCommandBase {
|
|
150
176
|
public generate(): ReadableStream<Uint8Array> {
|
|
151
177
|
return new WrapReadableStream(async () => {
|
|
152
|
-
const process = await this.adb.subprocess.spawn([
|
|
178
|
+
const process = await this.adb.subprocess.spawn(["bugreport"]);
|
|
153
179
|
return process.stdout;
|
|
154
180
|
});
|
|
155
181
|
}
|
package/src/cmd.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Adb, AdbSubprocessProtocolConstructor } from "@yume-chan/adb";
|
|
2
|
+
import {
|
|
3
|
+
AdbCommandBase,
|
|
4
|
+
AdbFeature,
|
|
5
|
+
AdbSubprocessNoneProtocol,
|
|
6
|
+
AdbSubprocessShellProtocol,
|
|
7
|
+
} from "@yume-chan/adb";
|
|
8
|
+
|
|
9
|
+
export class Cmd extends AdbCommandBase {
|
|
10
|
+
private _supportsShellV2: boolean;
|
|
11
|
+
private _supportsCmd: boolean;
|
|
12
|
+
private _supportsAbb: boolean;
|
|
13
|
+
private _supportsAbbExec: boolean;
|
|
14
|
+
|
|
15
|
+
public get supportsShellV2() {
|
|
16
|
+
return this._supportsShellV2;
|
|
17
|
+
}
|
|
18
|
+
public get supportsCmd() {
|
|
19
|
+
return this._supportsCmd;
|
|
20
|
+
}
|
|
21
|
+
public get supportsAbb() {
|
|
22
|
+
return this._supportsAbb;
|
|
23
|
+
}
|
|
24
|
+
public get supportsAbbExec() {
|
|
25
|
+
return this._supportsAbbExec;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public constructor(adb: Adb) {
|
|
29
|
+
super(adb);
|
|
30
|
+
this._supportsShellV2 = adb.supportsFeature(AdbFeature.ShellV2);
|
|
31
|
+
this._supportsCmd = adb.supportsFeature(AdbFeature.Cmd);
|
|
32
|
+
this._supportsAbb = adb.supportsFeature(AdbFeature.Abb);
|
|
33
|
+
this._supportsAbbExec = adb.supportsFeature(AdbFeature.AbbExec);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public async spawn(
|
|
37
|
+
shellProtocol: boolean,
|
|
38
|
+
command: string,
|
|
39
|
+
...args: string[]
|
|
40
|
+
) {
|
|
41
|
+
let supportAbb: boolean;
|
|
42
|
+
let supportCmd: boolean = this.supportsCmd;
|
|
43
|
+
let service: string;
|
|
44
|
+
let Protocol: AdbSubprocessProtocolConstructor;
|
|
45
|
+
if (shellProtocol) {
|
|
46
|
+
supportAbb = this._supportsAbb;
|
|
47
|
+
supportCmd &&= this.supportsShellV2;
|
|
48
|
+
service = "abb";
|
|
49
|
+
Protocol = AdbSubprocessShellProtocol;
|
|
50
|
+
} else {
|
|
51
|
+
supportAbb = this._supportsAbbExec;
|
|
52
|
+
service = "abb_exec";
|
|
53
|
+
Protocol = AdbSubprocessNoneProtocol;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (supportAbb) {
|
|
57
|
+
const socket = await this.adb.createSocket(
|
|
58
|
+
`${service}:${command}\0${args.join("\0")}\0`
|
|
59
|
+
);
|
|
60
|
+
return new Protocol(socket);
|
|
61
|
+
} else if (supportCmd) {
|
|
62
|
+
return Protocol.raw(this.adb, `cmd ${command} ${args.join(" ")}`);
|
|
63
|
+
} else {
|
|
64
|
+
throw new Error("Not supported");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/demo-mode.ts
CHANGED
|
@@ -4,26 +4,50 @@
|
|
|
4
4
|
// cspell: ignore systemui
|
|
5
5
|
// cspell: ignore sysui
|
|
6
6
|
|
|
7
|
-
import { Adb
|
|
7
|
+
import type { Adb } from "@yume-chan/adb";
|
|
8
|
+
import { AdbCommandBase } from "@yume-chan/adb";
|
|
9
|
+
|
|
8
10
|
import { Settings } from "./settings.js";
|
|
9
11
|
|
|
10
12
|
export enum DemoModeSignalStrength {
|
|
11
|
-
Hidden =
|
|
12
|
-
Level0 =
|
|
13
|
-
Level1 =
|
|
14
|
-
Level2 =
|
|
15
|
-
Level3 =
|
|
16
|
-
Level4 =
|
|
13
|
+
Hidden = "null",
|
|
14
|
+
Level0 = "0",
|
|
15
|
+
Level1 = "1",
|
|
16
|
+
Level2 = "2",
|
|
17
|
+
Level3 = "3",
|
|
18
|
+
Level4 = "4",
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java;l=1362;drc=3b775bf7ad89902f94e03d191b0d8fbdebf2bdbf
|
|
20
|
-
export const DemoModeMobileDataTypes = [
|
|
21
|
-
|
|
22
|
+
export const DemoModeMobileDataTypes = [
|
|
23
|
+
"1x",
|
|
24
|
+
"3g",
|
|
25
|
+
"4g",
|
|
26
|
+
"4g+",
|
|
27
|
+
"5g",
|
|
28
|
+
"5ge",
|
|
29
|
+
"5g+",
|
|
30
|
+
"e",
|
|
31
|
+
"g",
|
|
32
|
+
"h",
|
|
33
|
+
"h+",
|
|
34
|
+
"lte",
|
|
35
|
+
"lte+",
|
|
36
|
+
"dis",
|
|
37
|
+
"not",
|
|
38
|
+
"null",
|
|
39
|
+
] as const;
|
|
22
40
|
|
|
23
41
|
export type DemoModeMobileDataType = (typeof DemoModeMobileDataTypes)[number];
|
|
24
42
|
|
|
25
43
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java;l=3136
|
|
26
|
-
export const DemoModeStatusBarModes = [
|
|
44
|
+
export const DemoModeStatusBarModes = [
|
|
45
|
+
"opaque",
|
|
46
|
+
"translucent",
|
|
47
|
+
"semi-transparent",
|
|
48
|
+
"transparent",
|
|
49
|
+
"warning",
|
|
50
|
+
] as const;
|
|
27
51
|
|
|
28
52
|
export type DemoModeStatusBarMode = (typeof DemoModeStatusBarModes)[number];
|
|
29
53
|
|
|
@@ -35,145 +59,170 @@ export class DemoMode extends AdbCommandBase {
|
|
|
35
59
|
this.settings = new Settings(adb);
|
|
36
60
|
}
|
|
37
61
|
|
|
38
|
-
public static readonly AllowedSettingKey =
|
|
62
|
+
public static readonly AllowedSettingKey = "sysui_demo_allowed";
|
|
39
63
|
|
|
40
64
|
// Demo Mode actually doesn't have a setting indicates its enablement
|
|
41
65
|
// However Developer Mode menu uses this key
|
|
42
66
|
// So we can only try our best to guess if it's enabled
|
|
43
|
-
public static readonly EnabledSettingKey =
|
|
67
|
+
public static readonly EnabledSettingKey = "sysui_tuner_demo_on";
|
|
44
68
|
|
|
45
69
|
public async getAllowed(): Promise<boolean> {
|
|
46
|
-
const output = await this.settings.get(
|
|
47
|
-
|
|
70
|
+
const output = await this.settings.get(
|
|
71
|
+
"global",
|
|
72
|
+
DemoMode.AllowedSettingKey
|
|
73
|
+
);
|
|
74
|
+
return output.trim() === "1";
|
|
48
75
|
}
|
|
49
76
|
|
|
50
77
|
public async setAllowed(value: boolean): Promise<void> {
|
|
51
78
|
if (value) {
|
|
52
|
-
await this.settings.put(
|
|
79
|
+
await this.settings.put("global", DemoMode.AllowedSettingKey, "1");
|
|
53
80
|
} else {
|
|
54
81
|
await this.setEnabled(false);
|
|
55
|
-
await this.settings.delete(
|
|
82
|
+
await this.settings.delete("global", DemoMode.AllowedSettingKey);
|
|
56
83
|
}
|
|
57
84
|
}
|
|
58
85
|
|
|
59
86
|
public async getEnabled(): Promise<boolean> {
|
|
60
|
-
const result = await this.settings.get(
|
|
61
|
-
|
|
87
|
+
const result = await this.settings.get(
|
|
88
|
+
"global",
|
|
89
|
+
DemoMode.EnabledSettingKey
|
|
90
|
+
);
|
|
91
|
+
return result.trim() === "1";
|
|
62
92
|
}
|
|
63
93
|
|
|
64
94
|
public async setEnabled(value: boolean): Promise<void> {
|
|
65
95
|
if (value) {
|
|
66
|
-
await this.settings.put(
|
|
96
|
+
await this.settings.put("global", DemoMode.EnabledSettingKey, "1");
|
|
67
97
|
} else {
|
|
68
|
-
await this.settings.delete(
|
|
69
|
-
await this.broadcast(
|
|
98
|
+
await this.settings.delete("global", DemoMode.EnabledSettingKey);
|
|
99
|
+
await this.broadcast("exit");
|
|
70
100
|
}
|
|
71
101
|
}
|
|
72
102
|
|
|
73
|
-
public async broadcast(
|
|
103
|
+
public async broadcast(
|
|
104
|
+
command: string,
|
|
105
|
+
extra?: Record<string, string>
|
|
106
|
+
): Promise<void> {
|
|
74
107
|
await this.adb.subprocess.spawnAndWaitLegacy([
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
108
|
+
"am",
|
|
109
|
+
"broadcast",
|
|
110
|
+
"-a",
|
|
111
|
+
"com.android.systemui.demo",
|
|
112
|
+
"-e",
|
|
113
|
+
"command",
|
|
81
114
|
command,
|
|
82
|
-
...(extra
|
|
115
|
+
...(extra
|
|
116
|
+
? Object.entries(extra).flatMap(([key, value]) => [
|
|
117
|
+
"-e",
|
|
118
|
+
key,
|
|
119
|
+
value,
|
|
120
|
+
])
|
|
121
|
+
: []),
|
|
83
122
|
]);
|
|
84
123
|
}
|
|
85
124
|
|
|
86
125
|
public async setBatteryLevel(level: number): Promise<void> {
|
|
87
|
-
await this.broadcast(
|
|
126
|
+
await this.broadcast("battery", { level: level.toString() });
|
|
88
127
|
}
|
|
89
128
|
|
|
90
129
|
public async setBatteryCharging(value: boolean): Promise<void> {
|
|
91
|
-
await this.broadcast(
|
|
130
|
+
await this.broadcast("battery", { plugged: value.toString() });
|
|
92
131
|
}
|
|
93
132
|
|
|
94
133
|
public async setPowerSaveMode(value: boolean): Promise<void> {
|
|
95
|
-
await this.broadcast(
|
|
134
|
+
await this.broadcast("battery", { powersave: value.toString() });
|
|
96
135
|
}
|
|
97
136
|
|
|
98
137
|
public async setAirplaneMode(show: boolean): Promise<void> {
|
|
99
|
-
await this.broadcast(
|
|
138
|
+
await this.broadcast("network", { airplane: show ? "show" : "hide" });
|
|
100
139
|
}
|
|
101
140
|
|
|
102
|
-
public async setWifiSignalStrength(
|
|
103
|
-
|
|
141
|
+
public async setWifiSignalStrength(
|
|
142
|
+
value: DemoModeSignalStrength
|
|
143
|
+
): Promise<void> {
|
|
144
|
+
await this.broadcast("network", { wifi: "show", level: value });
|
|
104
145
|
}
|
|
105
146
|
|
|
106
|
-
public async setMobileDataType(
|
|
147
|
+
public async setMobileDataType(
|
|
148
|
+
value: DemoModeMobileDataType
|
|
149
|
+
): Promise<void> {
|
|
107
150
|
for (let i = 0; i < 2; i += 1) {
|
|
108
|
-
await this.broadcast(
|
|
109
|
-
mobile:
|
|
110
|
-
sims:
|
|
111
|
-
nosim:
|
|
112
|
-
slot:
|
|
151
|
+
await this.broadcast("network", {
|
|
152
|
+
mobile: "show",
|
|
153
|
+
sims: "1",
|
|
154
|
+
nosim: "hide",
|
|
155
|
+
slot: "0",
|
|
113
156
|
datatype: value,
|
|
114
|
-
fully:
|
|
115
|
-
roam:
|
|
116
|
-
level:
|
|
117
|
-
inflate:
|
|
118
|
-
activity:
|
|
119
|
-
carriernetworkchange:
|
|
157
|
+
fully: "true",
|
|
158
|
+
roam: "false",
|
|
159
|
+
level: "4",
|
|
160
|
+
inflate: "false",
|
|
161
|
+
activity: "in",
|
|
162
|
+
carriernetworkchange: "hide",
|
|
120
163
|
});
|
|
121
164
|
}
|
|
122
165
|
}
|
|
123
166
|
|
|
124
|
-
public async setMobileSignalStrength(
|
|
125
|
-
|
|
167
|
+
public async setMobileSignalStrength(
|
|
168
|
+
value: DemoModeSignalStrength
|
|
169
|
+
): Promise<void> {
|
|
170
|
+
await this.broadcast("network", { mobile: "show", level: value });
|
|
126
171
|
}
|
|
127
172
|
|
|
128
173
|
public async setNoSimCardIcon(show: boolean): Promise<void> {
|
|
129
|
-
await this.broadcast(
|
|
174
|
+
await this.broadcast("network", { nosim: show ? "show" : "hide" });
|
|
130
175
|
}
|
|
131
176
|
|
|
132
177
|
public async setStatusBarMode(mode: DemoModeStatusBarMode): Promise<void> {
|
|
133
|
-
await this.broadcast(
|
|
178
|
+
await this.broadcast("bars", { mode });
|
|
134
179
|
}
|
|
135
180
|
|
|
136
181
|
public async setVibrateModeEnabled(value: boolean): Promise<void> {
|
|
137
182
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java;l=103
|
|
138
|
-
await this.broadcast(
|
|
183
|
+
await this.broadcast("status", { volume: value ? "vibrate" : "hide" });
|
|
139
184
|
}
|
|
140
185
|
|
|
141
186
|
public async setBluetoothConnected(value: boolean): Promise<void> {
|
|
142
187
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java;l=114
|
|
143
|
-
await this.broadcast(
|
|
188
|
+
await this.broadcast("status", {
|
|
189
|
+
bluetooth: value ? "connected" : "hide",
|
|
190
|
+
});
|
|
144
191
|
}
|
|
145
192
|
|
|
146
193
|
public async setLocatingIcon(show: boolean): Promise<void> {
|
|
147
|
-
await this.broadcast(
|
|
194
|
+
await this.broadcast("status", { location: show ? "show" : "hide" });
|
|
148
195
|
}
|
|
149
196
|
|
|
150
197
|
public async setAlarmIcon(show: boolean): Promise<void> {
|
|
151
|
-
await this.broadcast(
|
|
198
|
+
await this.broadcast("status", { alarm: show ? "show" : "hide" });
|
|
152
199
|
}
|
|
153
200
|
|
|
154
201
|
public async setSyncingIcon(show: boolean): Promise<void> {
|
|
155
|
-
await this.broadcast(
|
|
202
|
+
await this.broadcast("status", { sync: show ? "show" : "hide" });
|
|
156
203
|
}
|
|
157
204
|
|
|
158
205
|
public async setMuteIcon(show: boolean): Promise<void> {
|
|
159
|
-
await this.broadcast(
|
|
206
|
+
await this.broadcast("status", { mute: show ? "show" : "hide" });
|
|
160
207
|
}
|
|
161
208
|
|
|
162
209
|
public async setSpeakerPhoneIcon(show: boolean): Promise<void> {
|
|
163
|
-
await this.broadcast(
|
|
210
|
+
await this.broadcast("status", {
|
|
211
|
+
speakerphone: show ? "show" : "hide",
|
|
212
|
+
});
|
|
164
213
|
}
|
|
165
214
|
|
|
166
215
|
public async setNotificationsVisibility(show: boolean): Promise<void> {
|
|
167
216
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java;l=3131
|
|
168
|
-
await this.broadcast(
|
|
217
|
+
await this.broadcast("notifications", { visible: show.toString() });
|
|
169
218
|
}
|
|
170
219
|
|
|
171
220
|
public async setTime(hour: number, minute: number): Promise<void> {
|
|
172
|
-
await this.broadcast(
|
|
221
|
+
await this.broadcast("clock", {
|
|
173
222
|
// cspell: disable-next-line
|
|
174
223
|
hhmm:
|
|
175
|
-
hour.toString().padStart(2,
|
|
176
|
-
minute.toString().padStart(2,
|
|
224
|
+
hour.toString().padStart(2, "0") +
|
|
225
|
+
minute.toString().padStart(2, "0"),
|
|
177
226
|
});
|
|
178
227
|
}
|
|
179
228
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// cspell: ignore logcat
|
|
2
2
|
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
3
|
+
export * from "./bug-report.js";
|
|
4
|
+
export * from "./cmd.js";
|
|
5
|
+
export * from "./demo-mode.js";
|
|
6
|
+
export * from "./logcat.js";
|
|
7
|
+
export * from "./pm.js";
|
|
8
|
+
export * from "./settings.js";
|