Use single return statement in onStartCommand()
This should prevent future changes from accidentally turning a sticky service into a not sticky one. Change-Id: I89f172626a98635149441a63536e0aa5a27f8280
This commit is contained in:
@@ -167,9 +167,7 @@ public class UpdaterService extends Service {
|
|||||||
// The service is being restarted.
|
// The service is being restarted.
|
||||||
ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this,
|
ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this,
|
||||||
mUpdaterController);
|
mUpdaterController);
|
||||||
if (installer.reconnect()) {
|
installer.reconnect();
|
||||||
return START_STICKY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (ACTION_DOWNLOAD_CONTROL.equals(intent.getAction())) {
|
} else if (ACTION_DOWNLOAD_CONTROL.equals(intent.getAction())) {
|
||||||
String downloadId = intent.getStringExtra(EXTRA_DOWNLOAD_ID);
|
String downloadId = intent.getStringExtra(EXTRA_DOWNLOAD_ID);
|
||||||
@@ -191,9 +189,7 @@ public class UpdaterService extends Service {
|
|||||||
if (Utils.isABUpdate(update.getFile())) {
|
if (Utils.isABUpdate(update.getFile())) {
|
||||||
ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this,
|
ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this,
|
||||||
mUpdaterController);
|
mUpdaterController);
|
||||||
if (installer.install(downloadId)) {
|
installer.install(downloadId);
|
||||||
return START_STICKY;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
UpdateInstaller installer = new UpdateInstaller(this, mUpdaterController);
|
UpdateInstaller installer = new UpdateInstaller(this, mUpdaterController);
|
||||||
installer.install(downloadId);
|
installer.install(downloadId);
|
||||||
@@ -215,7 +211,7 @@ public class UpdaterService extends Service {
|
|||||||
installer.cancel();
|
installer.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return START_NOT_STICKY;
|
return ABUpdateInstaller.isInstallingUpdate(this) ? START_STICKY : START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Controller getUpdaterController() {
|
public Controller getUpdaterController() {
|
||||||
|
Reference in New Issue
Block a user