Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres
* Stores the last progress percent. Used to prevent from sending progress notifications with
* the same value.
*/
private int mLastProgress = -1;
private int mLastProgress = 0;
/* package */ DfuProgressInfo mProgressInfo;
private long mLastNotificationTime;

Expand Down Expand Up @@ -1661,6 +1661,8 @@ protected void disconnect(@NonNull final BluetoothGatt gatt) {
if (mConnectionState == STATE_DISCONNECTED)
return;

mConnectionState = STATE_DISCONNECTING;

sendLogBroadcast(LOG_LEVEL_VERBOSE, "Disconnecting...");
mProgressInfo.setProgress(PROGRESS_DISCONNECTING);

Expand Down Expand Up @@ -1763,7 +1765,7 @@ protected void refreshDeviceCache(@NonNull final BluetoothGatt gatt, final boole
public void updateProgressNotification() {
final DfuProgressInfo info = mProgressInfo;
final int progress = info.getProgress();
if (mLastProgress == progress)
if (mLastProgress == progress && progress >= 0 && progress <= 100)
return;

mLastProgress = progress;
Expand Down