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 " Slog.w(TAG, mPuuid + ": Dropped operation as too many operations were "
+ "run in last 24 hours"); + "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 // Run OP
int opId = mNumTotalOpsPerformed; try {
do { if (DEBUG) Slog.v(TAG, mPuuid + ": runOp " + opId);
mNumTotalOpsPerformed++;
} while (mRunningOpIds.contains(opId));
// Run OP op.run(opId, mService);
try { mRunningOpIds.add(opId);
if (DEBUG) Slog.v(TAG, mPuuid + ": runOp " + 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) // Unbind from service if no operations are left (i.e. if the operation failed)