Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59914320 authored by Yi-Yo Chiang's avatar Yi-Yo Chiang
Browse files

DSUService: stopSelf() only if no ongoing installation

If you are fast and start a DSU installation before the BOOT_COMPLETE
broadcast receiver can start, than the executeNotifyIfInUseCommand()
would destroy the on-going installation session, which is mildly
irritating.

Bug: 165471299
Test: Presubmit
Change-Id: Iaf6a165ece7d2b4a531a78845122046c19d456a7
parent 4cfe6d8f
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -394,15 +394,19 @@ public class DynamicSystemInstallationService extends Service
    }

    private void executeNotifyIfInUseCommand() {
        int status = getStatus();

        if (status == STATUS_IN_USE) {
        switch (getStatus()) {
            case STATUS_IN_USE:
                startForeground(NOTIFICATION_ID,
                        buildNotification(STATUS_IN_USE, CAUSE_NOT_SPECIFIED));
        } else if (status == STATUS_READY) {
                break;
            case STATUS_READY:
                startForeground(NOTIFICATION_ID,
                        buildNotification(STATUS_READY, CAUSE_NOT_SPECIFIED));
        } else {
                break;
            case STATUS_IN_PROGRESS:
                break;
            case STATUS_NOT_STARTED:
            default:
                stopSelf();
        }
    }