Prevent NPE on A/B devices

The NPE shouldn't happen as we get a null intent only when the
service is sticky (i.e., isInstallingUpdate() is true), so this
is currently not a problem.

Change-Id: I8647498d9a1022f5c7207a2da3e42cf57d9ee030
This commit is contained in:
Gabriele M
2018-03-24 16:17:20 +01:00
parent a409a4a03d
commit 2ec8fc6cec

View File

@@ -162,12 +162,14 @@ public class UpdaterService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "Starting service");
if ((intent == null || intent.getAction() == null) &&
ABUpdateInstaller.isInstallingUpdate(this)) {
// The service is being restarted.
ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this, mUpdaterController);
if (installer.reconnect()) {
return START_STICKY;
if (intent == null || intent.getAction() == null) {
if (ABUpdateInstaller.isInstallingUpdate(this)) {
// The service is being restarted.
ABUpdateInstaller installer = ABUpdateInstaller.getInstance(this,
mUpdaterController);
if (installer.reconnect()) {
return START_STICKY;
}
}
} else if (ACTION_DOWNLOAD_CONTROL.equals(intent.getAction())) {
String downloadId = intent.getStringExtra(EXTRA_DOWNLOAD_ID);