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

Commit 09dd8c47 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Properly disconnect after skipping an operation.

If we skip an operation we used to just return. This lead to the service
staying connected, holding the wakelock and consuming power.

Hence after we skip an operation we need to check if we can disconnect
the service, basically treating skipping an operation similar failing
to execute the operation.

Fixes: 77766977
Test: Detected music via sound trigger service and triggered dropping of
operations

Change-Id: Ia837d628193b3a5c2763f4aae666193d624b6d7f
parent d565f049
Loading
Loading
Loading
Loading
+15 −16
Original line number Diff line number Diff line
@@ -926,9 +926,7 @@ public class SoundTriggerService extends SystemService {
                            Slog.w(TAG, mPuuid + ": Dropped operation as too many operations were "
                                    + "run in last 24 hours");
                        }
                        return;
                    }

                    } else {
                        mNumOps.addOp(currentTime);

                        // Find a free opID
@@ -946,6 +944,7 @@ public class SoundTriggerService extends SystemService {
                        } catch (Exception e) {
                            Slog.e(TAG, mPuuid + ": Could not run operation " + opId, e);
                        }
                    }

                    // Unbind from service if no operations are left (i.e. if the operation failed)
                    if (mPendingOps.isEmpty() && mRunningOpIds.isEmpty()) {