fix: Log in FrameProcessorPluginRegistry (#2012)

* fix: Log when adding Frame Processor Plugin

* fix: Also log on Android

* Add logs in get as well

* fix: Fix string concat on Android
This commit is contained in:
Marc Rousavy
2023-10-16 17:51:18 +02:00
committed by GitHub
parent ce9a505776
commit 2af965d1ad
2 changed files with 10 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
package com.mrousavy.camera.frameprocessor;
import android.util.Log;
import androidx.annotation.Keep;
import androidx.annotation.Nullable;
import com.facebook.proguard.annotations.DoNotStrip;
@@ -10,6 +11,7 @@ import java.util.HashMap;
@Keep
public class FrameProcessorPluginRegistry {
private static final Map<String, PluginInitializer> Plugins = new HashMap<>();
private static final String TAG = "FrameProcessorPluginRegistry";
@DoNotStrip
@Keep
@@ -17,15 +19,19 @@ public class FrameProcessorPluginRegistry {
assert !Plugins.containsKey(name) : "Tried to add a Frame Processor Plugin with a name that already exists! " +
"Either choose unique names, or remove the unused plugin. Name: " + name;
Plugins.put(name, pluginInitializer);
Log.i(TAG, "Successfully registered Frame Processor Plugin \"" + name + "\"!");
}
@DoNotStrip
@Keep
public static FrameProcessorPlugin getPlugin(String name, Map<String, Object> options) {
Log.i(TAG, "Looking up Frame Processor Plugin \"" + name + "\"...");
PluginInitializer initializer = Plugins.get(name);
if (initializer == null) {
Log.i(TAG, "Frame Processor Plugin \"" + name + "\" does not exist!");
return null;
}
Log.i(TAG, "Frame Processor Plugin \"" + name + "\" found! Initializing...");
return initializer.initializePlugin(options);
}