@@ -73,7 +73,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
73
73
errmsg = this .getString (R .string .error_run_command_service_invalid_intent_action , intent .getAction ());
74
74
executionCommand .setStateFailed (Errno .ERRNO_FAILED .getCode (), errmsg );
75
75
PluginUtils .processPluginExecutionCommandError (this , LOG_TAG , executionCommand , false );
76
- return Service . START_NOT_STICKY ;
76
+ return stopService () ;
77
77
}
78
78
79
79
String executableExtra = executionCommand .executable = IntentUtils .getStringExtraIfSet (intent , RUN_COMMAND_SERVICE .EXTRA_COMMAND_PATH , null );
@@ -125,7 +125,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
125
125
if (errmsg != null ) {
126
126
executionCommand .setStateFailed (Errno .ERRNO_FAILED .getCode (), errmsg );
127
127
PluginUtils .processPluginExecutionCommandError (this , LOG_TAG , executionCommand , true );
128
- return Service . START_NOT_STICKY ;
128
+ return stopService () ;
129
129
}
130
130
131
131
@@ -135,7 +135,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
135
135
errmsg = this .getString (R .string .error_run_command_service_mandatory_extra_missing , RUN_COMMAND_SERVICE .EXTRA_COMMAND_PATH );
136
136
executionCommand .setStateFailed (Errno .ERRNO_FAILED .getCode (), errmsg );
137
137
PluginUtils .processPluginExecutionCommandError (this , LOG_TAG , executionCommand , false );
138
- return Service . START_NOT_STICKY ;
138
+ return stopService () ;
139
139
}
140
140
141
141
// Get canonical path of executable
@@ -150,7 +150,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
150
150
error .appendMessage ("\n " + this .getString (R .string .msg_executable_absolute_path , executionCommand .executable ));
151
151
executionCommand .setStateFailed (error );
152
152
PluginUtils .processPluginExecutionCommandError (this , LOG_TAG , executionCommand , false );
153
- return Service . START_NOT_STICKY ;
153
+ return stopService () ;
154
154
}
155
155
156
156
@@ -172,7 +172,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
172
172
error .appendMessage ("\n " + this .getString (R .string .msg_working_directory_absolute_path , executionCommand .workingDirectory ));
173
173
executionCommand .setStateFailed (error );
174
174
PluginUtils .processPluginExecutionCommandError (this , LOG_TAG , executionCommand , false );
175
- return Service . START_NOT_STICKY ;
175
+ return stopService () ;
176
176
}
177
177
}
178
178
@@ -219,8 +219,11 @@ public int onStartCommand(Intent intent, int flags, int startId) {
219
219
this .startService (execIntent );
220
220
}
221
221
222
- runStopForeground ();
222
+ return stopService ();
223
+ }
223
224
225
+ private int stopService () {
226
+ runStopForeground ();
224
227
return Service .START_NOT_STICKY ;
225
228
}
226
229
0 commit comments