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