Fix lingering "Disconnecting" notification

- Notifications weren't being updated if they came within 250ms of the previous update, regardless of end-state being reached
- Added check that if the progress was at an end-state, upate anyway
This commit is contained in:
Colin Madere 2017-09-28 16:05:03 -07:00
parent 92fc811674
commit 42a8e3ed27
1 changed files with 2 additions and 1 deletions

View File

@ -1396,8 +1396,9 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres
return;
// the notification may not be refreshed too quickly as the ABORT button becomes not clickable
// If new state is an end-state, update regardless so it will not stick around in "Disconnecting" state
final long now = SystemClock.elapsedRealtime();
if (now - mLastNotificationTime < 250)
if (now - mLastNotificationTime < 250 && !(PROGRESS_COMPLETED == progress || PROGRESS_ABORTED == progress))
return;
mLastNotificationTime = now;