diff --git a/config/preloaded-classes b/config/preloaded-classes
index 22fc5e80787fe..14597ee919bfc 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -4117,6 +4117,8 @@ com.android.internal.util.StateMachine$SmHandler$StateInfo
com.android.internal.util.VirtualRefBasePtr
com.android.internal.util.XmlUtils
com.android.internal.util.XmlUtils$WriteMapCallback
+com.android.internal.util.function.HeptConsumer
+com.android.internal.util.function.HeptFunction
com.android.internal.util.function.HexConsumer
com.android.internal.util.function.HexFunction
com.android.internal.util.function.QuadConsumer
diff --git a/core/java/com/android/internal/util/function/HeptConsumer.java b/core/java/com/android/internal/util/function/HeptConsumer.java
new file mode 100644
index 0000000000000..171b0f24b5be1
--- /dev/null
+++ b/core/java/com/android/internal/util/function/HeptConsumer.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.util.function;
+
+import java.util.function.Consumer;
+
+/**
+ * A 7-argument {@link Consumer}
+ *
+ * @hide
+ */
+public interface HeptConsumer {
+ void accept(A a, B b, C c, D d, E e, F f, G g);
+}
diff --git a/core/java/com/android/internal/util/function/HeptFunction.java b/core/java/com/android/internal/util/function/HeptFunction.java
new file mode 100644
index 0000000000000..7aa4345750384
--- /dev/null
+++ b/core/java/com/android/internal/util/function/HeptFunction.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.util.function;
+
+import java.util.function.Function;
+
+/**
+ * A 7-argument {@link Function}
+ *
+ * @hide
+ */
+public interface HeptFunction {
+ R apply(A a, B b, C c, D d, E e, F f, G g);
+}
diff --git a/core/java/com/android/internal/util/function/HeptPredicate.java b/core/java/com/android/internal/util/function/HeptPredicate.java
new file mode 100644
index 0000000000000..531e53a992bfa
--- /dev/null
+++ b/core/java/com/android/internal/util/function/HeptPredicate.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.util.function;
+
+import java.util.function.Predicate;
+
+/**
+ * A 7-argument {@link Predicate}
+ *
+ * @hide
+ */
+public interface HeptPredicate {
+ boolean test(A a, B b, C c, D d, E e, F f, G g);
+}
diff --git a/core/java/com/android/internal/util/function/pooled/OmniFunction.java b/core/java/com/android/internal/util/function/pooled/OmniFunction.java
index 9378869d69342..4ffe44194958a 100755
--- a/core/java/com/android/internal/util/function/pooled/OmniFunction.java
+++ b/core/java/com/android/internal/util/function/pooled/OmniFunction.java
@@ -18,6 +18,8 @@ package com.android.internal.util.function.pooled;
import com.android.internal.util.FunctionalUtils.ThrowingRunnable;
import com.android.internal.util.FunctionalUtils.ThrowingSupplier;
+import com.android.internal.util.function.HeptConsumer;
+import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HexConsumer;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.QuadConsumer;
@@ -37,59 +39,61 @@ import java.util.function.Function;
*
* @hide
*/
-abstract class OmniFunction implements
+abstract class OmniFunction implements
PooledFunction, BiFunction, TriFunction,
QuadFunction, QuintFunction,
- HexFunction, PooledConsumer, BiConsumer,
- TriConsumer, QuadConsumer, QuintConsumer,
- HexConsumer, PooledPredicate, BiPredicate,
+ HexFunction, HeptFunction,
+ PooledConsumer, BiConsumer, TriConsumer, QuadConsumer,
+ QuintConsumer, HexConsumer,
+ HeptConsumer,
+ PooledPredicate, BiPredicate,
PooledSupplier, PooledRunnable, ThrowingRunnable, ThrowingSupplier,
PooledSupplier.OfInt, PooledSupplier.OfLong, PooledSupplier.OfDouble {
- abstract R invoke(A a, B b, C c, D d, E e, F f);
+ abstract R invoke(A a, B b, C c, D d, E e, F f, G g);
@Override
public R apply(A o, B o2) {
- return invoke(o, o2, null, null, null, null);
+ return invoke(o, o2, null, null, null, null, null);
}
@Override
public R apply(A o) {
- return invoke(o, null, null, null, null, null);
+ return invoke(o, null, null, null, null, null, null);
}
- abstract public OmniFunction andThen(
+ public abstract OmniFunction andThen(
Function super R, ? extends V> after);
- abstract public OmniFunction negate();
+ public abstract OmniFunction negate();
@Override
public void accept(A o, B o2) {
- invoke(o, o2, null, null, null, null);
+ invoke(o, o2, null, null, null, null, null);
}
@Override
public void accept(A o) {
- invoke(o, null, null, null, null, null);
+ invoke(o, null, null, null, null, null, null);
}
@Override
public void run() {
- invoke(null, null, null, null, null, null);
+ invoke(null, null, null, null, null, null, null);
}
@Override
public R get() {
- return invoke(null, null, null, null, null, null);
+ return invoke(null, null, null, null, null, null, null);
}
@Override
public boolean test(A o, B o2) {
- return (Boolean) invoke(o, o2, null, null, null, null);
+ return (Boolean) invoke(o, o2, null, null, null, null, null);
}
@Override
public boolean test(A o) {
- return (Boolean) invoke(o, null, null, null, null, null);
+ return (Boolean) invoke(o, null, null, null, null, null, null);
}
@Override
@@ -104,42 +108,52 @@ abstract class OmniFunction implements
@Override
public R apply(A a, B b, C c) {
- return invoke(a, b, c, null, null, null);
+ return invoke(a, b, c, null, null, null, null);
}
@Override
public void accept(A a, B b, C c) {
- invoke(a, b, c, null, null, null);
+ invoke(a, b, c, null, null, null, null);
}
@Override
public R apply(A a, B b, C c, D d) {
- return invoke(a, b, c, d, null, null);
+ return invoke(a, b, c, d, null, null, null);
}
@Override
public R apply(A a, B b, C c, D d, E e) {
- return invoke(a, b, c, d, e, null);
+ return invoke(a, b, c, d, e, null, null);
}
@Override
public R apply(A a, B b, C c, D d, E e, F f) {
- return invoke(a, b, c, d, e, f);
+ return invoke(a, b, c, d, e, f, null);
+ }
+
+ @Override
+ public R apply(A a, B b, C c, D d, E e, F f, G g) {
+ return invoke(a, b, c, d, e, f, g);
}
@Override
public void accept(A a, B b, C c, D d) {
- invoke(a, b, c, d, null, null);
+ invoke(a, b, c, d, null, null, null);
}
@Override
public void accept(A a, B b, C c, D d, E e) {
- invoke(a, b, c, d, e, null);
+ invoke(a, b, c, d, e, null, null);
}
@Override
public void accept(A a, B b, C c, D d, E e, F f) {
- invoke(a, b, c, d, e, f);
+ invoke(a, b, c, d, e, f, null);
+ }
+
+ @Override
+ public void accept(A a, B b, C c, D d, E e, F f, G g) {
+ invoke(a, b, c, d, e, f, g);
}
@Override
@@ -153,5 +167,5 @@ abstract class OmniFunction implements
}
@Override
- abstract public OmniFunction recycleOnUse();
+ public abstract OmniFunction recycleOnUse();
}
diff --git a/core/java/com/android/internal/util/function/pooled/PooledLambda.java b/core/java/com/android/internal/util/function/pooled/PooledLambda.java
index 15698cc67e516..af3c7527c4323 100755
--- a/core/java/com/android/internal/util/function/pooled/PooledLambda.java
+++ b/core/java/com/android/internal/util/function/pooled/PooledLambda.java
@@ -21,6 +21,8 @@ import static com.android.internal.util.function.pooled.PooledLambdaImpl.acquire
import android.os.Message;
+import com.android.internal.util.function.HeptConsumer;
+import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HexConsumer;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.QuadConsumer;
@@ -174,7 +176,7 @@ public interface PooledLambda {
Consumer super A> function,
A arg1) {
return acquire(PooledLambdaImpl.sPool,
- function, 1, 0, ReturnType.VOID, arg1, null, null, null, null, null);
+ function, 1, 0, ReturnType.VOID, arg1, null, null, null, null, null, null);
}
/**
@@ -190,7 +192,7 @@ public interface PooledLambda {
Predicate super A> function,
A arg1) {
return acquire(PooledLambdaImpl.sPool,
- function, 1, 0, ReturnType.BOOLEAN, arg1, null, null, null, null, null);
+ function, 1, 0, ReturnType.BOOLEAN, arg1, null, null, null, null, null, null);
}
/**
@@ -206,7 +208,7 @@ public interface PooledLambda {
Function super A, ? extends R> function,
A arg1) {
return acquire(PooledLambdaImpl.sPool,
- function, 1, 0, ReturnType.OBJECT, arg1, null, null, null, null, null);
+ function, 1, 0, ReturnType.OBJECT, arg1, null, null, null, null, null, null);
}
/**
@@ -236,7 +238,7 @@ public interface PooledLambda {
A arg1) {
synchronized (Message.sPoolSync) {
PooledRunnable callback = acquire(PooledLambdaImpl.sMessageCallbacksPool,
- function, 1, 0, ReturnType.VOID, arg1, null, null, null, null, null);
+ function, 1, 0, ReturnType.VOID, arg1, null, null, null, null, null, null);
return Message.obtain().setCallback(callback.recycleOnUse());
}
}
@@ -255,7 +257,7 @@ public interface PooledLambda {
BiConsumer super A, ? super B> function,
A arg1, B arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 0, ReturnType.VOID, arg1, arg2, null, null, null, null);
+ function, 2, 0, ReturnType.VOID, arg1, arg2, null, null, null, null, null);
}
/**
@@ -272,7 +274,7 @@ public interface PooledLambda {
BiPredicate super A, ? super B> function,
A arg1, B arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 0, ReturnType.BOOLEAN, arg1, arg2, null, null, null, null);
+ function, 2, 0, ReturnType.BOOLEAN, arg1, arg2, null, null, null, null, null);
}
/**
@@ -289,7 +291,7 @@ public interface PooledLambda {
BiFunction super A, ? super B, ? extends R> function,
A arg1, B arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 0, ReturnType.OBJECT, arg1, arg2, null, null, null, null);
+ function, 2, 0, ReturnType.OBJECT, arg1, arg2, null, null, null, null, null);
}
/**
@@ -306,7 +308,7 @@ public interface PooledLambda {
BiConsumer super A, ? super B> function,
ArgumentPlaceholder arg1, B arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 1, ReturnType.VOID, arg1, arg2, null, null, null, null);
+ function, 2, 1, ReturnType.VOID, arg1, arg2, null, null, null, null, null);
}
/**
@@ -323,7 +325,7 @@ public interface PooledLambda {
BiPredicate super A, ? super B> function,
ArgumentPlaceholder arg1, B arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 1, ReturnType.BOOLEAN, arg1, arg2, null, null, null, null);
+ function, 2, 1, ReturnType.BOOLEAN, arg1, arg2, null, null, null, null, null);
}
/**
@@ -340,7 +342,7 @@ public interface PooledLambda {
BiFunction super A, ? super B, ? extends R> function,
ArgumentPlaceholder arg1, B arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 1, ReturnType.OBJECT, arg1, arg2, null, null, null, null);
+ function, 2, 1, ReturnType.OBJECT, arg1, arg2, null, null, null, null, null);
}
/**
@@ -357,7 +359,7 @@ public interface PooledLambda {
BiConsumer super A, ? super B> function,
A arg1, ArgumentPlaceholder arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 1, ReturnType.VOID, arg1, arg2, null, null, null, null);
+ function, 2, 1, ReturnType.VOID, arg1, arg2, null, null, null, null, null);
}
/**
@@ -374,7 +376,7 @@ public interface PooledLambda {
BiPredicate super A, ? super B> function,
A arg1, ArgumentPlaceholder arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 1, ReturnType.BOOLEAN, arg1, arg2, null, null, null, null);
+ function, 2, 1, ReturnType.BOOLEAN, arg1, arg2, null, null, null, null, null);
}
/**
@@ -391,7 +393,7 @@ public interface PooledLambda {
BiFunction super A, ? super B, ? extends R> function,
A arg1, ArgumentPlaceholder arg2) {
return acquire(PooledLambdaImpl.sPool,
- function, 2, 1, ReturnType.OBJECT, arg1, arg2, null, null, null, null);
+ function, 2, 1, ReturnType.OBJECT, arg1, arg2, null, null, null, null, null);
}
/**
@@ -422,7 +424,7 @@ public interface PooledLambda {
A arg1, B arg2) {
synchronized (Message.sPoolSync) {
PooledRunnable callback = acquire(PooledLambdaImpl.sMessageCallbacksPool,
- function, 2, 0, ReturnType.VOID, arg1, arg2, null, null, null, null);
+ function, 2, 0, ReturnType.VOID, arg1, arg2, null, null, null, null, null);
return Message.obtain().setCallback(callback.recycleOnUse());
}
}
@@ -442,7 +444,7 @@ public interface PooledLambda {
TriConsumer super A, ? super B, ? super C> function,
A arg1, B arg2, C arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 0, ReturnType.VOID, arg1, arg2, arg3, null, null, null);
+ function, 3, 0, ReturnType.VOID, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -460,7 +462,7 @@ public interface PooledLambda {
TriFunction super A, ? super B, ? super C, ? extends R> function,
A arg1, B arg2, C arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 0, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null);
+ function, 3, 0, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -478,7 +480,7 @@ public interface PooledLambda {
TriConsumer super A, ? super B, ? super C> function,
ArgumentPlaceholder arg1, B arg2, C arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 1, ReturnType.VOID, arg1, arg2, arg3, null, null, null);
+ function, 3, 1, ReturnType.VOID, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -496,7 +498,7 @@ public interface PooledLambda {
TriFunction super A, ? super B, ? super C, ? extends R> function,
ArgumentPlaceholder arg1, B arg2, C arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 1, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null);
+ function, 3, 1, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -514,7 +516,7 @@ public interface PooledLambda {
TriConsumer super A, ? super B, ? super C> function,
A arg1, ArgumentPlaceholder arg2, C arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 1, ReturnType.VOID, arg1, arg2, arg3, null, null, null);
+ function, 3, 1, ReturnType.VOID, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -532,7 +534,7 @@ public interface PooledLambda {
TriFunction super A, ? super B, ? super C, ? extends R> function,
A arg1, ArgumentPlaceholder arg2, C arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 1, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null);
+ function, 3, 1, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -550,7 +552,7 @@ public interface PooledLambda {
TriConsumer super A, ? super B, ? super C> function,
A arg1, B arg2, ArgumentPlaceholder arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 1, ReturnType.VOID, arg1, arg2, arg3, null, null, null);
+ function, 3, 1, ReturnType.VOID, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -568,7 +570,7 @@ public interface PooledLambda {
TriFunction super A, ? super B, ? super C, ? extends R> function,
A arg1, B arg2, ArgumentPlaceholder arg3) {
return acquire(PooledLambdaImpl.sPool,
- function, 3, 1, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null);
+ function, 3, 1, ReturnType.OBJECT, arg1, arg2, arg3, null, null, null, null);
}
/**
@@ -600,7 +602,7 @@ public interface PooledLambda {
A arg1, B arg2, C arg3) {
synchronized (Message.sPoolSync) {
PooledRunnable callback = acquire(PooledLambdaImpl.sMessageCallbacksPool,
- function, 3, 0, ReturnType.VOID, arg1, arg2, arg3, null, null, null);
+ function, 3, 0, ReturnType.VOID, arg1, arg2, arg3, null, null, null, null);
return Message.obtain().setCallback(callback.recycleOnUse());
}
}
@@ -621,7 +623,7 @@ public interface PooledLambda {
QuadConsumer super A, ? super B, ? super C, ? super D> function,
A arg1, B arg2, C arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -640,7 +642,7 @@ public interface PooledLambda {
QuadFunction super A, ? super B, ? super C, ? super D, ? extends R> function,
A arg1, B arg2, C arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 0, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 0, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -659,7 +661,7 @@ public interface PooledLambda {
QuadConsumer super A, ? super B, ? super C, ? super D> function,
ArgumentPlaceholder arg1, B arg2, C arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -678,7 +680,7 @@ public interface PooledLambda {
QuadFunction super A, ? super B, ? super C, ? super D, ? extends R> function,
ArgumentPlaceholder arg1, B arg2, C arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -697,7 +699,7 @@ public interface PooledLambda {
QuadConsumer super A, ? super B, ? super C, ? super D> function,
A arg1, ArgumentPlaceholder arg2, C arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -716,7 +718,7 @@ public interface PooledLambda {
QuadFunction super A, ? super B, ? super C, ? super D, ? extends R> function,
A arg1, ArgumentPlaceholder arg2, C arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -735,7 +737,7 @@ public interface PooledLambda {
QuadConsumer super A, ? super B, ? super C, ? super D> function,
A arg1, B arg2, ArgumentPlaceholder arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -754,7 +756,7 @@ public interface PooledLambda {
QuadFunction super A, ? super B, ? super C, ? super D, ? extends R> function,
A arg1, B arg2, ArgumentPlaceholder arg3, D arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -773,7 +775,7 @@ public interface PooledLambda {
QuadConsumer super A, ? super B, ? super C, ? super D> function,
A arg1, B arg2, C arg3, ArgumentPlaceholder arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -792,7 +794,7 @@ public interface PooledLambda {
QuadFunction super A, ? super B, ? super C, ? super D, ? extends R> function,
A arg1, B arg2, C arg3, ArgumentPlaceholder arg4) {
return acquire(PooledLambdaImpl.sPool,
- function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 1, ReturnType.OBJECT, arg1, arg2, arg3, arg4, null, null, null);
}
/**
@@ -825,7 +827,7 @@ public interface PooledLambda {
A arg1, B arg2, C arg3, D arg4) {
synchronized (Message.sPoolSync) {
PooledRunnable callback = acquire(PooledLambdaImpl.sMessageCallbacksPool,
- function, 4, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null);
+ function, 4, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, null, null, null);
return Message.obtain().setCallback(callback.recycleOnUse());
}
}
@@ -847,7 +849,7 @@ public interface PooledLambda {
QuintConsumer super A, ? super B, ? super C, ? super D, ? super E> function,
A arg1, B arg2, C arg3, D arg4, E arg5) {
return acquire(PooledLambdaImpl.sPool,
- function, 5, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, null);
+ function, 5, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, null, null);
}
/**
@@ -867,7 +869,7 @@ public interface PooledLambda {
QuintFunction super A, ? super B, ? super C, ? super D, ? super E, ? extends R>
function, A arg1, B arg2, C arg3, D arg4, E arg5) {
return acquire(PooledLambdaImpl.sPool,
- function, 5, 0, ReturnType.OBJECT, arg1, arg2, arg3, arg4, arg5, null);
+ function, 5, 0, ReturnType.OBJECT, arg1, arg2, arg3, arg4, arg5, null, null);
}
/**
@@ -902,7 +904,7 @@ public interface PooledLambda {
A arg1, B arg2, C arg3, D arg4, E arg5) {
synchronized (Message.sPoolSync) {
PooledRunnable callback = acquire(PooledLambdaImpl.sMessageCallbacksPool,
- function, 5, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, null);
+ function, 5, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, null, null);
return Message.obtain().setCallback(callback.recycleOnUse());
}
}
@@ -925,7 +927,7 @@ public interface PooledLambda {
HexConsumer super A, ? super B, ? super C, ? super D, ? super E, ? super F> function,
A arg1, B arg2, C arg3, D arg4, E arg5, F arg6) {
return acquire(PooledLambdaImpl.sPool,
- function, 6, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, arg6);
+ function, 6, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, arg6, null);
}
/**
@@ -946,7 +948,7 @@ public interface PooledLambda {
HexFunction super A, ? super B, ? super C, ? super D, ? super E, ? super F,
? extends R> function, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6) {
return acquire(PooledLambdaImpl.sPool,
- function, 6, 0, ReturnType.OBJECT, arg1, arg2, arg3, arg4, arg5, arg6);
+ function, 6, 0, ReturnType.OBJECT, arg1, arg2, arg3, arg4, arg5, arg6, null);
}
/**
@@ -982,7 +984,91 @@ public interface PooledLambda {
A arg1, B arg2, C arg3, D arg4, E arg5, F arg6) {
synchronized (Message.sPoolSync) {
PooledRunnable callback = acquire(PooledLambdaImpl.sMessageCallbacksPool,
- function, 6, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, arg6);
+ function, 6, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, arg6, null);
+ return Message.obtain().setCallback(callback.recycleOnUse());
+ }
+ }
+
+ /**
+ * {@link PooledRunnable} factory
+ *
+ * @param function non-capturing lambda(typically an unbounded method reference)
+ * to be invoked on call
+ * @param arg1 parameter supplied to {@code function} on call
+ * @param arg2 parameter supplied to {@code function} on call
+ * @param arg3 parameter supplied to {@code function} on call
+ * @param arg4 parameter supplied to {@code function} on call
+ * @param arg5 parameter supplied to {@code function} on call
+ * @param arg6 parameter supplied to {@code function} on call
+ * @param arg7 parameter supplied to {@code function} on call
+ * @return a {@link PooledRunnable}, equivalent to lambda:
+ * {@code () -> function(arg1, arg2, arg3, arg4, arg5, arg6, arg7) }
+ */
+ static PooledRunnable obtainRunnable(
+ HeptConsumer super A, ? super B, ? super C, ? super D, ? super E, ? super F,
+ ? super G> function, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7) {
+ return acquire(PooledLambdaImpl.sPool,
+ function, 7, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ }
+
+ /**
+ * {@link PooledSupplier} factory
+ *
+ * @param function non-capturing lambda(typically an unbounded method reference)
+ * to be invoked on call
+ * @param arg1 parameter supplied to {@code function} on call
+ * @param arg2 parameter supplied to {@code function} on call
+ * @param arg3 parameter supplied to {@code function} on call
+ * @param arg4 parameter supplied to {@code function} on call
+ * @param arg5 parameter supplied to {@code function} on call
+ * @param arg6 parameter supplied to {@code function} on call
+ * @param arg7 parameter supplied to {@code function} on call
+ * @return a {@link PooledSupplier}, equivalent to lambda:
+ * {@code () -> function(arg1, arg2, arg3, arg4, arg5, arg6, arg7) }
+ */
+ static PooledSupplier obtainSupplier(
+ HeptFunction super A, ? super B, ? super C, ? super D, ? super E, ? super F,
+ ? super G, ? extends R> function,
+ A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7) {
+ return acquire(PooledLambdaImpl.sPool,
+ function, 7, 0, ReturnType.OBJECT, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ }
+
+ /**
+ * Factory of {@link Message}s that contain an
+ * ({@link PooledLambda#recycleOnUse auto-recycling}) {@link PooledRunnable} as its
+ * {@link Message#getCallback internal callback}.
+ *
+ * The callback is equivalent to one obtainable via
+ * {@link #obtainRunnable(QuintConsumer, Object, Object, Object, Object, Object)}
+ *
+ * Note that using this method with {@link android.os.Handler#handleMessage}
+ * is more efficient than the alternative of {@link android.os.Handler#post}
+ * with a {@link PooledRunnable} due to the lack of 2 separate synchronization points
+ * when obtaining {@link Message} and {@link PooledRunnable} from pools separately
+ *
+ * You may optionally set a {@link Message#what} for the message if you want to be
+ * able to cancel it via {@link android.os.Handler#removeMessages}, but otherwise
+ * there's no need to do so
+ *
+ * @param function non-capturing lambda(typically an unbounded method reference)
+ * to be invoked on call
+ * @param arg1 parameter supplied to {@code function} on call
+ * @param arg2 parameter supplied to {@code function} on call
+ * @param arg3 parameter supplied to {@code function} on call
+ * @param arg4 parameter supplied to {@code function} on call
+ * @param arg5 parameter supplied to {@code function} on call
+ * @param arg6 parameter supplied to {@code function} on call
+ * @param arg7 parameter supplied to {@code function} on call
+ * @return a {@link Message} invoking {@code function(arg1, arg2, arg3, arg4, arg5, arg6,
+ * arg7) } when handled
+ */
+ static Message obtainMessage(
+ HeptConsumer super A, ? super B, ? super C, ? super D, ? super E, ? super F,
+ ? super G> function, A arg1, B arg2, C arg3, D arg4, E arg5, F arg6, G arg7) {
+ synchronized (Message.sPoolSync) {
+ PooledRunnable callback = acquire(PooledLambdaImpl.sMessageCallbacksPool,
+ function, 7, 0, ReturnType.VOID, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
return Message.obtain().setCallback(callback.recycleOnUse());
}
}
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 565ae1129cb4a..eea1e5f0ac5cf 100755
--- a/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
+++ b/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
@@ -24,6 +24,9 @@ import android.util.Pools;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.BitUtils;
+import com.android.internal.util.function.HeptConsumer;
+import com.android.internal.util.function.HeptFunction;
+import com.android.internal.util.function.HeptPredicate;
import com.android.internal.util.function.HexConsumer;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.HexPredicate;
@@ -51,12 +54,12 @@ import java.util.function.Supplier;
* @hide
*/
final class PooledLambdaImpl extends OmniFunction