@aiot-toolkit/emulator 2.0.5-widget-provider-beta.2 → 2.0.5
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/README.md +173 -173
- package/lib/emulatorutil/constants.js +11 -11
- package/lib/emulatorutil/running.js +14 -6
- package/lib/index.d.ts +2 -2
- package/lib/index.js +12 -0
- package/lib/instance/common.d.ts +5 -2
- package/lib/instance/common.js +26 -5
- package/lib/instance/dev.d.ts +4 -1
- package/lib/instance/dev.js +9 -9
- package/lib/instance/index.js +6 -6
- package/lib/instance/minisound.js +6 -6
- package/lib/instance/miwear.d.ts +5 -1
- package/lib/instance/miwear.js +44 -22
- package/lib/instance/miwear5.d.ts +0 -1
- package/lib/instance/miwear5.js +0 -1
- package/lib/instance/pre.d.ts +4 -1
- package/lib/instance/pre.js +9 -9
- package/lib/instance/vela5.d.ts +5 -0
- package/lib/instance/vela5.js +63 -4
- package/lib/shared/index.d.ts +9 -0
- package/lib/shared/index.js +16 -4
- package/lib/static/advancedFeatures.ini +1 -1
- package/lib/static/avdConfigIni.json +45 -39
- package/lib/static/debugger_ip.cfg +1 -1
- package/lib/static/proto/README.MD +2 -2
- package/lib/static/proto/emulator_controller.proto +1321 -1321
- package/lib/static/proto/rtc_service.proto +117 -117
- package/lib/typing/Instance.js +3 -3
- package/lib/typing/Vvd.d.ts +3 -3
- package/lib/typing/Vvd.js +1 -2
- package/lib/utils/file.d.ts +8 -0
- package/lib/utils/file.js +48 -1
- package/lib/utils/index.js +19 -19
- package/lib/vvd/index.d.ts +5 -1
- package/lib/vvd/index.js +127 -43
- package/lib/vvd/logcat.js +3 -3
- package/package.json +3 -3
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
// Copyright (C) 2018 The Android Open Source Project
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
// Note that if you add/remove methods in this file you must update
|
|
16
|
-
// the metrics sql as well by running ./android/scripts/gen-grpc-sql.py
|
|
17
|
-
//
|
|
18
|
-
// Please group deleted methods in a block including the date (MM/DD/YY)
|
|
19
|
-
// it was removed. This enables us to easily keep metrics around after removal
|
|
20
|
-
//
|
|
21
|
-
// List of deleted methods
|
|
22
|
-
// rpc iWasDeleted (03/12/12)
|
|
23
|
-
// ...
|
|
24
|
-
syntax = "proto3";
|
|
25
|
-
|
|
26
|
-
option java_multiple_files = true;
|
|
27
|
-
option java_package = "com.android.emulator.control";
|
|
28
|
-
option objc_class_prefix = "AEC";
|
|
29
|
-
|
|
30
|
-
package android.emulation.control;
|
|
31
|
-
import "google/protobuf/empty.proto";
|
|
32
|
-
|
|
33
|
-
// An RTC service lets you interact with the emulator through WebRTC
|
|
34
|
-
// Note that this is currently an experimental feature, and that the
|
|
35
|
-
// service definition might change without notice. Use at your own risk!
|
|
36
|
-
//
|
|
37
|
-
// The following endpoints are needed to establish the webrtc protocol
|
|
38
|
-
// Due to limitiations in Javascript we cannot make use of bidirectional
|
|
39
|
-
// endpoints See this [blog](https://grpc.io/blog/state-of-grpc-web) for
|
|
40
|
-
// details.
|
|
41
|
-
service Rtc {
|
|
42
|
-
// This function will generate a new identifier that the client
|
|
43
|
-
// should use for further interaction. It will initiate the
|
|
44
|
-
// JSEP protocol on the server side.
|
|
45
|
-
rpc requestRtcStream(google.protobuf.Empty) returns (RtcId) {}
|
|
46
|
-
|
|
47
|
-
// Sends the given JsepMsg to the server. The RtcId in the
|
|
48
|
-
// message should point to an active stream negotiation in
|
|
49
|
-
// progress, otherwise the message will be ignored.
|
|
50
|
-
rpc sendJsepMessage(JsepMsg) returns (google.protobuf.Empty) {}
|
|
51
|
-
|
|
52
|
-
// Reads an available jsep messages for the given client id,
|
|
53
|
-
// blocking until one becomes available. Do not use the polling version
|
|
54
|
-
// above if you opt for this one.
|
|
55
|
-
//
|
|
56
|
-
// The ice candidates for example will trickle in on this callback,
|
|
57
|
-
// as will the SDP negotation.
|
|
58
|
-
rpc receiveJsepMessages(RtcId) returns (stream JsepMsg) {}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// [DEPRECATED] This is only here as the go grpc webproxy used
|
|
62
|
-
// by fuchsia does not support server side streaming. This method
|
|
63
|
-
// will be removed in the future and should not be relied upon.
|
|
64
|
-
//
|
|
65
|
-
// Reads an available jsep messages for the given client id,
|
|
66
|
-
// blocking until one becomes available. Do not use the polling version
|
|
67
|
-
// above if you opt for this one.
|
|
68
|
-
//
|
|
69
|
-
// The ice candidates for example will trickle in on this callback,
|
|
70
|
-
// as will the SDP negotation.
|
|
71
|
-
rpc receiveJsepMessage(RtcId) returns (JsepMsg) {}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
message RtcId {
|
|
75
|
-
// The unique identifier of this connection. You will have to use the
|
|
76
|
-
// same identifier when sending/receiving messages. The server will
|
|
77
|
-
// generate a guid when receiving the start message.
|
|
78
|
-
string guid = 1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
message JsepMsg {
|
|
82
|
-
// The unique identifier of this connection. You will have to use the
|
|
83
|
-
// same identifier when sending/receiving messages. The server will
|
|
84
|
-
// generate a guid when receiving the start message.
|
|
85
|
-
RtcId id = 1;
|
|
86
|
-
// The JSON payload. This usually can be directly handled by the
|
|
87
|
-
// Javascript library.
|
|
88
|
-
//
|
|
89
|
-
// The dictionary can contain the following properties
|
|
90
|
-
//
|
|
91
|
-
// - bye:
|
|
92
|
-
// You can hang up now. No new message expected for you.
|
|
93
|
-
// The server has stopped the RTC stream.
|
|
94
|
-
//
|
|
95
|
-
// - start:
|
|
96
|
-
// An RTCConfiguration dictionary providing options to
|
|
97
|
-
// configure the new connection. This can include the
|
|
98
|
-
// turn configuration the serve is using. This dictionary can be
|
|
99
|
-
// passed in directly to the
|
|
100
|
-
// [RTCPeerConnection](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection)
|
|
101
|
-
// object.
|
|
102
|
-
//
|
|
103
|
-
// - candidate:
|
|
104
|
-
// The WebRTC API's RTCIceCandidateInit dictionary, which
|
|
105
|
-
// contains the information needed to fundamentally describe an
|
|
106
|
-
// RTCIceCandidate. See
|
|
107
|
-
// [RTCIceCandidate](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate)
|
|
108
|
-
// and [Session
|
|
109
|
-
// Lifetime](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Session_lifetime)
|
|
110
|
-
// for more details.
|
|
111
|
-
//
|
|
112
|
-
// - sdp:
|
|
113
|
-
// RTCSessionDescriptionInit dictionary containing the values
|
|
114
|
-
// to that can be assigned to a
|
|
115
|
-
// [RTCSessionDescription](https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription)
|
|
116
|
-
string message = 2;
|
|
117
|
-
}
|
|
1
|
+
// Copyright (C) 2018 The Android Open Source Project
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
// Note that if you add/remove methods in this file you must update
|
|
16
|
+
// the metrics sql as well by running ./android/scripts/gen-grpc-sql.py
|
|
17
|
+
//
|
|
18
|
+
// Please group deleted methods in a block including the date (MM/DD/YY)
|
|
19
|
+
// it was removed. This enables us to easily keep metrics around after removal
|
|
20
|
+
//
|
|
21
|
+
// List of deleted methods
|
|
22
|
+
// rpc iWasDeleted (03/12/12)
|
|
23
|
+
// ...
|
|
24
|
+
syntax = "proto3";
|
|
25
|
+
|
|
26
|
+
option java_multiple_files = true;
|
|
27
|
+
option java_package = "com.android.emulator.control";
|
|
28
|
+
option objc_class_prefix = "AEC";
|
|
29
|
+
|
|
30
|
+
package android.emulation.control;
|
|
31
|
+
import "google/protobuf/empty.proto";
|
|
32
|
+
|
|
33
|
+
// An RTC service lets you interact with the emulator through WebRTC
|
|
34
|
+
// Note that this is currently an experimental feature, and that the
|
|
35
|
+
// service definition might change without notice. Use at your own risk!
|
|
36
|
+
//
|
|
37
|
+
// The following endpoints are needed to establish the webrtc protocol
|
|
38
|
+
// Due to limitiations in Javascript we cannot make use of bidirectional
|
|
39
|
+
// endpoints See this [blog](https://grpc.io/blog/state-of-grpc-web) for
|
|
40
|
+
// details.
|
|
41
|
+
service Rtc {
|
|
42
|
+
// This function will generate a new identifier that the client
|
|
43
|
+
// should use for further interaction. It will initiate the
|
|
44
|
+
// JSEP protocol on the server side.
|
|
45
|
+
rpc requestRtcStream(google.protobuf.Empty) returns (RtcId) {}
|
|
46
|
+
|
|
47
|
+
// Sends the given JsepMsg to the server. The RtcId in the
|
|
48
|
+
// message should point to an active stream negotiation in
|
|
49
|
+
// progress, otherwise the message will be ignored.
|
|
50
|
+
rpc sendJsepMessage(JsepMsg) returns (google.protobuf.Empty) {}
|
|
51
|
+
|
|
52
|
+
// Reads an available jsep messages for the given client id,
|
|
53
|
+
// blocking until one becomes available. Do not use the polling version
|
|
54
|
+
// above if you opt for this one.
|
|
55
|
+
//
|
|
56
|
+
// The ice candidates for example will trickle in on this callback,
|
|
57
|
+
// as will the SDP negotation.
|
|
58
|
+
rpc receiveJsepMessages(RtcId) returns (stream JsepMsg) {}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// [DEPRECATED] This is only here as the go grpc webproxy used
|
|
62
|
+
// by fuchsia does not support server side streaming. This method
|
|
63
|
+
// will be removed in the future and should not be relied upon.
|
|
64
|
+
//
|
|
65
|
+
// Reads an available jsep messages for the given client id,
|
|
66
|
+
// blocking until one becomes available. Do not use the polling version
|
|
67
|
+
// above if you opt for this one.
|
|
68
|
+
//
|
|
69
|
+
// The ice candidates for example will trickle in on this callback,
|
|
70
|
+
// as will the SDP negotation.
|
|
71
|
+
rpc receiveJsepMessage(RtcId) returns (JsepMsg) {}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message RtcId {
|
|
75
|
+
// The unique identifier of this connection. You will have to use the
|
|
76
|
+
// same identifier when sending/receiving messages. The server will
|
|
77
|
+
// generate a guid when receiving the start message.
|
|
78
|
+
string guid = 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
message JsepMsg {
|
|
82
|
+
// The unique identifier of this connection. You will have to use the
|
|
83
|
+
// same identifier when sending/receiving messages. The server will
|
|
84
|
+
// generate a guid when receiving the start message.
|
|
85
|
+
RtcId id = 1;
|
|
86
|
+
// The JSON payload. This usually can be directly handled by the
|
|
87
|
+
// Javascript library.
|
|
88
|
+
//
|
|
89
|
+
// The dictionary can contain the following properties
|
|
90
|
+
//
|
|
91
|
+
// - bye:
|
|
92
|
+
// You can hang up now. No new message expected for you.
|
|
93
|
+
// The server has stopped the RTC stream.
|
|
94
|
+
//
|
|
95
|
+
// - start:
|
|
96
|
+
// An RTCConfiguration dictionary providing options to
|
|
97
|
+
// configure the new connection. This can include the
|
|
98
|
+
// turn configuration the serve is using. This dictionary can be
|
|
99
|
+
// passed in directly to the
|
|
100
|
+
// [RTCPeerConnection](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection)
|
|
101
|
+
// object.
|
|
102
|
+
//
|
|
103
|
+
// - candidate:
|
|
104
|
+
// The WebRTC API's RTCIceCandidateInit dictionary, which
|
|
105
|
+
// contains the information needed to fundamentally describe an
|
|
106
|
+
// RTCIceCandidate. See
|
|
107
|
+
// [RTCIceCandidate](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate)
|
|
108
|
+
// and [Session
|
|
109
|
+
// Lifetime](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Session_lifetime)
|
|
110
|
+
// for more details.
|
|
111
|
+
//
|
|
112
|
+
// - sdp:
|
|
113
|
+
// RTCSessionDescriptionInit dictionary containing the values
|
|
114
|
+
// to that can be assigned to a
|
|
115
|
+
// [RTCSessionDescription](https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription)
|
|
116
|
+
string message = 2;
|
|
117
|
+
}
|
package/lib/typing/Instance.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.IStartOrigin = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* 如果指定了 serialPort 则必须同时指定 grpcPort
|
|
9
|
-
* 否则
|
|
7
|
+
/**
|
|
8
|
+
* 如果指定了 serialPort 则必须同时指定 grpcPort
|
|
9
|
+
* 否则
|
|
10
10
|
*/
|
|
11
11
|
let IStartOrigin = exports.IStartOrigin = /*#__PURE__*/function (IStartOrigin) {
|
|
12
12
|
IStartOrigin["Terminal"] = "terminal";
|
package/lib/typing/Vvd.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ export interface IVvdResourcePaths {
|
|
|
4
4
|
imageHome?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare enum IVvdArchType {
|
|
7
|
-
arm = "arm"
|
|
8
|
-
arm64 = "arm64"
|
|
7
|
+
arm = "arm"
|
|
9
8
|
}
|
|
10
9
|
export declare enum VelaImageType {
|
|
11
10
|
VELA_MIWEAR_MINISOUND_5 = "vela-miwear-minisound-5.0",
|
|
@@ -37,6 +36,7 @@ export interface EmulatorPart {
|
|
|
37
36
|
height: string;
|
|
38
37
|
x: string;
|
|
39
38
|
y: string;
|
|
39
|
+
corner_radius: string;
|
|
40
40
|
shape?: string;
|
|
41
41
|
flavor?: string;
|
|
42
42
|
density?: string;
|
|
@@ -103,7 +103,7 @@ export declare enum SDKParts {
|
|
|
103
103
|
MODEM_SIMULATOR = "modem_simulator"
|
|
104
104
|
}
|
|
105
105
|
export declare enum VELAHOME {
|
|
106
|
-
SDK = ".
|
|
106
|
+
SDK = ".vela/sdk",
|
|
107
107
|
VVD = ".vela/vvd"
|
|
108
108
|
}
|
|
109
109
|
export type SDKDownloadOpt = {
|
package/lib/typing/Vvd.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.VelaImageType = exports.VELAHOME = exports.SDKParts = exports.IVvdArchType = void 0;
|
|
7
7
|
let IVvdArchType = exports.IVvdArchType = /*#__PURE__*/function (IVvdArchType) {
|
|
8
8
|
IVvdArchType["arm"] = "arm";
|
|
9
|
-
IVvdArchType["arm64"] = "arm64";
|
|
10
9
|
return IVvdArchType;
|
|
11
10
|
}({});
|
|
12
11
|
let VelaImageType = exports.VelaImageType = /*#__PURE__*/function (VelaImageType) {
|
|
@@ -27,7 +26,7 @@ let SDKParts = exports.SDKParts = /*#__PURE__*/function (SDKParts) {
|
|
|
27
26
|
return SDKParts;
|
|
28
27
|
}({});
|
|
29
28
|
let VELAHOME = exports.VELAHOME = /*#__PURE__*/function (VELAHOME) {
|
|
30
|
-
VELAHOME["SDK"] = ".
|
|
29
|
+
VELAHOME["SDK"] = ".vela/sdk";
|
|
31
30
|
VELAHOME["VVD"] = ".vela/vvd";
|
|
32
31
|
return VELAHOME;
|
|
33
32
|
}({});
|
package/lib/utils/file.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param mode Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE)
|
|
3
|
+
*/
|
|
4
|
+
export declare function copyDir(source: string, target: string, mode?: number): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* @param mode Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE)
|
|
7
|
+
*/
|
|
8
|
+
export declare function copyDirSync(source: string, target: string, mode?: number): void;
|
package/lib/utils/file.js
CHANGED
|
@@ -1 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.copyDir = copyDir;
|
|
7
|
+
exports.copyDirSync = copyDirSync;
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var _promises = _interopRequireDefault(require("fs/promises"));
|
|
10
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
/**
|
|
13
|
+
* @param mode Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE)
|
|
14
|
+
*/
|
|
15
|
+
async function copyDir(source, target, mode) {
|
|
16
|
+
const entries = await _promises.default.readdir(source, {
|
|
17
|
+
withFileTypes: true
|
|
18
|
+
});
|
|
19
|
+
await _promises.default.mkdir(target, {
|
|
20
|
+
recursive: true
|
|
21
|
+
});
|
|
22
|
+
await Promise.all(entries.map(entry => {
|
|
23
|
+
const srcPath = _path.default.join(source, entry.name);
|
|
24
|
+
const destPath = _path.default.join(target, entry.name);
|
|
25
|
+
return entry.isDirectory() ? copyDir(srcPath, destPath, mode) : _promises.default.copyFile(srcPath, destPath, mode);
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param mode Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE)
|
|
31
|
+
*/
|
|
32
|
+
function copyDirSync(source, target, mode) {
|
|
33
|
+
_fs.default.mkdirSync(target, {
|
|
34
|
+
recursive: true
|
|
35
|
+
});
|
|
36
|
+
const entries = _fs.default.readdirSync(source, {
|
|
37
|
+
withFileTypes: true
|
|
38
|
+
});
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
const srcPath = _path.default.join(source, entry.name);
|
|
41
|
+
const destPath = _path.default.join(target, entry.name);
|
|
42
|
+
if (entry.isDirectory()) {
|
|
43
|
+
copyDirSync(srcPath, destPath, mode);
|
|
44
|
+
} else {
|
|
45
|
+
_fs.default.copyFileSync(srcPath, destPath, mode);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
package/lib/utils/index.js
CHANGED
|
@@ -24,9 +24,9 @@ const cpuArch = {
|
|
|
24
24
|
x86_64: 'x86_64'
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
/** 获取mac电脑的CPU架构
|
|
28
|
-
* node 15.0.0之后,m1芯片的mac的os.arch()才是arm64,在这之前都是x86
|
|
29
|
-
* 所以15.0.0之前无法通过os.arch()区分,也无法通过execSync('uname -m')区分
|
|
27
|
+
/** 获取mac电脑的CPU架构
|
|
28
|
+
* node 15.0.0之后,m1芯片的mac的os.arch()才是arm64,在这之前都是x86
|
|
29
|
+
* 所以15.0.0之前无法通过os.arch()区分,也无法通过execSync('uname -m')区分
|
|
30
30
|
*/
|
|
31
31
|
function getSystemArch() {
|
|
32
32
|
const platform = _os.default.platform();
|
|
@@ -56,8 +56,8 @@ function killProcessByPid(pid) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
* 根据命令杀死进程
|
|
59
|
+
/**
|
|
60
|
+
* 根据命令杀死进程
|
|
61
61
|
*/
|
|
62
62
|
async function killProcessByCmd(cmd) {
|
|
63
63
|
if (!cmd) return;
|
|
@@ -76,11 +76,11 @@ async function sleep(time) {
|
|
|
76
76
|
return new Promise(resolve => setTimeout(resolve, time));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
* 重复执行某个任务直到成功,或者超过最大次数
|
|
81
|
-
* @param task 任务,需要返回 bool 值表示是否执行成功
|
|
82
|
-
* @param {Number=} maxCount 最大重试次数
|
|
83
|
-
* @param {number=} duration 每次重试的间隔
|
|
79
|
+
/**
|
|
80
|
+
* 重复执行某个任务直到成功,或者超过最大次数
|
|
81
|
+
* @param task 任务,需要返回 bool 值表示是否执行成功
|
|
82
|
+
* @param {Number=} maxCount 最大重试次数
|
|
83
|
+
* @param {number=} duration 每次重试的间隔
|
|
84
84
|
*/
|
|
85
85
|
async function tryRun(task) {
|
|
86
86
|
let maxCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
@@ -90,11 +90,11 @@ async function tryRun(task) {
|
|
|
90
90
|
return Boolean(await task()) || (await delayRun(() => tryRun(task, maxCount, duration, currentCount + 1), duration));
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
/**
|
|
94
|
-
* 延迟执行某个任务
|
|
95
|
-
* @param task
|
|
96
|
-
* @param duration
|
|
97
|
-
* @returns
|
|
93
|
+
/**
|
|
94
|
+
* 延迟执行某个任务
|
|
95
|
+
* @param task
|
|
96
|
+
* @param duration
|
|
97
|
+
* @returns
|
|
98
98
|
*/
|
|
99
99
|
async function delayRun(task) {
|
|
100
100
|
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
@@ -105,10 +105,10 @@ async function delayRun(task) {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
/**
|
|
109
|
-
* 为avdPort寻找一个不被占用的端口
|
|
110
|
-
* 端口号必须是偶数且在5555和5585之间
|
|
111
|
-
* @returns {number}
|
|
108
|
+
/**
|
|
109
|
+
* 为avdPort寻找一个不被占用的端口
|
|
110
|
+
* 端口号必须是偶数且在5555和5585之间
|
|
111
|
+
* @returns {number}
|
|
112
112
|
*/
|
|
113
113
|
async function getEvenPort() {
|
|
114
114
|
const startPort = 5556;
|
package/lib/vvd/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { IVvdParams, IVvdResourcePaths, SDKParts, SDKDownloadOpt, SkinInfo, VelaImageType } from '../typing/Vvd';
|
|
2
2
|
import { IStartOptions, IStartWithSerialPort } from '../typing/Instance';
|
|
3
|
+
import { EmulatorConfig } from '../emulatorutil';
|
|
3
4
|
import { findInstance } from '../instance';
|
|
4
5
|
import type { DownloadFileOptions } from 'ipull';
|
|
5
6
|
import GrpcEmulator from './grpc';
|
|
7
|
+
export declare const isHeadlessEnvironment: () => boolean;
|
|
6
8
|
export declare class VvdManager {
|
|
7
9
|
private vvdHome;
|
|
8
10
|
private sdkHome;
|
|
@@ -18,7 +20,7 @@ export declare class VvdManager {
|
|
|
18
20
|
* @returns
|
|
19
21
|
*/
|
|
20
22
|
createVvd(vvdParams: IVvdParams): boolean;
|
|
21
|
-
getVvdDir(vvdName: string):
|
|
23
|
+
getVvdDir(vvdName: string): any;
|
|
22
24
|
/** 根据AVD名字获取模拟器的详细信息 */
|
|
23
25
|
getVvdInfo(vvdName: string): IVvdParams;
|
|
24
26
|
/** 根据名字删除AVD */
|
|
@@ -49,11 +51,13 @@ export declare class VvdManager {
|
|
|
49
51
|
/** 重置自定义的镜像目录 */
|
|
50
52
|
resetImageDir(vvdName: string): void;
|
|
51
53
|
getEmulatorBinPath(sdkHome: string): string;
|
|
54
|
+
oldEmulatorMigrate(vvdName: string): Promise<void>;
|
|
52
55
|
getVvdStartCmd(options: IStartOptions | IStartWithSerialPort): Promise<string>;
|
|
53
56
|
startVvd(options: IStartOptions | IStartWithSerialPort): Promise<{
|
|
54
57
|
coldBoot: boolean;
|
|
55
58
|
emulatorInstance: ReturnType<typeof findInstance>;
|
|
56
59
|
getAgent: () => GrpcEmulator;
|
|
60
|
+
grpcConfig: EmulatorConfig;
|
|
57
61
|
}>;
|
|
58
62
|
stopVvd(name: string, timeout?: number): Promise<void>;
|
|
59
63
|
/** 获取模拟器平台的名称,darwin-aarch64 linux-aarch64 windows-x86_64等 */
|