OpenDelta: Reliably show when an update is pending a reboot
This commit is contained in:
parent
a3fa47ede7
commit
5ee40c7d61
|
@ -528,6 +528,18 @@ public class UpdateService extends Service implements OnNetworkStateListener,
|
|||
return;
|
||||
}
|
||||
|
||||
// Check if a previous update was done already
|
||||
if (prefs.getBoolean(PREF_PENDING_REBOOT, false) ||
|
||||
this.state.equals(STATE_ACTION_AB_FINISHED)) {
|
||||
updateState(STATE_ACTION_AB_FINISHED);
|
||||
return;
|
||||
}
|
||||
if (ABUpdate.isInstallingUpdate(this)) {
|
||||
final String lastFilename = prefs.getString(PREF_CURRENT_AB_FILENAME_NAME, null);
|
||||
ABUpdate.pokeStatus(lastFilename, this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we're currently installing an A/B update
|
||||
if (Config.isABDevice() && ABUpdate.isInstallingUpdate(this)) {
|
||||
// resume listening to progress
|
||||
|
@ -555,14 +567,6 @@ public class UpdateService extends Service implements OnNetworkStateListener,
|
|||
}
|
||||
}
|
||||
|
||||
// Check if a previous update was done already
|
||||
if (prefs.getBoolean(PREF_PENDING_REBOOT, false)) {
|
||||
final String lastFilename = prefs.getString(PREF_CURRENT_AB_FILENAME_NAME, null);
|
||||
prefs.edit().putBoolean(PREF_PENDING_REBOOT, false).apply();
|
||||
ABUpdate.pokeStatus(lastFilename, this);
|
||||
return;
|
||||
}
|
||||
|
||||
// let's check if we have a .part file that is still latest
|
||||
List<String> latestFullBuildWithUrl = getNewestFullBuild();
|
||||
String latestFullBuild;
|
||||
|
@ -1371,8 +1375,12 @@ public class UpdateService extends Service implements OnNetworkStateListener,
|
|||
return false;
|
||||
|
||||
// Check if a previous update was done already
|
||||
if (prefs.getBoolean(PREF_PENDING_REBOOT, false) ||
|
||||
ABUpdate.isInstallingUpdate(this)) {
|
||||
if (this.state.equals(STATE_ACTION_AB_FINISHED)) return false;
|
||||
if (prefs.getBoolean(PREF_PENDING_REBOOT, false)) {
|
||||
updateState(STATE_ACTION_AB_FINISHED);
|
||||
return false;
|
||||
}
|
||||
if (ABUpdate.isInstallingUpdate(this)) {
|
||||
final String lastFilename = prefs.getString(PREF_CURRENT_AB_FILENAME_NAME, null);
|
||||
ABUpdate.pokeStatus(lastFilename, this);
|
||||
return false;
|
||||
|
@ -1827,6 +1835,7 @@ public class UpdateService extends Service implements OnNetworkStateListener,
|
|||
}
|
||||
|
||||
protected void onUpdateCompleted(int status, int errorCode) {
|
||||
Logger.d("onUpdateCompleted status = " + status);
|
||||
stopNotification();
|
||||
updateRunning = false;
|
||||
if (status == UpdateEngine.ErrorCodeConstants.SUCCESS) {
|
||||
|
|
Loading…
Reference in New Issue