@@ -87,14 +87,14 @@ class AndroidDebugService implements IDebugService {
87
87
}
88
88
89
89
private unixSocketForward ( local : number , remote : string ) : IFuture < void > {
90
- return this . device . adb . executeCommand ( [ "forward" , `tcp:${ local . toString ( ) } ` , `localabstract:${ remote } ` ] ) ;
90
+ return this . device . adb . executeCommand ( [ "forward" , `tcp:${ local . toString ( ) } ` , `localabstract:${ remote } ` ] ) ;
91
91
}
92
92
93
93
private debugOnDevice ( ) : IFuture < void > {
94
94
return ( ( ) => {
95
95
let packageFile = "" ;
96
96
97
- if ( ! this . $options . debugBrk && ! this . $options . start && ! this . $options . getPort && ! this . $options . stop ) {
97
+ if ( ! this . $options . debugBrk && ! this . $options . start && ! this . $options . getPort && ! this . $options . stop ) {
98
98
this . $logger . warn ( "Neither --debug-brk nor --start option was specified. Defaulting to --debug-brk." ) ;
99
99
this . $options . debugBrk = true ;
100
100
}
@@ -110,14 +110,14 @@ class AndroidDebugService implements IDebugService {
110
110
this . $logger . out ( "Using " , packageFile ) ;
111
111
}
112
112
113
- this . $devicesService . initialize ( { platform : this . platform , deviceId : this . $options . device } ) . wait ( ) ;
113
+ this . $devicesService . initialize ( { platform : this . platform , deviceId : this . $options . device } ) . wait ( ) ;
114
114
let action = ( device : Mobile . IAndroidDevice ) : IFuture < void > => { return this . debugCore ( device , packageFile , this . $projectData . projectId ) ; } ;
115
115
this . $devicesService . execute ( action ) . wait ( ) ;
116
116
117
117
} ) . future < void > ( ) ( ) ;
118
118
}
119
119
120
- private debugCore ( device : Mobile . IAndroidDevice , packageFile : string , packageName : string ) : IFuture < void > {
120
+ private debugCore ( device : Mobile . IAndroidDevice , packageFile : string , packageName : string ) : IFuture < void > {
121
121
return ( ( ) => {
122
122
this . device = device ;
123
123
@@ -145,9 +145,11 @@ class AndroidDebugService implements IDebugService {
145
145
let startDebuggerCommand = [ "am" , "broadcast" , "-a" , '\"${packageName}-debug\"' , "--ez" , "enable" , "true" ] ;
146
146
this . device . adb . executeShellCommand ( startDebuggerCommand ) . wait ( ) ;
147
147
148
- let port = this . getForwardedLocalDebugPortForPackageName ( deviceId , packageName ) . wait ( ) ;
149
- this . startDebuggerClient ( port ) . wait ( ) ;
150
- this . openDebuggerClient ( AndroidDebugService . DEFAULT_NODE_INSPECTOR_URL + "?port=" + port ) ;
148
+ if ( this . $options . client ) {
149
+ let port = this . getForwardedLocalDebugPortForPackageName ( deviceId , packageName ) . wait ( ) ;
150
+ this . startDebuggerClient ( port ) . wait ( ) ;
151
+ this . openDebuggerClient ( AndroidDebugService . DEFAULT_NODE_INSPECTOR_URL + "?port=" + port ) ;
152
+ }
151
153
} ) . future < void > ( ) ( ) ;
152
154
}
153
155
@@ -157,7 +159,7 @@ class AndroidDebugService implements IDebugService {
157
159
158
160
private startAppWithDebugger ( packageFile : string , packageName : string ) : IFuture < void > {
159
161
return ( ( ) => {
160
- if ( ! this . $options . emulator ) {
162
+ if ( ! this . $options . emulator ) {
161
163
this . device . applicationManager . uninstallApplication ( packageName ) . wait ( ) ;
162
164
this . device . applicationManager . installApplication ( packageFile ) . wait ( ) ;
163
165
}
@@ -167,7 +169,7 @@ class AndroidDebugService implements IDebugService {
167
169
168
170
public debugStart ( ) : IFuture < void > {
169
171
return ( ( ) => {
170
- this . $devicesService . initialize ( { platform : this . platform , deviceId : this . $options . device } ) . wait ( ) ;
172
+ this . $devicesService . initialize ( { platform : this . platform , deviceId : this . $options . device } ) . wait ( ) ;
171
173
let action = ( device : Mobile . IAndroidDevice ) : IFuture < void > => {
172
174
this . device = device ;
173
175
return this . debugStartCore ( ) ;
@@ -185,9 +187,11 @@ class AndroidDebugService implements IDebugService {
185
187
this . device . applicationManager . stopApplication ( packageName ) . wait ( ) ;
186
188
this . device . applicationManager . startApplication ( packageName ) . wait ( ) ;
187
189
188
- let localDebugPort = this . getForwardedLocalDebugPortForPackageName ( this . device . deviceInfo . identifier , packageName ) . wait ( ) ;
189
- this . startDebuggerClient ( localDebugPort ) . wait ( ) ;
190
- this . openDebuggerClient ( AndroidDebugService . DEFAULT_NODE_INSPECTOR_URL + "?port=" + localDebugPort ) ;
190
+ if ( this . $options . client ) {
191
+ let localDebugPort = this . getForwardedLocalDebugPortForPackageName ( this . device . deviceInfo . identifier , packageName ) . wait ( ) ;
192
+ this . startDebuggerClient ( localDebugPort ) . wait ( ) ;
193
+ this . openDebuggerClient ( AndroidDebugService . DEFAULT_NODE_INSPECTOR_URL + "?port=" + localDebugPort ) ;
194
+ }
191
195
} ) . future < void > ( ) ( ) ;
192
196
}
193
197
@@ -202,16 +206,16 @@ class AndroidDebugService implements IDebugService {
202
206
203
207
private openDebuggerClient ( url : string ) : void {
204
208
let defaultDebugUI = "chrome" ;
205
- if ( this . $hostInfo . isDarwin ) {
209
+ if ( this . $hostInfo . isDarwin ) {
206
210
defaultDebugUI = "Google Chrome" ;
207
211
}
208
- if ( this . $hostInfo . isLinux ) {
212
+ if ( this . $hostInfo . isLinux ) {
209
213
defaultDebugUI = "google-chrome" ;
210
214
}
211
215
212
216
let debugUI = this . $config . ANDROID_DEBUG_UI || defaultDebugUI ;
213
217
let child = this . $opener . open ( url , debugUI ) ;
214
- if ( ! child ) {
218
+ if ( ! child ) {
215
219
this . $errors . failWithoutHelp ( `Unable to open ${ debugUI } .` ) ;
216
220
}
217
221
}
0 commit comments