mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Reduce default verbosity of Android embedding (flutter/engine#15164)
This commit is contained in:
parent
66eec1965e
commit
f40ec20a24
@ -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.");
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user