rename to FDroidApp.restartLocalRepoServiceIfRunning() for clarity

This method handles checking if the service is running, and only restarts
it if it was running.
This commit is contained in:
Hans-Christoph Steiner 2015-05-09 11:02:34 -04:00
parent c1b0b854fc
commit 6703fa3652
2 changed files with 6 additions and 3 deletions

View File

@ -337,7 +337,10 @@ public class FDroidApp extends Application {
app.stopService(new Intent(app, LocalRepoService.class)); app.stopService(new Intent(app, LocalRepoService.class));
} }
public static void restartLocalRepoService() { /**
* Handles checking if the {@link LocalRepoService} is running, and only restarts it if it was running.
*/
public static void restartLocalRepoServiceIfRunning() {
if (localRepoServiceMessenger != null) { if (localRepoServiceMessenger != null) {
try { try {
Message msg = Message.obtain(null, LocalRepoService.RESTART, LocalRepoService.RESTART, 0); Message msg = Message.obtain(null, LocalRepoService.RESTART, LocalRepoService.RESTART, 0);

View File

@ -127,7 +127,7 @@ public class WifiStateChangeService extends Service {
Intent intent = new Intent(BROADCAST); Intent intent = new Intent(BROADCAST);
LocalBroadcastManager.getInstance(WifiStateChangeService.this).sendBroadcast(intent); LocalBroadcastManager.getInstance(WifiStateChangeService.this).sendBroadcast(intent);
WifiStateChangeService.this.stopSelf(); WifiStateChangeService.this.stopSelf();
FDroidApp.restartLocalRepoService(); FDroidApp.restartLocalRepoServiceIfRunning();
} }
} }