diff options
author | Yi-Yo Chiang <yochiang@google.com> | 2021-02-26 19:53:02 +0800 |
---|---|---|
committer | Yi-Yo Chiang <yochiang@google.com> | 2021-02-26 20:02:08 +0800 |
commit | 59914320433bf74fb4ae0d4199270c89529032a7 (patch) | |
tree | 006db5e8438b60e8b936845371068d806182c381 /packages/DynamicSystemInstallationService/src | |
parent | 4cfe6d8f578a4a31116ee46acc8745db0c7d637c (diff) |
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
Diffstat (limited to 'packages/DynamicSystemInstallationService/src')
-rw-r--r-- | packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java index 7f19662c6961..c1dca5df1b2f 100644 --- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java +++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java @@ -394,16 +394,20 @@ public class DynamicSystemInstallationService extends Service } private void executeNotifyIfInUseCommand() { - int status = getStatus(); - - if (status == STATUS_IN_USE) { - startForeground(NOTIFICATION_ID, - buildNotification(STATUS_IN_USE, CAUSE_NOT_SPECIFIED)); - } else if (status == STATUS_READY) { - startForeground(NOTIFICATION_ID, - buildNotification(STATUS_READY, CAUSE_NOT_SPECIFIED)); - } else { - stopSelf(); + switch (getStatus()) { + case STATUS_IN_USE: + startForeground(NOTIFICATION_ID, + buildNotification(STATUS_IN_USE, CAUSE_NOT_SPECIFIED)); + break; + case STATUS_READY: + startForeground(NOTIFICATION_ID, + buildNotification(STATUS_READY, CAUSE_NOT_SPECIFIED)); + break; + case STATUS_IN_PROGRESS: + break; + case STATUS_NOT_STARTED: + default: + stopSelf(); } } |