From f40ec20a24bdb8a17eff76d5fe3a4f4a9dfb5afa Mon Sep 17 00:00:00 2001 From: xster Date: Sat, 18 Jan 2020 23:49:05 -0800 Subject: [PATCH] Reduce default verbosity of Android embedding (flutter/engine#15164) --- .../io/flutter/embedding/android/FlutterActivity.java | 2 +- .../android/FlutterActivityAndFragmentDelegate.java | 10 +++++----- .../io/flutter/embedding/android/FlutterFragment.java | 2 +- .../embedding/android/FlutterFragmentActivity.java | 6 +++--- .../io/flutter/embedding/android/FlutterView.java | 10 +++++----- .../io/flutter/embedding/engine/FlutterEngine.java | 2 +- .../embedding/engine/FlutterEnginePluginRegistry.java | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index ebba0750ff5..6e5ada1d8d7 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -460,7 +460,7 @@ public class FlutterActivity extends Activity setTheme(normalThemeRID); } } else { - Log.d(TAG, "Using the launch theme as normal theme."); + Log.v(TAG, "Using the launch theme as normal theme."); } } catch (PackageManager.NameNotFoundException exception) { Log.e(TAG, "Could not read meta-data for FlutterActivity. Using the launch theme as normal theme."); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java index 6cebfcbef62..3bffb9f94fd 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java @@ -175,7 +175,7 @@ import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; // which means there shouldn't be any possibility for the Fragment Lifecycle to get out of // sync with the Activity. We use the Fragment's Lifecycle because it is possible that the // attached Activity is not a LifecycleOwner. - Log.d(TAG, "Attaching FlutterEngine to the Activity that owns this Fragment."); + Log.v(TAG, "Attaching FlutterEngine to the Activity that owns this Fragment."); flutterEngine.getActivityControlSurface().attachToActivity( host.getActivity(), host.getLifecycle() @@ -200,7 +200,7 @@ import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; */ @VisibleForTesting /* package */ void setupFlutterEngine() { - Log.d(TAG, "Setting up FlutterEngine."); + Log.v(TAG, "Setting up FlutterEngine."); // First, check if the host wants to use a cached FlutterEngine. String cachedEngineId = host.getCachedEngineId(); @@ -222,7 +222,7 @@ import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; // Our host did not provide a custom FlutterEngine. Create a FlutterEngine to back our // FlutterView. - Log.d(TAG, "No preferred FlutterEngine was provided. Creating a new FlutterEngine for" + Log.v(TAG, "No preferred FlutterEngine was provided. Creating a new FlutterEngine for" + " this FlutterFragment."); flutterEngine = new FlutterEngine(host.getContext(), host.getFlutterShellArgs().toArray()); isFlutterEngineFromHost = false; @@ -319,7 +319,7 @@ import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; return; } - Log.d(TAG, "Executing Dart entrypoint: " + host.getDartEntrypointFunctionName() + Log.v(TAG, "Executing Dart entrypoint: " + host.getDartEntrypointFunctionName() + ", and sending initial route: " + host.getInitialRoute()); // The engine needs to receive the Flutter app's initial route before executing any @@ -446,7 +446,7 @@ import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; if (host.shouldAttachEngineToActivity()) { // Notify plugins that they are no longer attached to an Activity. - Log.d(TAG, "Detaching FlutterEngine from the Activity that owns this Fragment."); + Log.v(TAG, "Detaching FlutterEngine from the Activity that owns this Fragment."); if (host.getActivity().isChangingConfigurations()) { flutterEngine.getActivityControlSurface().detachFromActivityForConfigChanges(); } else { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index dd5b0078ec8..2e257aa6709 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -908,7 +908,7 @@ public class FlutterFragment extends Fragment implements FlutterActivityAndFragm FragmentActivity attachedActivity = getActivity(); if (attachedActivity instanceof FlutterEngineProvider) { // Defer to the Activity that owns us to provide a FlutterEngine. - Log.d(TAG, "Deferring to attached Activity to provide a FlutterEngine."); + Log.v(TAG, "Deferring to attached Activity to provide a FlutterEngine."); FlutterEngineProvider flutterEngineProvider = (FlutterEngineProvider) attachedActivity; flutterEngine = flutterEngineProvider.provideFlutterEngine(getContext()); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java index 3e275d974b0..72a77847ce2 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java @@ -297,7 +297,7 @@ public class FlutterFragmentActivity extends FragmentActivity setTheme(normalThemeRID); } } else { - Log.d(TAG, "Using the launch theme as normal theme."); + Log.v(TAG, "Using the launch theme as normal theme."); } } catch (PackageManager.NameNotFoundException exception) { Log.e(TAG, "Could not read meta-data for FlutterFragmentActivity. Using the launch theme as normal theme."); @@ -417,7 +417,7 @@ public class FlutterFragmentActivity extends FragmentActivity : FlutterView.TransparencyMode.transparent; if (getCachedEngineId() != null) { - Log.d(TAG, "Creating FlutterFragment with cached engine:\n" + Log.v(TAG, "Creating FlutterFragment with cached engine:\n" + "Cached engine ID: " + getCachedEngineId() + "\n" + "Will destroy engine when Activity is destroyed: " + shouldDestroyEngineWithHost() + "\n" + "Background transparency mode: " + backgroundMode + "\n" @@ -430,7 +430,7 @@ public class FlutterFragmentActivity extends FragmentActivity .destroyEngineWithFragment(shouldDestroyEngineWithHost()) .build(); } else { - Log.d(TAG, "Creating FlutterFragment with new engine:\n" + Log.v(TAG, "Creating FlutterFragment with new engine:\n" + "Background transparency mode: " + backgroundMode + "\n" + "Dart entrypoint: " + getDartEntrypointFunctionName() + "\n" + "Initial route: " + getInitialRoute() + "\n" diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 1a0e22d3683..d43eea1e6e8 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -582,16 +582,16 @@ public class FlutterView extends FrameLayout { public void attachToFlutterEngine( @NonNull FlutterEngine flutterEngine ) { - Log.d(TAG, "Attaching to a FlutterEngine: " + flutterEngine); + Log.v(TAG, "Attaching to a FlutterEngine: " + flutterEngine); if (isAttachedToFlutterEngine()) { if (flutterEngine == this.flutterEngine) { // We are already attached to this FlutterEngine - Log.d(TAG, "Already attached to this engine. Doing nothing."); + Log.v(TAG, "Already attached to this engine. Doing nothing."); return; } // Detach from a previous FlutterEngine so we can attach to this new one. - Log.d(TAG, "Currently attached to a different engine. Detaching and then attaching" + Log.v(TAG, "Currently attached to a different engine. Detaching and then attaching" + " to new engine."); detachFromFlutterEngine(); } @@ -669,9 +669,9 @@ public class FlutterView extends FrameLayout { * {@link FlutterEngine}. */ public void detachFromFlutterEngine() { - Log.d(TAG, "Detaching from a FlutterEngine: " + flutterEngine); + Log.v(TAG, "Detaching from a FlutterEngine: " + flutterEngine); if (!isAttachedToFlutterEngine()) { - Log.d(TAG, "Not attached to an engine. Doing nothing."); + Log.v(TAG, "Not attached to an engine. Doing nothing."); return; } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index 15cc1200cf9..cd8956a1729 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -262,7 +262,7 @@ public class FlutterEngine { * This {@code FlutterEngine} instance should be discarded after invoking this method. */ public void destroy() { - Log.d(TAG, "Destroying."); + Log.v(TAG, "Destroying."); // The order that these things are destroyed is important. pluginRegistry.destroy(); dartExecutor.onDetachedFromJNI(); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEnginePluginRegistry.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEnginePluginRegistry.java index c5a4e66d07c..7fd97165f71 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEnginePluginRegistry.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEnginePluginRegistry.java @@ -106,7 +106,7 @@ class FlutterEnginePluginRegistry implements PluginRegistry, } public void destroy() { - Log.d(TAG, "Destroying."); + Log.v(TAG, "Destroying."); // Detach from any Android component that we may currently be attached to, e.g., Activity, Service, // BroadcastReceiver, ContentProvider. This must happen before removing all plugins so that the // plugins have an opportunity to clean up references as a result of component detachment.