Merge "Properly disconnect after skipping an operation." into pi-dev

This commit is contained in:
TreeHugger Robot
2018-04-11 20:44:32 +00:00
committed by Android (Google) Code Review

View File

@@ -926,25 +926,24 @@ 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);
mNumOps.addOp(currentTime);
// Find a free opID
int opId = mNumTotalOpsPerformed;
do {
mNumTotalOpsPerformed++;
} while (mRunningOpIds.contains(opId));
// Find a free opID
int opId = mNumTotalOpsPerformed;
do {
mNumTotalOpsPerformed++;
} while (mRunningOpIds.contains(opId));
// Run OP
try {
if (DEBUG) Slog.v(TAG, mPuuid + ": runOp " + opId);
// Run OP
try {
if (DEBUG) Slog.v(TAG, mPuuid + ": runOp " + opId);
op.run(opId, mService);
mRunningOpIds.add(opId);
} catch (Exception e) {
Slog.e(TAG, mPuuid + ": Could not run operation " + opId, e);
op.run(opId, mService);
mRunningOpIds.add(opId);
} 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)