Add support for A/B (Seamless) System Updates
Loosely based on:
0465cb691d
This commit is contained in:
@@ -39,6 +39,7 @@ import java.util.Set;
|
||||
public class UpdaterController implements UpdaterControllerInt {
|
||||
|
||||
public static final String ACTION_DOWNLOAD_PROGRESS = "action_download_progress";
|
||||
public static final String ACTION_INSTALL_PROGRESS = "action_install_progress";
|
||||
public static final String ACTION_UPDATE_STATUS = "action_update_status_change";
|
||||
public static final String EXTRA_DOWNLOAD_ID = "extra_download_id";
|
||||
|
||||
@@ -92,20 +93,27 @@ public class UpdaterController implements UpdaterControllerInt {
|
||||
|
||||
private Map<String, DownloadEntry> mDownloads = new HashMap<>();
|
||||
|
||||
private void notifyUpdateChange(String downloadId) {
|
||||
void notifyUpdateChange(String downloadId) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(ACTION_UPDATE_STATUS);
|
||||
intent.putExtra(EXTRA_DOWNLOAD_ID, downloadId);
|
||||
mBroadcastManager.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private void notifyDownloadProgress(String downloadId) {
|
||||
void notifyDownloadProgress(String downloadId) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(ACTION_DOWNLOAD_PROGRESS);
|
||||
intent.putExtra(EXTRA_DOWNLOAD_ID, downloadId);
|
||||
mBroadcastManager.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
void notifyInstallProgress(String downloadId) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(ACTION_INSTALL_PROGRESS);
|
||||
intent.putExtra(EXTRA_DOWNLOAD_ID, downloadId);
|
||||
mBroadcastManager.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private void tryReleaseWakelock() {
|
||||
if (!hasActiveDownloads()) {
|
||||
mWakeLock.release();
|
||||
@@ -433,4 +441,9 @@ public class UpdaterController implements UpdaterControllerInt {
|
||||
public boolean isVerifyingUpdate() {
|
||||
return mVerifyingUpdates > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstallingUpdate() {
|
||||
return ABUpdateInstaller.isInstallingUpdate();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user