Merge "Attempt to fix race condition in PooledLambdaImpl." into rvc-dev
diff --git a/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java b/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
index 8446bbd..e4a4408 100755
--- a/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
+++ b/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
@@ -200,8 +200,9 @@
         try {
             return doInvoke();
         } finally {
-            if (isRecycleOnUse()) doRecycle();
-            if (!isRecycled()) {
+            if (isRecycleOnUse()) {
+                doRecycle();
+            } else if (!isRecycled()) {
                 int argsSize = ArrayUtils.size(mArgs);
                 for (int i = 0; i < argsSize; i++) {
                     popArg(i);