diff options
| author | 2017-06-13 00:24:40 +0000 | |
|---|---|---|
| committer | 2017-06-13 00:24:40 +0000 | |
| commit | 938fe5c96853bb45c35fdf59272f1d571b5257cd (patch) | |
| tree | e1c3c8aa29485b571d988121020e0e08477d3dd6 | |
| parent | c14f46b1354dbf2f393b6e4a9c132200ce582b3b (diff) | |
| parent | 71029bf6310652e0b782bc4388b38640bf4ab8c1 (diff) | |
Merge "Camera2: Cache method list in MethodNameInvoker." into oc-dev
am: 71029bf631
Change-Id: I99c6322d7e06262861eb0bb8be4ce8d4572ffbae
| -rw-r--r-- | core/java/android/hardware/camera2/dispatch/MethodNameInvoker.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/java/android/hardware/camera2/dispatch/MethodNameInvoker.java b/core/java/android/hardware/camera2/dispatch/MethodNameInvoker.java index c66a3a40718f..8296b7a915a4 100644 --- a/core/java/android/hardware/camera2/dispatch/MethodNameInvoker.java +++ b/core/java/android/hardware/camera2/dispatch/MethodNameInvoker.java @@ -15,13 +15,13 @@ */ package android.hardware.camera2.dispatch; +import static com.android.internal.util.Preconditions.checkNotNull; + import android.hardware.camera2.utils.UncheckedThrow; import java.lang.reflect.Method; import java.util.concurrent.ConcurrentHashMap; -import static com.android.internal.util.Preconditions.*; - /** * Invoke a method on a dispatchable by its name (without knowing the {@code Method} ahead of time). * @@ -31,6 +31,7 @@ public class MethodNameInvoker<T> { private final Dispatchable<T> mTarget; private final Class<T> mTargetClass; + private final Method[] mTargetClassMethods; private final ConcurrentHashMap<String, Method> mMethods = new ConcurrentHashMap<>(); @@ -42,6 +43,7 @@ public class MethodNameInvoker<T> { */ public MethodNameInvoker(Dispatchable<T> target, Class<T> targetClass) { mTargetClass = targetClass; + mTargetClassMethods = targetClass.getMethods(); mTarget = target; } @@ -68,7 +70,7 @@ public class MethodNameInvoker<T> { Method targetMethod = mMethods.get(methodName); if (targetMethod == null) { - for (Method method : mTargetClass.getMethods()) { + for (Method method : mTargetClassMethods) { // TODO future: match types of params if possible if (method.getName().equals(methodName) && (params.length == method.getParameterTypes().length) ) { |