@@ -182,35 +182,6 @@ public int compare(VarDefinition o1, VarDefinition o2) {
182182 status = Status .INIT ;
183183 }
184184
185- public void stopShell () {
186- /*
187- if (shell != null) {
188- try {
189- shell.shutdown();
190- } catch (Exception ex) {
191- ex.printStackTrace();
192- }
193- shell = null;
194- }
195- */
196- }
197-
198- public String restartShell () {
199- StringBuilder sb = new StringBuilder ();
200-
201- sb .append (AdbShell .disconnect ());
202- // Kill the Server
203- sb .append (" - " );
204- sb .append (AdbShell .killServer ());
205- // Bring it back up
206- sb .append (" - " );
207- sb .append (AdbShell .devices ());
208- // Bring the shell back up
209- sb .append (" - Connect: " ).append (shell .connect ());
210-
211- return sb .toString ();
212- }
213-
214185 public Date getLastImageDate () {
215186 return lastImageDate ;
216187 }
@@ -830,13 +801,15 @@ private StateResult executableStateProcessor(Stack<ProcessingStateInfo> stateSta
830801 } else {
831802 if (!results .contains (connectionDefinition .getApp ())) {
832803 logger .error ("App: " + connectionDefinition .getApp () + " is not running, will restart" );
833- shell .exec ("monkey -p " + connectionDefinition .getApp () + " -c android.intent.category.LAUNCHER 1" );
804+ shell .exec ("monkey --pct-syskeys 0 - p " + connectionDefinition .getApp () +" 1" );
834805 }
835806 }
836807 }
837808 } else if (StringUtils .equalsIgnoreCase (actionDefinition .getValue (), "CLOSE" )) {
838- logger .error ("Closing App: " + connectionDefinition .getApp ());
839- shell .exec ("am force-stop " + connectionDefinition .getApp ());
809+ if (StringUtils .isNotBlank (connectionDefinition .getApp ())) {
810+ logger .error ("Closing App: " + connectionDefinition .getApp ());
811+ shell .exec ("am force-stop " + connectionDefinition .getApp ());
812+ }
840813 }
841814 } break ;
842815 case REFRESH : {
0 commit comments