diff --git a/engine/src/flutter/shell/platform/android/BUILD.gn b/engine/src/flutter/shell/platform/android/BUILD.gn index 70f5e44306..926686b42d 100644 --- a/engine/src/flutter/shell/platform/android/BUILD.gn +++ b/engine/src/flutter/shell/platform/android/BUILD.gn @@ -568,6 +568,7 @@ zip_bundle("android") { deps = [ ":android_jar", + ":android_javadoc", ":android_symbols", ] @@ -582,8 +583,6 @@ zip_bundle("android") { } } -# TODO(dnfield): make these targets pass. -# https://github.com/flutter/flutter/issues/42400 action("gen_android_javadoc") { script = "//flutter/tools/gen_javadoc.py" sources = android_java_sources + embedding_dependencies_jars @@ -598,7 +597,10 @@ action("gen_android_javadoc") { rebase_path(target_gen_dir), "--third-party", rebase_path("//third_party"), + "--quiet", ] + + deps = [ ":gen_android_build_config_java" ] } zip_bundle("android_javadoc") { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/FlutterInjector.java b/engine/src/flutter/shell/platform/android/io/flutter/FlutterInjector.java index 405dab5adf..d64744a7e6 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/FlutterInjector.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/FlutterInjector.java @@ -78,7 +78,10 @@ public final class FlutterInjector { private DeferredComponentManager deferredComponentManager; private FlutterJNI.Factory flutterJniFactory; - /** Returns the {@link FlutterLoader} instance to use for the Flutter Android engine embedding. */ + /** + * Returns the {@link io.flutter.embedding.engine.loader.FlutterLoader} instance to use for the + * Flutter Android engine embedding. + */ @NonNull public FlutterLoader flutterLoader() { return flutterLoader; @@ -109,7 +112,7 @@ public final class FlutterInjector { private DeferredComponentManager deferredComponentManager; private FlutterJNI.Factory flutterJniFactory; /** - * Sets a {@link FlutterLoader} override. + * Sets a {@link io.flutter.embedding.engine.loader.FlutterLoader} override. * *

A reasonable default will be used if unspecified. */ diff --git a/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 83ba83c66d..0bd65e896b 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -35,8 +35,8 @@ import io.flutter.view.FlutterView; import java.util.ArrayList; /** - * Deprecated class that performs the actual work of tying Android {@link Activity} instances to - * Flutter. + * Deprecated class that performs the actual work of tying Android {@link android.app.Activity} + * instances to Flutter. * *

This exists as a dedicated class (as opposed to being integrated directly into {@link * FlutterActivity}) to facilitate applications that don't wish to subclass {@code FlutterActivity}. @@ -84,6 +84,8 @@ public final class FlutterActivityDelegate /** * Hook for subclasses to indicate that the {@code FlutterNativeView} returned by {@link * #createFlutterNativeView()} should not be destroyed when this activity is destroyed. + * + * @return Whether the FlutterNativeView is retained. */ boolean retainFlutterNativeView(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/DrawableSplashScreen.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/DrawableSplashScreen.java index 260c1621c5..9913020a36 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/DrawableSplashScreen.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/DrawableSplashScreen.java @@ -39,8 +39,8 @@ public final class DrawableSplashScreen implements SplashScreen { *

* * @param drawable The {@code Drawable} to be displayed as a splash screen. - * @param scaleType The {@link ImageView.ScaleType} to be applied to the {@code Drawable} when the - * {@code Drawable} is displayed full-screen. + * @param scaleType The {@link android.widget.ImageView.ScaleType} to be applied to the {@code + * Drawable} when the {@code Drawable} is displayed full-screen. */ public DrawableSplashScreen( @NonNull Drawable drawable, 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 f054fb2858..af7c6070b8 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 @@ -63,7 +63,8 @@ import io.flutter.plugin.platform.PlatformPlugin; *

  • Chooses the Dart execution app bundle path and entrypoint. *
  • Chooses Flutter's initial route. *
  • Renders {@code Activity} transparently, if desired. - *
  • Offers hooks for subclasses to provide and configure a {@link FlutterEngine}. + *
  • Offers hooks for subclasses to provide and configure a {@link + * io.flutter.embedding.engine.FlutterEngine}. *
  • Save and restore instance state, see {@code #shouldRestoreAndSaveState()}; * * @@ -96,36 +97,41 @@ import io.flutter.plugin.platform.PlatformPlugin; * *

    Using a cached FlutterEngine * - *

    {@code FlutterActivity} can be used with a cached {@link FlutterEngine} instead of creating a - * new one. Use {@link #withCachedEngine(String)} to build a {@code FlutterActivity} {@code Intent} - * that is configured to use an existing, cached {@link FlutterEngine}. {@link + *

    {@code FlutterActivity} can be used with a cached {@link + * io.flutter.embedding.engine.FlutterEngine} instead of creating a new one. Use {@link + * #withCachedEngine(String)} to build a {@code FlutterActivity} {@code Intent} that is configured + * to use an existing, cached {@link io.flutter.embedding.engine.FlutterEngine}. {@link * io.flutter.embedding.engine.FlutterEngineCache} is the cache that is used to obtain a given - * cached {@link FlutterEngine}. You must create and put a {@link FlutterEngine} into the {@link + * cached {@link io.flutter.embedding.engine.FlutterEngine}. You must create and put a {@link + * io.flutter.embedding.engine.FlutterEngine} into the {@link * io.flutter.embedding.engine.FlutterEngineCache} yourself before using the {@link * #withCachedEngine(String)} builder. An {@code IllegalStateException} will be thrown if a cached * engine is requested but does not exist in the cache. * - *

    When using a cached {@link FlutterEngine}, that {@link FlutterEngine} should already be - * executing Dart code, which means that the Dart entrypoint and initial route have already been - * defined. Therefore, {@link CachedEngineIntentBuilder} does not offer configuration of these - * properties. + *

    When using a cached {@link io.flutter.embedding.engine.FlutterEngine}, that {@link + * io.flutter.embedding.engine.FlutterEngine} should already be executing Dart code, which means + * that the Dart entrypoint and initial route have already been defined. Therefore, {@link + * CachedEngineIntentBuilder} does not offer configuration of these properties. * - *

    It is generally recommended to use a cached {@link FlutterEngine} to avoid a momentary delay - * when initializing a new {@link FlutterEngine}. The two exceptions to using a cached {@link + *

    It is generally recommended to use a cached {@link io.flutter.embedding.engine.FlutterEngine} + * to avoid a momentary delay when initializing a new {@link + * io.flutter.embedding.engine.FlutterEngine}. The two exceptions to using a cached {@link * FlutterEngine} are: * *

    * *

    * *

    See https://flutter.dev/docs/development/add-to-app/performance for additional performance * explorations on engine loading. * - *

    The following illustrates how to pre-warm and cache a {@link FlutterEngine}: + *

    The following illustrates how to pre-warm and cache a {@link + * io.flutter.embedding.engine.FlutterEngine}: * *

    {@code
      * // Create and pre-warm a FlutterEngine.
    @@ -207,7 +213,7 @@ public class FlutterActivity extends Activity
        * Flutter's initial route.
        *
        * 

    Consider using the {@link #withCachedEngine(String)} {@link Intent} builder to control when - * the {@link FlutterEngine} should be created in your application. + * the {@link io.flutter.embedding.engine.FlutterEngine} should be created in your application. */ @NonNull public static Intent createDefaultIntent(@NonNull Context launchContext) { @@ -216,8 +222,9 @@ public class FlutterActivity extends Activity /** * Creates an {@link NewEngineIntentBuilder}, which can be used to configure an {@link Intent} to - * launch a {@code FlutterActivity} that internally creates a new {@link FlutterEngine} using the - * desired Dart entrypoint, initial route, etc. + * launch a {@code FlutterActivity} that internally creates a new {@link + * io.flutter.embedding.engine.FlutterEngine} using the desired Dart entrypoint, initial route, + * etc. */ @NonNull public static NewEngineIntentBuilder withNewEngine() { @@ -294,8 +301,9 @@ public class FlutterActivity extends Activity /** * Creates a {@link CachedEngineIntentBuilder}, which can be used to configure an {@link Intent} - * to launch a {@code FlutterActivity} that internally uses an existing {@link FlutterEngine} that - * is cached in {@link io.flutter.embedding.engine.FlutterEngineCache}. + * to launch a {@code FlutterActivity} that internally uses an existing {@link + * io.flutter.embedding.engine.FlutterEngine} that is cached in {@link + * io.flutter.embedding.engine.FlutterEngineCache}. */ public static CachedEngineIntentBuilder withCachedEngine(@NonNull String cachedEngineId) { return new CachedEngineIntentBuilder(FlutterActivity.class, cachedEngineId); @@ -303,7 +311,8 @@ public class FlutterActivity extends Activity /** * Builder to create an {@code Intent} that launches a {@code FlutterActivity} with an existing - * {@link FlutterEngine} that is cached in {@link io.flutter.embedding.engine.FlutterEngineCache}. + * {@link io.flutter.embedding.engine.FlutterEngine} that is cached in {@link + * io.flutter.embedding.engine.FlutterEngineCache}. */ public static class CachedEngineIntentBuilder { private final Class activityClass; @@ -316,8 +325,9 @@ public class FlutterActivity extends Activity * {@code FlutterActivity}. * *

    Subclasses of {@code FlutterActivity} should provide their own static version of {@link - * #withCachedEngine()}, which returns an instance of {@code CachedEngineIntentBuilder} - * constructed with a {@code Class} reference to the {@code FlutterActivity} subclass, e.g.: + * FlutterActivity#withCachedEngine(String)}, which returns an instance of {@code + * CachedEngineIntentBuilder} constructed with a {@code Class} reference to the {@code + * FlutterActivity} subclass, e.g.: * *

    {@code return new CachedEngineIntentBuilder(MyFlutterActivity.class, engineId); } */ @@ -328,8 +338,8 @@ public class FlutterActivity extends Activity } /** - * Returns true if the cached {@link FlutterEngine} should be destroyed and removed from the - * cache when this {@code FlutterActivity} is destroyed. + * Returns true if the cached {@link io.flutter.embedding.engine.FlutterEngine} should be + * destroyed and removed from the cache when this {@code FlutterActivity} is destroyed. * *

    The default value is {@code false}. */ @@ -581,8 +591,8 @@ public class FlutterActivity extends Activity } /** - * Irreversibly release this activity's control of the {@link FlutterEngine} and its - * subcomponents. + * Irreversibly release this activity's control of the {@link + * io.flutter.embedding.engine.FlutterEngine} and its subcomponents. * *

    Calling will disconnect this activity's view from the Flutter renderer, disconnect this * activity from plugins' {@link ActivityControlSurface}, and stop system channel messages from @@ -709,9 +719,9 @@ public class FlutterActivity extends Activity } /** - * Returns the ID of a statically cached {@link FlutterEngine} to use within this {@code - * FlutterActivity}, or {@code null} if this {@code FlutterActivity} does not want to use a cached - * {@link FlutterEngine}. + * Returns the ID of a statically cached {@link io.flutter.embedding.engine.FlutterEngine} to use + * within this {@code FlutterActivity}, or {@code null} if this {@code FlutterActivity} does not + * want to use a cached {@link io.flutter.embedding.engine.FlutterEngine}. */ @Override @Nullable @@ -720,13 +730,13 @@ public class FlutterActivity extends Activity } /** - * Returns false if the {@link FlutterEngine} backing this {@code FlutterActivity} should outlive - * this {@code FlutterActivity}, or true to be destroyed when the {@code FlutterActivity} is - * destroyed. + * Returns false if the {@link io.flutter.embedding.engine.FlutterEngine} backing this {@code + * FlutterActivity} should outlive this {@code FlutterActivity}, or true to be destroyed when the + * {@code FlutterActivity} is destroyed. * *

    The default value is {@code true} in cases where {@code FlutterActivity} created its own - * {@link FlutterEngine}, and {@code false} in cases where a cached {@link FlutterEngine} was - * provided. + * {@link io.flutter.embedding.engine.FlutterEngine}, and {@code false} in cases where a cached + * {@link io.flutter.embedding.engine.FlutterEngine} was provided. */ @Override public boolean shouldDestroyEngineWithHost() { @@ -810,7 +820,7 @@ public class FlutterActivity extends Activity * the launching {@code Intent}, that data String is interpreted as an app bundle path. * *

    When otherwise unspecified, the value is null, which defaults to the app bundle path defined - * in {@link FlutterLoader#findAppBundlePath()}. + * in {@link io.flutter.embedding.engine.loader.FlutterLoader#findAppBundlePath()}. * *

    Subclasses may override this method to return a custom app bundle path. */ @@ -877,10 +887,11 @@ public class FlutterActivity extends Activity } /** - * Hook for subclasses to easily provide a custom {@link FlutterEngine}. + * Hook for subclasses to easily provide a custom {@link + * io.flutter.embedding.engine.FlutterEngine}. * - *

    This hook is where a cached {@link FlutterEngine} should be provided, if a cached {@link - * FlutterEngine} is desired. + *

    This hook is where a cached {@link io.flutter.embedding.engine.FlutterEngine} should be + * provided, if a cached {@link FlutterEngine} is desired. */ @Nullable @Override @@ -890,8 +901,8 @@ public class FlutterActivity extends Activity } /** - * Hook for subclasses to obtain a reference to the {@link FlutterEngine} that is owned by this - * {@code FlutterActivity}. + * Hook for subclasses to obtain a reference to the {@link + * io.flutter.embedding.engine.FlutterEngine} that is owned by this {@code FlutterActivity}. */ @Nullable protected FlutterEngine getFlutterEngine() { @@ -950,37 +961,43 @@ public class FlutterActivity extends Activity /** * Hook for subclasses to control whether or not the {@link FlutterFragment} within this {@code - * Activity} automatically attaches its {@link FlutterEngine} to this {@code Activity}. + * Activity} automatically attaches its {@link io.flutter.embedding.engine.FlutterEngine} to this + * {@code Activity}. * *

    This property is controlled with a protected method instead of an {@code Intent} argument * because the only situation where changing this value would help, is a situation in which {@code - * FlutterActivity} is being subclassed to utilize a custom and/or cached {@link FlutterEngine}. + * FlutterActivity} is being subclassed to utilize a custom and/or cached {@link + * io.flutter.embedding.engine.FlutterEngine}. * *

    Defaults to {@code true}. * *

    Control surfaces are used to provide Android resources and lifecycle events to plugins that - * are attached to the {@link FlutterEngine}. If {@code shouldAttachEngineToActivity} is true then - * this {@code FlutterActivity} will connect its {@link FlutterEngine} to itself, along with any - * plugins that are registered with that {@link FlutterEngine}. This allows plugins to access the - * {@code Activity}, as well as receive {@code Activity}-specific calls, e.g., {@link + * are attached to the {@link io.flutter.embedding.engine.FlutterEngine}. If {@code + * shouldAttachEngineToActivity} is true, then this {@code FlutterActivity} will connect its + * {@link io.flutter.embedding.engine.FlutterEngine} to itself, along with any plugins that are + * registered with that {@link io.flutter.embedding.engine.FlutterEngine}. This allows plugins to + * access the {@code Activity}, as well as receive {@code Activity}-specific calls, e.g. {@link * Activity#onNewIntent(Intent)}. If {@code shouldAttachEngineToActivity} is false, then this * {@code FlutterActivity} will not automatically manage the connection between its {@link * FlutterEngine} and itself. In this case, plugins will not be offered a reference to an {@code * Activity} or its OS hooks. * - *

    Returning false from this method does not preclude a {@link FlutterEngine} from being - * attaching to a {@code FlutterActivity} - it just prevents the attachment from happening - * automatically. A developer can choose to subclass {@code FlutterActivity} and then invoke - * {@link ActivityControlSurface#attachToActivity(ExclusiveAppComponent, Lifecycle)} and {@link + *

    Returning false from this method does not preclude a {@link + * io.flutter.embedding.engine.FlutterEngine} from being attaching to a {@code FlutterActivity} - + * it just prevents the attachment from happening automatically. A developer can choose to + * subclass {@code FlutterActivity} and then invoke {@link + * ActivityControlSurface#attachToActivity(ExclusiveAppComponent, Lifecycle)} and {@link * ActivityControlSurface#detachFromActivity()} at the desired times. * *

    One reason that a developer might choose to manually manage the relationship between the - * {@code Activity} and {@link FlutterEngine} is if the developer wants to move the {@link - * FlutterEngine} somewhere else. For example, a developer might want the {@link FlutterEngine} to - * outlive this {@code FlutterActivity} so that it can be used later in a different {@code - * Activity}. To accomplish this, the {@link FlutterEngine} may need to be disconnected from this - * {@code FluttterActivity} at an unusual time, preventing this {@code FlutterActivity} from - * correctly managing the relationship between the {@link FlutterEngine} and itself. + * {@code Activity} and {@link io.flutter.embedding.engine.FlutterEngine} is if the developer + * wants to move the {@link FlutterEngine} somewhere else. For example, a developer might want the + * {@link io.flutter.embedding.engine.FlutterEngine} to outlive this {@code FlutterActivity} so + * that it can be used later in a different {@code Activity}. To accomplish this, the {@link + * io.flutter.embedding.engine.FlutterEngine} may need to be disconnected from this {@code + * FluttterActivity} at an unusual time, preventing this {@code FlutterActivity} from correctly + * managing the relationship between the {@link io.flutter.embedding.engine.FlutterEngine} and + * itself. */ @Override public boolean shouldAttachEngineToActivity() { 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 17fe1584ca..a789a7a95a 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 @@ -102,8 +102,9 @@ import java.util.Arrays; *

    No further method invocations may occur on this {@code FlutterActivityAndFragmentDelegate} * after invoking this method. If a method is invoked, an exception will occur. * - *

    This method only clears out references. It does not destroy its {@link FlutterEngine}. The - * behavior that destroys a {@link FlutterEngine} can be found in {@link #onDetach()}. + *

    This method only clears out references. It does not destroy its {@link + * io.flutter.embedding.engine.FlutterEngine}. The behavior that destroys a {@link + * io.flutter.embedding.engine.FlutterEngine} can be found in {@link #onDetach()}. */ void release() { this.host = null; @@ -113,8 +114,8 @@ import java.util.Arrays; } /** - * Returns the {@link FlutterEngine} that is owned by this delegate and its host {@code Activity} - * or {@code Fragment}. + * Returns the {@link io.flutter.embedding.engine.FlutterEngine} that is owned by this delegate + * and its host {@code Activity} or {@code Fragment}. */ @Nullable /* package */ FlutterEngine getFlutterEngine() { @@ -139,10 +140,11 @@ import java.util.Arrays; * *

      *
    1. Initializes the Flutter system. - *
    2. Obtains or creates a {@link FlutterEngine}. + *
    3. Obtains or creates a {@link io.flutter.embedding.engine.FlutterEngine}. *
    4. Creates and configures a {@link PlatformPlugin}. - *
    5. Attaches the {@link FlutterEngine} to the surrounding {@code Activity}, if desired. - *
    6. Configures the {@link FlutterEngine} via {@link + *
    7. Attaches the {@link io.flutter.embedding.engine.FlutterEngine} to the surrounding {@code + * Activity}, if desired. + *
    8. Configures the {@link io.flutter.embedding.engine.FlutterEngine} via {@link * Host#configureFlutterEngine(FlutterEngine)}. *
    */ @@ -196,14 +198,15 @@ import java.util.Arrays; * *

    * - *

    First, the {@code host} is asked if it would like to use a cached {@link FlutterEngine}, and - * if so, the cached {@link FlutterEngine} is retrieved. + *

    First, the {@code host} is asked if it would like to use a cached {@link + * io.flutter.embedding.engine.FlutterEngine}, and if so, the cached {@link + * io.flutter.embedding.engine.FlutterEngine} is retrieved. * - *

    Second, the {@code host} is given an opportunity to provide a {@link FlutterEngine} via - * {@link Host#provideFlutterEngine(Context)}. + *

    Second, the {@code host} is given an opportunity to provide a {@link + * io.flutter.embedding.engine.FlutterEngine} via {@link Host#provideFlutterEngine(Context)}. * - *

    If the {@code host} does not provide a {@link FlutterEngine}, then a new {@link - * FlutterEngine} is instantiated. + *

    If the {@code host} does not provide a {@link io.flutter.embedding.engine.FlutterEngine}, + * then a new {@link FlutterEngine} is instantiated. */ @VisibleForTesting /* package */ void setupFlutterEngine() { @@ -256,7 +259,8 @@ import java.util.Arrays; *

      *
    1. creates a new {@link FlutterView} in a {@code View} hierarchy *
    2. adds a {@link FlutterUiDisplayListener} to it - *
    3. attaches a {@link FlutterEngine} to the new {@link FlutterView} + *
    4. attaches a {@link io.flutter.embedding.engine.FlutterEngine} to the new {@link + * FlutterView} *
    5. returns the new {@code View} hierarchy *
    */ @@ -473,7 +477,8 @@ import java.util.Arrays; *
      *
    1. This method notifies the running Flutter app that it is "paused" as per the Flutter app * lifecycle. - *
    2. Detaches this delegate's {@link FlutterEngine} from this delegate's {@link FlutterView}. + *
    3. Detaches this delegate's {@link io.flutter.embedding.engine.FlutterEngine} from this + * delegate's {@link FlutterView}. *
    */ void onStop() { @@ -538,10 +543,10 @@ import java.util.Arrays; *

    * *

      - *
    1. Detaches this delegate's {@link FlutterEngine} from its surrounding {@code Activity}, if - * it was previously attached. + *
    2. Detaches this delegate's {@link io.flutter.embedding.engine.FlutterEngine} from its + * surrounding {@code Activity}, if it was previously attached. *
    3. Destroys this delegate's {@link PlatformPlugin}. - *
    4. Destroys this delegate's {@link FlutterEngine} if {@link + *
    5. Destroys this delegate's {@link io.flutter.embedding.engine.FlutterEngine} if {@link * Host#shouldDestroyEngineWithHost()} ()} returns true. *
    */ @@ -586,7 +591,7 @@ import java.util.Arrays; } /** - * Invoke this from {@link Activity#onBackPressed()}. + * Invoke this from {@link android.app.Activity#onBackPressed()}. * *

    A {@code Fragment} host must have its containing {@code Activity} forward this call so that * the {@code Fragment} can then invoke this method. @@ -604,8 +609,8 @@ import java.util.Arrays; } /** - * Invoke this from {@link Activity#onRequestPermissionsResult(int, String[], int[])} or {@code - * Fragment#onRequestPermissionsResult(int, String[], int[])}. + * Invoke this from {@link android.app.Activity#onRequestPermissionsResult(int, String[], int[])} + * or {@code Fragment#onRequestPermissionsResult(int, String[], int[])}. * *

    This method forwards to interested Flutter plugins. */ @@ -701,7 +706,7 @@ import java.util.Arrays; } /** - * Invoke this from {@link Activity#onTrimMemory(int)}. + * Invoke this from {@link android.app.Activity#onTrimMemory(int)}. * *

    A {@code Fragment} host must have its containing {@code Activity} forward this call so that * the {@code Fragment} can then invoke this method. @@ -726,7 +731,7 @@ import java.util.Arrays; } /** - * Invoke this from {@link Activity#onLowMemory()}. + * Invoke this from {@link android.app.Activity#onLowMemory()}. * *

    A {@code Fragment} host must have its containing {@code Activity} forward this call so that * the {@code Fragment} can then invoke this method. @@ -761,7 +766,10 @@ import java.util.Arrays; FlutterEngineProvider, FlutterEngineConfigurator, PlatformPlugin.PlatformPluginDelegate { - /** Returns the {@link Context} that backs the host {@link Activity} or {@code Fragment}. */ + /** + * Returns the {@link Context} that backs the host {@link android.app.Activity} or {@code + * Fragment}. + */ @NonNull Context getContext(); @@ -770,13 +778,16 @@ import java.util.Arrays; boolean shouldHandleDeeplinking(); /** - * Returns the host {@link Activity} or the {@code Activity} that is currently attached to the - * host {@code Fragment}. + * Returns the host {@link android.app.Activity} or the {@code Activity} that is currently + * attached to the host {@code Fragment}. */ @Nullable Activity getActivity(); - /** Returns the {@link Lifecycle} that backs the host {@link Activity} or {@code Fragment}. */ + /** + * Returns the {@link Lifecycle} that backs the host {@link android.app.Activity} or {@code + * Fragment}. + */ @NonNull Lifecycle getLifecycle(); @@ -785,33 +796,36 @@ import java.util.Arrays; FlutterShellArgs getFlutterShellArgs(); /** - * Returns the ID of a statically cached {@link FlutterEngine} to use within this delegate's - * host, or {@code null} if this delegate's host does not want to use a cached {@link - * FlutterEngine}. + * Returns the ID of a statically cached {@link io.flutter.embedding.engine.FlutterEngine} to + * use within this delegate's host, or {@code null} if this delegate's host does not want to use + * a cached {@link FlutterEngine}. */ @Nullable String getCachedEngineId(); /** - * Returns true if the {@link FlutterEngine} used in this delegate should be destroyed when the - * host/delegate are destroyed. + * Returns true if the {@link io.flutter.embedding.engine.FlutterEngine} used in this delegate + * should be destroyed when the host/delegate are destroyed. * *

    The default value is {@code true} in cases where {@code FlutterFragment} created its own - * {@link FlutterEngine}, and {@code false} in cases where a cached {@link FlutterEngine} was - * provided. + * {@link io.flutter.embedding.engine.FlutterEngine}, and {@code false} in cases where a cached + * {@link io.flutter.embedding.engine.FlutterEngine} was provided. */ boolean shouldDestroyEngineWithHost(); /** - * Callback called when the {@link FlutterEngine} has been attached to by another activity - * before this activity was destroyed. + * Callback called when the {@link io.flutter.embedding.engine.FlutterEngine} has been attached + * to by another activity before this activity was destroyed. * *

    The expected behavior is for this activity to synchronously stop using the {@link * FlutterEngine} to avoid lifecycle crosstalk with the new activity. */ void detachFromFlutterEngine(); - /** Returns the Dart entrypoint that should run when a new {@link FlutterEngine} is created. */ + /** + * Returns the Dart entrypoint that should run when a new {@link + * io.flutter.embedding.engine.FlutterEngine} is created. + */ @NonNull String getDartEntrypointFunctionName(); @@ -841,9 +855,11 @@ import java.util.Arrays; SplashScreen provideSplashScreen(); /** - * Returns the {@link FlutterEngine} that should be rendered to a {@link FlutterView}. + * Returns the {@link io.flutter.embedding.engine.FlutterEngine} that should be rendered to a + * {@link FlutterView}. * - *

    If {@code null} is returned, a new {@link FlutterEngine} will be created automatically. + *

    If {@code null} is returned, a new {@link io.flutter.embedding.engine.FlutterEngine} will + * be created automatically. */ @Nullable FlutterEngine provideFlutterEngine(@NonNull Context context); @@ -856,7 +872,10 @@ import java.util.Arrays; PlatformPlugin providePlatformPlugin( @Nullable Activity activity, @NonNull FlutterEngine flutterEngine); - /** Hook for the host to configure the {@link FlutterEngine} as desired. */ + /** + * Hook for the host to configure the {@link io.flutter.embedding.engine.FlutterEngine} as + * desired. + */ void configureFlutterEngine(@NonNull FlutterEngine flutterEngine); /** @@ -866,8 +885,8 @@ import java.util.Arrays; void cleanUpFlutterEngine(@NonNull FlutterEngine flutterEngine); /** - * Returns true if the {@link FlutterEngine}'s plugin system should be connected to the host - * {@link Activity}, allowing plugins to interact with it. + * Returns true if the {@link io.flutter.embedding.engine.FlutterEngine}'s plugin system should + * be connected to the host {@link android.app.Activity}, allowing plugins to interact with it. */ boolean shouldAttachEngineToActivity(); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineConfigurator.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineConfigurator.java index 94dc318173..4cf1eb91a4 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineConfigurator.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineConfigurator.java @@ -9,17 +9,18 @@ import androidx.lifecycle.Lifecycle; import io.flutter.embedding.engine.FlutterEngine; /** - * Configures a {@link FlutterEngine} after it is created, e.g., adds plugins. + * Configures a {@link io.flutter.embedding.engine.FlutterEngine} after it is created, e.g., adds + * plugins. * *

    This interface may be applied to a {@link androidx.fragment.app.FragmentActivity} that owns a * {@code FlutterFragment}. */ public interface FlutterEngineConfigurator { /** - * Configures the given {@link FlutterEngine}. + * Configures the given {@link io.flutter.embedding.engine.FlutterEngine}. * - *

    This method is called after the given {@link FlutterEngine} has been attached to the owning - * {@code FragmentActivity}. See {@link + *

    This method is called after the given {@link io.flutter.embedding.engine.FlutterEngine} has + * been attached to the owning {@code FragmentActivity}. See {@link * io.flutter.embedding.engine.plugins.activity.ActivityControlSurface#attachToActivity( * ExclusiveAppComponent, Lifecycle)}. * diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineProvider.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineProvider.java index 420e9cc4a5..c06b3309c7 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineProvider.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterEngineProvider.java @@ -10,21 +10,23 @@ import androidx.annotation.Nullable; import io.flutter.embedding.engine.FlutterEngine; /** - * Provides a {@link FlutterEngine} instance to be used by a {@code FlutterActivity} or {@code - * FlutterFragment}. + * Provides a {@link io.flutter.embedding.engine.FlutterEngine} instance to be used by a {@code + * FlutterActivity} or {@code FlutterFragment}. * - *

    {@link FlutterEngine} instances require significant time to warm up. Therefore, a developer - * might choose to hold onto an existing {@link FlutterEngine} and connect it to various {@link - * FlutterActivity}s and/or {@code FlutterFragment}s. This interface facilitates providing a cached, - * pre-warmed {@link FlutterEngine}. + *

    {@link io.flutter.embedding.engine.FlutterEngine} instances require significant time to warm + * up. Therefore, a developer might choose to hold onto an existing {@link + * io.flutter.embedding.engine.FlutterEngine} and connect it to various {@link FlutterActivity}s + * and/or {@code FlutterFragment}s. This interface facilitates providing a cached, pre-warmed {@link + * io.flutter.embedding.engine.FlutterEngine}. */ public interface FlutterEngineProvider { /** - * Returns the {@link FlutterEngine} that should be used by a child {@code FlutterFragment}. + * Returns the {@link io.flutter.embedding.engine.FlutterEngine} that should be used by a child + * {@code FlutterFragment}. * - *

    This method may return a new {@link FlutterEngine}, an existing, cached {@link - * FlutterEngine}, or null to express that the {@code FlutterEngineProvider} would like the {@code - * FlutterFragment} to provide its own {@code FlutterEngine} instance. + *

    This method may return a new {@link io.flutter.embedding.engine.FlutterEngine}, an existing, + * cached {@link FlutterEngine}, or null to express that the {@code FlutterEngineProvider} would + * like the {@code FlutterFragment} to provide its own {@code FlutterEngine} instance. */ @Nullable FlutterEngine provideFlutterEngine(@NonNull Context context); 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 1be1fb0aaa..c83697ed44 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 @@ -51,24 +51,30 @@ import io.flutter.plugin.platform.PlatformPlugin; *

    If convenient, consider using a {@link FlutterActivity} instead of a {@code FlutterFragment} * to avoid the work of forwarding calls. * - *

    {@code FlutterFragment} supports the use of an existing, cached {@link FlutterEngine}. To use - * a cached {@link FlutterEngine}, ensure that the {@link FlutterEngine} is stored in {@link - * FlutterEngineCache} and then use {@link #withCachedEngine(String)} to build a {@code - * FlutterFragment} with the cached {@link FlutterEngine}'s ID. + *

    {@code FlutterFragment} supports the use of an existing, cached {@link + * io.flutter.embedding.engine.FlutterEngine}. To use a cached {@link + * io.flutter.embedding.engine.FlutterEngine}, ensure that the {@link + * io.flutter.embedding.engine.FlutterEngine} is stored in {@link + * io.flutter.embedding.engine.FlutterEngineCache} and then use {@link #withCachedEngine(String)} to + * build a {@code FlutterFragment} with the cached {@link + * io.flutter.embedding.engine.FlutterEngine}'s ID. * - *

    It is generally recommended to use a cached {@link FlutterEngine} to avoid a momentary delay - * when initializing a new {@link FlutterEngine}. The two exceptions to using a cached {@link + *

    It is generally recommended to use a cached {@link io.flutter.embedding.engine.FlutterEngine} + * to avoid a momentary delay when initializing a new {@link + * io.flutter.embedding.engine.FlutterEngine}. The two exceptions to using a cached {@link * FlutterEngine} are: * *

    * *

    * - *

    The following illustrates how to pre-warm and cache a {@link FlutterEngine}: + *

    The following illustrates how to pre-warm and cache a {@link + * io.flutter.embedding.engine.FlutterEngine}: * *

    {@code
      * // Create and pre-warm a FlutterEngine.
    @@ -109,14 +115,16 @@ public class FlutterFragment extends Fragment
       protected static final String ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY =
           "should_attach_engine_to_activity";
       /**
    -   * The ID of a {@link FlutterEngine} cached in {@link FlutterEngineCache} that will be used within
    -   * the created {@code FlutterFragment}.
    +   * The ID of a {@link io.flutter.embedding.engine.FlutterEngine} cached in {@link
    +   * io.flutter.embedding.engine.FlutterEngineCache} that will be used within the created {@code
    +   * FlutterFragment}.
        */
       protected static final String ARG_CACHED_ENGINE_ID = "cached_engine_id";
       /**
    -   * True if the {@link FlutterEngine} in the created {@code FlutterFragment} should be destroyed
    -   * when the {@code FlutterFragment} is destroyed, false if the {@link FlutterEngine} should
    -   * outlive the {@code FlutterFragment}.
    +   * True if the {@link io.flutter.embedding.engine.FlutterEngine} in the created {@code
    +   * FlutterFragment} should be destroyed when the {@code FlutterFragment} is destroyed, false if
    +   * the {@link io.flutter.embedding.engine.FlutterEngine} should outlive the {@code
    +   * FlutterFragment}.
        */
       protected static final String ARG_DESTROY_ENGINE_WITH_FRAGMENT = "destroy_engine_with_fragment";
       /**
    @@ -134,8 +142,9 @@ public class FlutterFragment extends Fragment
       /**
        * Creates a {@code FlutterFragment} with a default configuration.
        *
    -   * 

    {@code FlutterFragment}'s default configuration creates a new {@link FlutterEngine} within - * the {@code FlutterFragment} and uses the following settings: + *

    {@code FlutterFragment}'s default configuration creates a new {@link + * io.flutter.embedding.engine.FlutterEngine} within the {@code FlutterFragment} and uses the + * following settings: * *

      *
    • Dart entrypoint: "main" @@ -144,10 +153,11 @@ public class FlutterFragment extends Fragment *
    • Transparency mode: transparent *
    * - *

    To use a new {@link FlutterEngine} with different settings, use {@link #withNewEngine()}. + *

    To use a new {@link io.flutter.embedding.engine.FlutterEngine} with different settings, use + * {@link #withNewEngine()}. * - *

    To use a cached {@link FlutterEngine} instead of creating a new one, use {@link - * #withCachedEngine(String)}. + *

    To use a cached {@link io.flutter.embedding.engine.FlutterEngine} instead of creating a new + * one, use {@link #withCachedEngine(String)}. */ @NonNull public static FlutterFragment createDefault() { @@ -156,7 +166,7 @@ public class FlutterFragment extends Fragment /** * Returns a {@link NewEngineFragmentBuilder} to create a {@code FlutterFragment} with a new - * {@link FlutterEngine} and a desired engine configuration. + * {@link io.flutter.embedding.engine.FlutterEngine} and a desired engine configuration. */ @NonNull public static NewEngineFragmentBuilder withNewEngine() { @@ -251,7 +261,8 @@ public class FlutterFragment extends Fragment /** * The path to the app bundle which contains the Dart app to execute. Null when unspecified, - * which defaults to {@link FlutterLoader#findAppBundlePath()} + * which defaults to {@link + * io.flutter.embedding.engine.loader.FlutterLoader#findAppBundlePath()} */ @NonNull public NewEngineFragmentBuilder appBundlePath(@NonNull String appBundlePath) { @@ -292,37 +303,40 @@ public class FlutterFragment extends Fragment /** * Whether or not this {@code FlutterFragment} should automatically attach its {@code Activity} - * as a control surface for its {@link FlutterEngine}. + * as a control surface for its {@link io.flutter.embedding.engine.FlutterEngine}. * *

    Control surfaces are used to provide Android resources and lifecycle events to plugins - * that are attached to the {@link FlutterEngine}. If {@code shouldAttachEngineToActivity} is - * true then this {@code FlutterFragment} will connect its {@link FlutterEngine} to the - * surrounding {@code Activity}, along with any plugins that are registered with that {@link - * FlutterEngine}. This allows plugins to access the {@code Activity}, as well as receive {@code - * Activity}-specific calls, e.g., {@link android.app.Activity#onNewIntent(Intent)}. If {@code - * shouldAttachEngineToActivity} is false, then this {@code FlutterFragment} will not - * automatically manage the connection between its {@link FlutterEngine} and the surrounding - * {@code Activity}. The {@code Activity} will need to be manually connected to this {@code - * FlutterFragment}'s {@link FlutterEngine} by the app developer. See {@link + * that are attached to the {@link io.flutter.embedding.engine.FlutterEngine}. If {@code + * shouldAttachEngineToActivity} is true then this {@code FlutterFragment} will connect its + * {@link io.flutter.embedding.engine.FlutterEngine} to the surrounding {@code Activity}, along + * with any plugins that are registered with that {@link FlutterEngine}. This allows plugins to + * access the {@code Activity}, as well as receive {@code Activity}-specific calls, e.g., {@link + * android.app.Activity#onNewIntent(Intent)}. If {@code shouldAttachEngineToActivity} is false, + * then this {@code FlutterFragment} will not automatically manage the connection between its + * {@link io.flutter.embedding.engine.FlutterEngine} and the surrounding {@code Activity}. The + * {@code Activity} will need to be manually connected to this {@code FlutterFragment}'s {@link + * io.flutter.embedding.engine.FlutterEngine} by the app developer. See {@link * FlutterEngine#getActivityControlSurface()}. * *

    One reason that a developer might choose to manually manage the relationship between the - * {@code Activity} and {@link FlutterEngine} is if the developer wants to move the {@link - * FlutterEngine} somewhere else. For example, a developer might want the {@link FlutterEngine} - * to outlive the surrounding {@code Activity} so that it can be used later in a different - * {@code Activity}. To accomplish this, the {@link FlutterEngine} will need to be disconnected - * from the surrounding {@code Activity} at an unusual time, preventing this {@code - * FlutterFragment} from correctly managing the relationship between the {@link FlutterEngine} - * and the surrounding {@code Activity}. + * {@code Activity} and {@link io.flutter.embedding.engine.FlutterEngine} is if the developer + * wants to move the {@link FlutterEngine} somewhere else. For example, a developer might want + * the {@link io.flutter.embedding.engine.FlutterEngine} to outlive the surrounding {@code + * Activity} so that it can be used later in a different {@code Activity}. To accomplish this, + * the {@link io.flutter.embedding.engine.FlutterEngine} will need to be disconnected from the + * surrounding {@code Activity} at an unusual time, preventing this {@code FlutterFragment} from + * correctly managing the relationship between the {@link + * io.flutter.embedding.engine.FlutterEngine} and the surrounding {@code Activity}. * *

    Another reason that a developer might choose to manually manage the relationship between - * the {@code Activity} and {@link FlutterEngine} is if the developer wants to prevent, or - * explicitly control when the {@link FlutterEngine}'s plugins have access to the surrounding - * {@code Activity}. For example, imagine that this {@code FlutterFragment} only takes up part - * of the screen and the app developer wants to ensure that none of the Flutter plugins are able - * to manipulate the surrounding {@code Activity}. In this case, the developer would not want - * the {@link FlutterEngine} to have access to the {@code Activity}, which can be accomplished - * by setting {@code shouldAttachEngineToActivity} to {@code false}. + * the {@code Activity} and {@link io.flutter.embedding.engine.FlutterEngine} is if the + * developer wants to prevent, or explicitly control when the {@link + * io.flutter.embedding.engine.FlutterEngine}'s plugins have access to the surrounding {@code + * Activity}. For example, imagine that this {@code FlutterFragment} only takes up part of the + * screen and the app developer wants to ensure that none of the Flutter plugins are able to + * manipulate the surrounding {@code Activity}. In this case, the developer would not want the + * {@link io.flutter.embedding.engine.FlutterEngine} to have access to the {@code Activity}, + * which can be accomplished by setting {@code shouldAttachEngineToActivity} to {@code false}. */ @NonNull public NewEngineFragmentBuilder shouldAttachEngineToActivity( @@ -413,14 +427,16 @@ public class FlutterFragment extends Fragment /** * Returns a {@link CachedEngineFragmentBuilder} to create a {@code FlutterFragment} with a cached - * {@link FlutterEngine} in {@link FlutterEngineCache}. + * {@link io.flutter.embedding.engine.FlutterEngine} in {@link + * io.flutter.embedding.engine.FlutterEngineCache}. * *

    An {@code IllegalStateException} will be thrown during the lifecycle of the {@code - * FlutterFragment} if a cached {@link FlutterEngine} is requested but does not exist in the - * cache. + * FlutterFragment} if a cached {@link io.flutter.embedding.engine.FlutterEngine} is requested but + * does not exist in the cache. * - *

    To create a {@code FlutterFragment} that uses a new {@link FlutterEngine}, use {@link - * #createDefault()} or {@link #withNewEngine()}. + *

    To create a {@code FlutterFragment} that uses a new {@link + * io.flutter.embedding.engine.FlutterEngine}, use {@link #createDefault()} or {@link + * #withNewEngine()}. */ @NonNull public static CachedEngineFragmentBuilder withCachedEngine(@NonNull String engineId) { @@ -428,8 +444,9 @@ public class FlutterFragment extends Fragment } /** - * Builder that creates a new {@code FlutterFragment} that uses a cached {@link FlutterEngine} - * with {@code arguments} that correspond to the values set on this {@code Builder}. + * Builder that creates a new {@code FlutterFragment} that uses a cached {@link + * io.flutter.embedding.engine.FlutterEngine} with {@code arguments} that correspond to the values + * set on this {@code Builder}. * *

    Subclasses of {@code FlutterFragment} that do not introduce any new arguments can use this * {@code Builder} to construct instances of the subclass without subclassing this {@code @@ -476,9 +493,9 @@ public class FlutterFragment extends Fragment } /** - * Pass {@code true} to destroy the cached {@link FlutterEngine} when this {@code - * FlutterFragment} is destroyed, or {@code false} for the cached {@link FlutterEngine} to - * outlive this {@code FlutterFragment}. + * Pass {@code true} to destroy the cached {@link io.flutter.embedding.engine.FlutterEngine} + * when this {@code FlutterFragment} is destroyed, or {@code false} for the cached {@link + * io.flutter.embedding.engine.FlutterEngine} to outlive this {@code FlutterFragment}. */ @NonNull public CachedEngineFragmentBuilder destroyEngineWithFragment( @@ -524,37 +541,40 @@ public class FlutterFragment extends Fragment /** * Whether or not this {@code FlutterFragment} should automatically attach its {@code Activity} - * as a control surface for its {@link FlutterEngine}. + * as a control surface for its {@link io.flutter.embedding.engine.FlutterEngine}. * *

    Control surfaces are used to provide Android resources and lifecycle events to plugins - * that are attached to the {@link FlutterEngine}. If {@code shouldAttachEngineToActivity} is - * true then this {@code FlutterFragment} will connect its {@link FlutterEngine} to the - * surrounding {@code Activity}, along with any plugins that are registered with that {@link - * FlutterEngine}. This allows plugins to access the {@code Activity}, as well as receive {@code - * Activity}-specific calls, e.g., {@link android.app.Activity#onNewIntent(Intent)}. If {@code - * shouldAttachEngineToActivity} is false, then this {@code FlutterFragment} will not - * automatically manage the connection between its {@link FlutterEngine} and the surrounding - * {@code Activity}. The {@code Activity} will need to be manually connected to this {@code - * FlutterFragment}'s {@link FlutterEngine} by the app developer. See {@link + * that are attached to the {@link io.flutter.embedding.engine.FlutterEngine}. If {@code + * shouldAttachEngineToActivity} is true then this {@code FlutterFragment} will connect its + * {@link io.flutter.embedding.engine.FlutterEngine} to the surrounding {@code Activity}, along + * with any plugins that are registered with that {@link FlutterEngine}. This allows plugins to + * access the {@code Activity}, as well as receive {@code Activity}-specific calls, e.g., {@link + * android.app.Activity#onNewIntent(Intent)}. If {@code shouldAttachEngineToActivity} is false, + * then this {@code FlutterFragment} will not automatically manage the connection between its + * {@link io.flutter.embedding.engine.FlutterEngine} and the surrounding {@code Activity}. The + * {@code Activity} will need to be manually connected to this {@code FlutterFragment}'s {@link + * io.flutter.embedding.engine.FlutterEngine} by the app developer. See {@link * FlutterEngine#getActivityControlSurface()}. * *

    One reason that a developer might choose to manually manage the relationship between the - * {@code Activity} and {@link FlutterEngine} is if the developer wants to move the {@link - * FlutterEngine} somewhere else. For example, a developer might want the {@link FlutterEngine} - * to outlive the surrounding {@code Activity} so that it can be used later in a different - * {@code Activity}. To accomplish this, the {@link FlutterEngine} will need to be disconnected - * from the surrounding {@code Activity} at an unusual time, preventing this {@code - * FlutterFragment} from correctly managing the relationship between the {@link FlutterEngine} - * and the surrounding {@code Activity}. + * {@code Activity} and {@link io.flutter.embedding.engine.FlutterEngine} is if the developer + * wants to move the {@link FlutterEngine} somewhere else. For example, a developer might want + * the {@link io.flutter.embedding.engine.FlutterEngine} to outlive the surrounding {@code + * Activity} so that it can be used later in a different {@code Activity}. To accomplish this, + * the {@link io.flutter.embedding.engine.FlutterEngine} will need to be disconnected from the + * surrounding {@code Activity} at an unusual time, preventing this {@code FlutterFragment} from + * correctly managing the relationship between the {@link + * io.flutter.embedding.engine.FlutterEngine} and the surrounding {@code Activity}. * *

    Another reason that a developer might choose to manually manage the relationship between - * the {@code Activity} and {@link FlutterEngine} is if the developer wants to prevent, or - * explicitly control when the {@link FlutterEngine}'s plugins have access to the surrounding - * {@code Activity}. For example, imagine that this {@code FlutterFragment} only takes up part - * of the screen and the app developer wants to ensure that none of the Flutter plugins are able - * to manipulate the surrounding {@code Activity}. In this case, the developer would not want - * the {@link FlutterEngine} to have access to the {@code Activity}, which can be accomplished - * by setting {@code shouldAttachEngineToActivity} to {@code false}. + * the {@code Activity} and {@link io.flutter.embedding.engine.FlutterEngine} is if the + * developer wants to prevent, or explicitly control when the {@link + * io.flutter.embedding.engine.FlutterEngine}'s plugins have access to the surrounding {@code + * Activity}. For example, imagine that this {@code FlutterFragment} only takes up part of the + * screen and the app developer wants to ensure that none of the Flutter plugins are able to + * manipulate the surrounding {@code Activity}. In this case, the developer would not want the + * {@link io.flutter.embedding.engine.FlutterEngine} to have access to the {@code Activity}, + * which can be accomplished by setting {@code shouldAttachEngineToActivity} to {@code false}. */ @NonNull public CachedEngineFragmentBuilder shouldAttachEngineToActivity( @@ -900,9 +920,9 @@ public class FlutterFragment extends Fragment } /** - * Returns the ID of a statically cached {@link FlutterEngine} to use within this {@code - * FlutterFragment}, or {@code null} if this {@code FlutterFragment} does not want to use a cached - * {@link FlutterEngine}. + * Returns the ID of a statically cached {@link io.flutter.embedding.engine.FlutterEngine} to use + * within this {@code FlutterFragment}, or {@code null} if this {@code FlutterFragment} does not + * want to use a cached {@link io.flutter.embedding.engine.FlutterEngine}. */ @Nullable @Override @@ -919,11 +939,11 @@ public class FlutterFragment extends Fragment } /** - * Returns false if the {@link FlutterEngine} within this {@code FlutterFragment} should outlive - * the {@code FlutterFragment}, itself. + * Returns false if the {@link io.flutter.embedding.engine.FlutterEngine} within this {@code + * FlutterFragment} should outlive the {@code FlutterFragment}, itself. * - *

    Defaults to true if no custom {@link FlutterEngine is provided}, false if a custom {@link - * FlutterEngine} is provided. + *

    Defaults to true if no custom {@link io.flutter.embedding.engine.FlutterEngine is provided}, + * false if a custom {@link FlutterEngine} is provided. */ @Override public boolean shouldDestroyEngineWithHost() { @@ -958,7 +978,7 @@ public class FlutterFragment extends Fragment * snapshots. * *

    When unspecified, the value is null, which defaults to the app bundle path defined in {@link - * FlutterLoader#findAppBundlePath()}. + * io.flutter.embedding.engine.loader.FlutterLoader#findAppBundlePath()}. * *

    Used by this {@code FlutterFragment}'s {@link FlutterActivityAndFragmentDelegate.Host} */ @@ -1027,18 +1047,22 @@ public class FlutterFragment extends Fragment } /** - * Hook for subclasses to return a {@link FlutterEngine} with whatever configuration is desired. + * Hook for subclasses to return a {@link io.flutter.embedding.engine.FlutterEngine} with whatever + * configuration is desired. * *

    By default this method defers to this {@code FlutterFragment}'s surrounding {@code - * Activity}, if that {@code Activity} implements {@link FlutterEngineProvider}. If this method is - * overridden, the surrounding {@code Activity} will no longer be given an opportunity to provide - * a {@link FlutterEngine}, unless the subclass explicitly implements that behavior. + * Activity}, if that {@code Activity} implements {@link + * io.flutter.embedding.android.FlutterEngineProvider}. If this method is overridden, the + * surrounding {@code Activity} will no longer be given an opportunity to provide a {@link + * io.flutter.embedding.engine.FlutterEngine}, unless the subclass explicitly implements that + * behavior. * - *

    Consider returning a cached {@link FlutterEngine} instance from this method to avoid the - * typical warm-up time that a new {@link FlutterEngine} instance requires. + *

    Consider returning a cached {@link io.flutter.embedding.engine.FlutterEngine} instance from + * this method to avoid the typical warm-up time that a new {@link + * io.flutter.embedding.engine.FlutterEngine} instance requires. * - *

    If null is returned then a new default {@link FlutterEngine} will be created to back this - * {@code FlutterFragment}. + *

    If null is returned then a new default {@link io.flutter.embedding.engine.FlutterEngine} + * will be created to back this {@code FlutterFragment}. * *

    Used by this {@code FlutterFragment}'s {@link FlutterActivityAndFragmentDelegate.Host} */ @@ -1060,8 +1084,8 @@ public class FlutterFragment extends Fragment } /** - * Hook for subclasses to obtain a reference to the {@link FlutterEngine} that is owned by this - * {@code FlutterActivity}. + * Hook for subclasses to obtain a reference to the {@link + * io.flutter.embedding.engine.FlutterEngine} that is owned by this {@code FlutterActivity}. */ @Nullable public FlutterEngine getFlutterEngine() { @@ -1080,10 +1104,11 @@ public class FlutterFragment extends Fragment } /** - * Configures a {@link FlutterEngine} after its creation. + * Configures a {@link io.flutter.embedding.engine.FlutterEngine} after its creation. * *

    This method is called after {@link #provideFlutterEngine(Context)}, and after the given - * {@link FlutterEngine} has been attached to the owning {@code FragmentActivity}. See {@link + * {@link io.flutter.embedding.engine.FlutterEngine} has been attached to the owning {@code + * FragmentActivity}. See {@link * io.flutter.embedding.engine.plugins.activity.ActivityControlSurface#attachToActivity( * ExclusiveAppComponent, Lifecycle)}. * @@ -1093,8 +1118,8 @@ public class FlutterFragment extends Fragment * the time that this method is invoked. * *

    The default behavior of this method is to defer to the owning {@code FragmentActivity} as a - * {@link FlutterEngineConfigurator}. Subclasses can override this method if the subclass needs to - * override the {@code FragmentActivity}'s behavior, or add to it. + * {@link io.flutter.embedding.android.FlutterEngineConfigurator}. Subclasses can override this + * method if the subclass needs to override the {@code FragmentActivity}'s behavior, or add to it. * *

    Used by this {@code FlutterFragment}'s {@link FlutterActivityAndFragmentDelegate.Host} */ 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 b796c8ed43..85abc679f5 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 @@ -76,7 +76,8 @@ public class FlutterFragmentActivity extends FragmentActivity /** * Creates an {@link FlutterFragmentActivity.NewEngineIntentBuilder}, which can be used to * configure an {@link Intent} to launch a {@code FlutterFragmentActivity} that internally creates - * a new {@link FlutterEngine} using the desired Dart entrypoint, initial route, etc. + * a new {@link io.flutter.embedding.engine.FlutterEngine} using the desired Dart entrypoint, + * initial route, etc. */ @NonNull public static NewEngineIntentBuilder withNewEngine() { @@ -85,7 +86,7 @@ public class FlutterFragmentActivity extends FragmentActivity /** * Builder to create an {@code Intent} that launches a {@code FlutterFragmentActivity} with a new - * {@link FlutterEngine} and the desired configuration. + * {@link io.flutter.embedding.engine.FlutterEngine} and the desired configuration. */ public static class NewEngineIntentBuilder { private final Class activityClass; @@ -164,7 +165,7 @@ public class FlutterFragmentActivity extends FragmentActivity /** * Builder to create an {@code Intent} that launches a {@code FlutterFragmentActivity} with an - * existing {@link FlutterEngine} that is cached in {@link + * existing {@link io.flutter.embedding.engine.FlutterEngine} that is cached in {@link * io.flutter.embedding.engine.FlutterEngineCache}. */ public static class CachedEngineIntentBuilder { @@ -178,9 +179,9 @@ public class FlutterFragmentActivity extends FragmentActivity * {@code FlutterFragmentActivity}. * *

    Subclasses of {@code FlutterFragmentActivity} should provide their own static version of - * {@link #withCachedEngine()}, which returns an instance of {@code CachedEngineIntentBuilder} - * constructed with a {@code Class} reference to the {@code FlutterFragmentActivity} subclass, - * e.g.: + * {@link #withCachedEngine(String)}, which returns an instance of {@code + * CachedEngineIntentBuilder} constructed with a {@code Class} reference to the {@code + * FlutterFragmentActivity} subclass, e.g.: * *

    {@code return new CachedEngineIntentBuilder(MyFlutterActivity.class, engineId); } */ @@ -191,8 +192,8 @@ public class FlutterFragmentActivity extends FragmentActivity } /** - * Returns true if the cached {@link FlutterEngine} should be destroyed and removed from the - * cache when this {@code FlutterFragmentActivity} is destroyed. + * Returns true if the cached {@link io.flutter.embedding.engine.FlutterEngine} should be + * destroyed and removed from the cache when this {@code FlutterFragmentActivity} is destroyed. * *

    The default value is {@code false}. */ @@ -536,13 +537,13 @@ public class FlutterFragmentActivity extends FragmentActivity } /** - * Returns false if the {@link FlutterEngine} backing this {@code FlutterFragmentActivity} should - * outlive this {@code FlutterFragmentActivity}, or true to be destroyed when the {@code - * FlutterFragmentActivity} is destroyed. + * Returns false if the {@link io.flutter.embedding.engine.FlutterEngine} backing this {@code + * FlutterFragmentActivity} should outlive this {@code FlutterFragmentActivity}, or true to be + * destroyed when the {@code FlutterFragmentActivity} is destroyed. * *

    The default value is {@code true} in cases where {@code FlutterFragmentActivity} created its - * own {@link FlutterEngine}, and {@code false} in cases where a cached {@link FlutterEngine} was - * provided. + * own {@link io.flutter.embedding.engine.FlutterEngine}, and {@code false} in cases where a + * cached {@link io.flutter.embedding.engine.FlutterEngine} was provided. */ public boolean shouldDestroyEngineWithHost() { return getIntent().getBooleanExtra(EXTRA_DESTROY_ENGINE_WITH_ACTIVITY, false); @@ -550,7 +551,8 @@ public class FlutterFragmentActivity extends FragmentActivity /** * Hook for subclasses to control whether or not the {@link FlutterFragment} within this {@code - * Activity} automatically attaches its {@link FlutterEngine} to this {@code Activity}. + * Activity} automatically attaches its {@link io.flutter.embedding.engine.FlutterEngine} to this + * {@code Activity}. * *

    For an explanation of why this control exists, see {@link * FlutterFragment.NewEngineFragmentBuilder#shouldAttachEngineToActivity()}. @@ -638,7 +640,7 @@ public class FlutterFragmentActivity extends FragmentActivity * path. * *

    When otherwise unspecified, the value is null, which defaults to the app bundle path defined - * in {@link FlutterLoader#findAppBundlePath()}. + * in {@link io.flutter.embedding.engine.loader.FlutterLoader#findAppBundlePath()}. * *

    Subclasses may override this method to return a custom app bundle path. */ @@ -727,9 +729,10 @@ public class FlutterFragmentActivity extends FragmentActivity } /** - * Returns the ID of a statically cached {@link FlutterEngine} to use within this {@code - * FlutterFragmentActivity}, or {@code null} if this {@code FlutterFragmentActivity} does not want - * to use a cached {@link FlutterEngine}. + * Returns the ID of a statically cached {@link io.flutter.embedding.engine.FlutterEngine} to use + * within this {@code FlutterFragmentActivity}, or {@code null} if this {@code + * FlutterFragmentActivity} does not want to use a cached {@link + * io.flutter.embedding.engine.FlutterEngine}. */ @Nullable protected String getCachedEngineId() { @@ -754,7 +757,7 @@ public class FlutterFragmentActivity extends FragmentActivity * FlutterFragmentActivity}. * *

    That is, {@link RenderMode#surface} if {@link FlutterFragmentActivity#getBackgroundMode()} - * is {@link BackgroundMode.opaque} or {@link RenderMode#texture} otherwise. + * is {@link BackgroundMode#opaque} or {@link RenderMode#texture} otherwise. */ @NonNull protected RenderMode getRenderMode() { 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 5e56f9d188..0b77c6088d 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 @@ -53,7 +53,8 @@ import java.util.Set; /** * Displays a Flutter UI on an Android device. * - *

    A {@code FlutterView}'s UI is painted by a corresponding {@link FlutterEngine}. + *

    A {@code FlutterView}'s UI is painted by a corresponding {@link + * io.flutter.embedding.engine.FlutterEngine}. * *

    A {@code FlutterView} can operate in 2 different {@link * io.flutter.embedding.android.RenderMode}s: @@ -336,13 +337,13 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC } /** - * Returns true if an attached {@link FlutterEngine} has rendered at least 1 frame to this {@code - * FlutterView}. + * Returns true if an attached {@link io.flutter.embedding.engine.FlutterEngine} has rendered at + * least 1 frame to this {@code FlutterView}. * - *

    Returns false if no {@link FlutterEngine} is attached. + *

    Returns false if no {@link io.flutter.embedding.engine.FlutterEngine} is attached. * - *

    This flag is specific to a given {@link FlutterEngine}. The following hypothetical timeline - * demonstrates how this flag changes over time. + *

    This flag is specific to a given {@link io.flutter.embedding.engine.FlutterEngine}. The + * following hypothetical timeline demonstrates how this flag changes over time. * *

      *
    1. {@code flutterEngineA} is attached to this {@code FlutterView}: returns false @@ -498,8 +499,8 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC * these insets. Therefore, this method calculates the viewport metrics that Flutter should use * and then sends those metrics to Flutter. * - *

      This callback is not present in API < 20, which means lower API devices will see the wider - * than expected padding when the status and navigation bars are hidden. + *

      This callback is not present in API < 20, which means lower API devices will see the + * wider than expected padding when the status and navigation bars are hidden. */ @Override @TargetApi(20) @@ -833,7 +834,7 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC * Prior to Android Q, it's impossible to add real views as descendants of virtual nodes. This * breaks accessibility when an Android view is embedded in a Flutter app. * - *

      This method overrides a @hide method in {@code ViewGroup} to workaround this limitation. + *

      This method overrides a hidden method in {@code ViewGroup} to workaround this limitation. * This solution is derivated from Jetpack Compose, and can be found in the Android source code as * well. * @@ -851,7 +852,8 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC // Android Q or later doesn't call this method. // // However, since this is implementation detail, a future version of Android might call - // this method again, fallback to calling the @hide method as expected by ViewGroup. + // this method again, fallback to calling the This member is not intended for public use, and is + // only visible for testing. method as expected by ViewGroup. Method findViewByAccessibilityIdTraversalMethod; try { findViewByAccessibilityIdTraversalMethod = @@ -929,12 +931,13 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC // -------- End: Mouse --------- /** - * Connects this {@code FlutterView} to the given {@link FlutterEngine}. + * Connects this {@code FlutterView} to the given {@link + * io.flutter.embedding.engine.FlutterEngine}. * *

      This {@code FlutterView} will begin rendering the UI painted by the given {@link * FlutterEngine}. This {@code FlutterView} will also begin forwarding interaction events from - * this {@code FlutterView} to the given {@link FlutterEngine}, e.g., user touch events, - * accessibility events, keyboard events, and others. + * this {@code FlutterView} to the given {@link io.flutter.embedding.engine.FlutterEngine}, e.g., + * user touch events, accessibility events, keyboard events, and others. * *

      See {@link #detachFromFlutterEngine()} for information on how to detach from a {@link * FlutterEngine}. @@ -1030,11 +1033,12 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC } /** - * Disconnects this {@code FlutterView} from a previously attached {@link FlutterEngine}. + * Disconnects this {@code FlutterView} from a previously attached {@link + * io.flutter.embedding.engine.FlutterEngine}. * *

      This {@code FlutterView} will clear its UI and stop forwarding all events to the - * previously-attached {@link FlutterEngine}. This includes touch events, accessibility events, - * keyboard events, and others. + * previously-attached {@link io.flutter.embedding.engine.FlutterEngine}. This includes touch + * events, accessibility events, keyboard events, and others. * *

      See {@link #attachToFlutterEngine(FlutterEngine)} for information on how to attach a {@link * FlutterEngine}. @@ -1179,7 +1183,10 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC return false; } - /** Returns true if this {@code FlutterView} is currently attached to a {@link FlutterEngine}. */ + /** + * Returns true if this {@code FlutterView} is currently attached to a {@link + * io.flutter.embedding.engine.FlutterEngine}. + */ @VisibleForTesting public boolean isAttachedToFlutterEngine() { return flutterEngine != null @@ -1187,8 +1194,9 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC } /** - * Returns the {@link FlutterEngine} to which this {@code FlutterView} is currently attached, or - * null if this {@code FlutterView} is not currently attached to a {@link FlutterEngine}. + * Returns the {@link io.flutter.embedding.engine.FlutterEngine} to which this {@code FlutterView} + * is currently attached, or null if this {@code FlutterView} is not currently attached to a + * {@link io.flutter.embedding.engine.FlutterEngine}. */ @VisibleForTesting @Nullable @@ -1198,7 +1206,7 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC /** * Adds a {@link FlutterEngineAttachmentListener}, which is notified whenever this {@code - * FlutterView} attached to/detaches from a {@link FlutterEngine}. + * FlutterView} attached to/detaches from a {@link io.flutter.embedding.engine.FlutterEngine}. */ @VisibleForTesting public void addFlutterEngineAttachmentListener( @@ -1344,8 +1352,8 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC } /** - * Listener that is notified when a {@link FlutterEngine} is attached to/detached from a given - * {@code FlutterView}. + * Listener that is notified when a {@link io.flutter.embedding.engine.FlutterEngine} is attached + * to/detached from a given {@code FlutterView}. */ @VisibleForTesting public interface FlutterEngineAttachmentListener { @@ -1353,8 +1361,8 @@ public class FlutterView extends FrameLayout implements MouseCursorPlugin.MouseC void onFlutterEngineAttachedToFlutterView(@NonNull FlutterEngine engine); /** - * A previously attached {@link FlutterEngine} has been detached from the associated {@code - * FlutterView}. + * A previously attached {@link io.flutter.embedding.engine.FlutterEngine} has been detached + * from the associated {@code FlutterView}. */ void onFlutterEngineDetachedFromFlutterView(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyChannelResponder.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyChannelResponder.java index d3bd28db79..1a9dce7484 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyChannelResponder.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyChannelResponder.java @@ -10,8 +10,8 @@ import androidx.annotation.NonNull; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; /** - * A {@link Responder} of {@link KeyboardManager} that handles events by sending the raw information - * through the method channel. + * A {@link KeyboardManager.Responder} of {@link KeyboardManager} that handles events by sending the + * raw information through the method channel. * *

      This class corresponds to the RawKeyboard API in the framework. */ diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyboardManager.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyboardManager.java index ccfcbc4ff5..8327324d90 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyboardManager.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/KeyboardManager.java @@ -16,8 +16,8 @@ import java.util.HashSet; * A class to process {@link KeyEvent}s dispatched to a {@link FlutterView}, either from a hardware * keyboard or an IME event. * - *

      A class that sends Android {@link KeyEvent} to the a list of {@link Responder}s, and - * re-dispatches those not handled by the primary responders. + *

      A class that sends Android {@link KeyEvent} to the a list of {@link + * KeyboardManager.Responder}s, and re-dispatches those not handled by the primary responders. * *

      Flutter uses asynchronous event handling to avoid blocking the UI thread, but Android requires * that events are handled synchronously. So, when the Android system sends new @{link KeyEvent} to @@ -30,21 +30,22 @@ import java.util.HashSet; * types of responders (in the listed order): * *

        - *
      • {@link Responder}s: An immutable list of key responders in a {@link KeyboardManager} that - * each implements the {@link Responder} interface. A {@link Responder} is a key responder - * that's capable of handling {@link KeyEvent}s asynchronously. + *
      • {@link KeyboardManager.Responder}s: An immutable list of key responders in a {@link + * KeyboardManager} that each implements the {@link KeyboardManager.Responder} interface. A + * {@link KeyboardManager.Responder} is a key responder that's capable of handling {@link + * KeyEvent}s asynchronously. *

        When a new {@link KeyEvent} is received, {@link KeyboardManager} calls the {@link - * Responder#handleEvent(KeyEvent, OnKeyEventHandledCallback)} method on its {@link - * Responder}s. Each {@link Responder} must call the supplied {@link - * OnKeyEventHandledCallback} exactly once, when it has decided whether to handle the key - * event callback. More than one {@link Responder} is allowed to reply true and handle the - * same {@link KeyEvent}. + * KeyboardManager.Responder#handleEvent(KeyEvent, OnKeyEventHandledCallback)} method on its + * {@link KeyboardManager.Responder}s. Each {@link KeyboardManager.Responder} must call the + * supplied {@link OnKeyEventHandledCallback} exactly once, when it has decided whether to + * handle the key event callback. More than one {@link KeyboardManager.Responder} is allowed + * to reply true and handle the same {@link KeyEvent}. *

        Typically a {@link KeyboardManager} uses a {@link KeyChannelResponder} as its only - * {@link Responder}. - *

      • {@link TextInputPlugin}: if every {@link Responder} has replied false to a {@link - * KeyEvent}, or if the {@link KeyboardManager} has zero {@link Responder}s, the {@link - * KeyEvent} will be sent to the currently focused editable text field in {@link - * TextInputPlugin}, if any. + * {@link KeyboardManager.Responder}. + *
      • {@link TextInputPlugin}: if every {@link KeyboardManager.Responder} has replied false to a + * {@link KeyEvent}, or if the {@link KeyboardManager} has zero {@link + * KeyboardManager.Responder}s, the {@link KeyEvent} will be sent to the currently focused + * editable text field in {@link TextInputPlugin}, if any. *
      • "Redispatch": if there's no currently focused text field in {@link TextInputPlugin}, * or the text field does not handle the {@link KeyEvent} either, the {@link KeyEvent} will be * sent back to the top of the activity's view hierachy, allowing it to be "redispatched", @@ -56,11 +57,12 @@ public class KeyboardManager { private static final String TAG = "KeyboardManager"; /** - * Constructor for {@link KeyboardManager} that takes a list of {@link Responder}s. + * Constructor for {@link KeyboardManager} that takes a list of {@link + * KeyboardManager.Responder}s. * *

        The view is used as the destination to send the synthesized key to. This means that the the - * next thing in the focus chain will get the event when the {@link Responder}s return false from - * onKeyDown/onKeyUp. + * next thing in the focus chain will get the event when the {@link KeyboardManager.Responder}s + * return false from onKeyDown/onKeyUp. * *

        It is possible that that in the middle of the async round trip, the focus chain could * change, and instead of the native widget that was "next" when the event was fired getting the @@ -73,7 +75,8 @@ public class KeyboardManager { * @param textInputPlugin a plugin, which, if set, is given key events before the framework is, * and if it has a valid input connection and is accepting text, then it will handle the event * and the framework will not receive it. - * @param responders the {@link Responder}s new {@link KeyEvent}s will be first dispatched to. + * @param responders the {@link KeyboardManager.Responder}s new {@link KeyEvent}s will be first + * dispatched to. */ public KeyboardManager( View view, @NonNull TextInputPlugin textInputPlugin, Responder[] responders) { @@ -108,7 +111,7 @@ public class KeyboardManager { * * @param keyEvent the new {@link KeyEvent} this {@link Responder} may be interested in. * @param onKeyEventHandledCallback the method to call when this {@link Responder} has decided - * whether to handle the {@link keyEvent}. + * whether to handle the {@link KeyEvent}. */ void handleEvent( @NonNull KeyEvent keyEvent, @NonNull OnKeyEventHandledCallback onKeyEventHandledCallback); 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 dbbe84d497..d52cce3f4f 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 @@ -133,7 +133,7 @@ public class FlutterEngine { * *

        A new {@code FlutterEngine} will not display any UI until a {@link RenderSurface} is * registered. See {@link #getRenderer()} and {@link - * FlutterRenderer#startRenderingToSurface(RenderSurface)}. + * FlutterRenderer#startRenderingToSurface(Surface)}. * *

        A new {@code FlutterEngine} automatically attaches all plugins. See {@link #getPlugins()}. * @@ -144,9 +144,10 @@ public class FlutterEngine { * *

        In order to pass Dart VM initialization arguments (see {@link * io.flutter.embedding.engine.FlutterShellArgs}) when creating the VM, manually set the - * initialization arguments by calling {@link FlutterLoader#startInitialization(Context)} and - * {@link FlutterLoader#ensureInitializationComplete(Context, String[])} before constructing the - * engine. + * initialization arguments by calling {@link + * io.flutter.embedding.engine.loader.FlutterLoader#startInitialization(Context)} and {@link + * io.flutter.embedding.engine.loader.FlutterLoader#ensureInitializationComplete(Context, + * String[])} before constructing the engine. */ public FlutterEngine(@NonNull Context context) { this(context, null); @@ -213,8 +214,8 @@ public class FlutterEngine { } /** - * Same as {@link #FlutterEngine(Context, FlutterLoader, FlutterJNI, String[])} but with no Dart - * VM flags. + * Same as {@link #FlutterEngine(Context, FlutterLoader, FlutterJNI, String[], boolean)} but with + * no Dart VM flags and automatically registers plugins. * *

        {@code flutterJNI} should be a new instance that has never been attached to an engine * before. @@ -370,16 +371,17 @@ public class FlutterEngine { } /** - * Create a second {@link FlutterEngine} based on this current one by sharing as much resources - * together as possible to minimize startup latency and memory cost. + * Create a second {@link io.flutter.embedding.engine.FlutterEngine} based on this current one by + * sharing as much resources together as possible to minimize startup latency and memory cost. * - * @param context is a Context used to create the {@link FlutterEngine}. Could be the same Context - * as the current engine or a different one. Generally, only an application Context is needed - * for the {@link FlutterEngine} and its dependencies. + * @param context is a Context used to create the {@link + * io.flutter.embedding.engine.FlutterEngine}. Could be the same Context as the current engine + * or a different one. Generally, only an application Context is needed for the {@link + * io.flutter.embedding.engine.FlutterEngine} and its dependencies. * @param dartEntrypoint specifies the {@link DartEntrypoint} the new engine should run. It * doesn't need to be the same entrypoint as the current engine but must be built in the same * AOT or snapshot. - * @return a new {@link FlutterEngine}. + * @return a new {@link io.flutter.embedding.engine.FlutterEngine}. */ @NonNull /*package*/ FlutterEngine spawn( diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineCache.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineCache.java index 76fbfdd01c..bdc7579a50 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineCache.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineCache.java @@ -11,14 +11,18 @@ import java.util.HashMap; import java.util.Map; /** - * Static singleton cache that holds {@link FlutterEngine} instances identified by {@code String}s. + * Static singleton cache that holds {@link io.flutter.embedding.engine.FlutterEngine} instances + * identified by {@code String}s. * - *

        The ID of a given {@link FlutterEngine} can be whatever {@code String} is desired. + *

        The ID of a given {@link io.flutter.embedding.engine.FlutterEngine} can be whatever {@code + * String} is desired. * - *

        {@code FlutterEngineCache} is useful for storing pre-warmed {@link FlutterEngine} instances. - * {@link io.flutter.embedding.android.FlutterActivity} and {@link + *

        {@code FlutterEngineCache} is useful for storing pre-warmed {@link + * io.flutter.embedding.engine.FlutterEngine} instances. {@link + * io.flutter.embedding.android.FlutterActivity} and {@link * io.flutter.embedding.android.FlutterFragment} use the {@code FlutterEngineCache} singleton - * internally when instructed to use a cached {@link FlutterEngine} based on a given ID. See {@link + * internally when instructed to use a cached {@link io.flutter.embedding.engine.FlutterEngine} + * based on a given ID. See {@link * io.flutter.embedding.android.FlutterActivity.CachedEngineIntentBuilder} and {@link * io.flutter.embedding.android.FlutterFragment#withCachedEngine(String)} for related APIs. */ @@ -44,16 +48,17 @@ public class FlutterEngineCache { /* package */ FlutterEngineCache() {} /** - * Returns {@code true} if a {@link FlutterEngine} in this cache is associated with the given - * {@code engineId}. + * Returns {@code true} if a {@link io.flutter.embedding.engine.FlutterEngine} in this cache is + * associated with the given {@code engineId}. */ public boolean contains(@NonNull String engineId) { return cachedEngines.containsKey(engineId); } /** - * Returns the {@link FlutterEngine} in this cache that is associated with the given {@code - * engineId}, or {@code null} is no such {@link FlutterEngine} exists. + * Returns the {@link io.flutter.embedding.engine.FlutterEngine} in this cache that is associated + * with the given {@code engineId}, or {@code null} is no such {@link + * io.flutter.embedding.engine.FlutterEngine} exists. */ @Nullable public FlutterEngine get(@NonNull String engineId) { @@ -61,11 +66,12 @@ public class FlutterEngineCache { } /** - * Places the given {@link FlutterEngine} in this cache and associates it with the given {@code - * engineId}. + * Places the given {@link io.flutter.embedding.engine.FlutterEngine} in this cache and associates + * it with the given {@code engineId}. * - *

        If a {@link FlutterEngine} already exists in this cache for the given {@code engineId}, that - * {@link FlutterEngine} is removed from this cache. + *

        If a {@link io.flutter.embedding.engine.FlutterEngine} already exists in this cache for the + * given {@code engineId}, that {@link io.flutter.embedding.engine.FlutterEngine} is removed from + * this cache. */ public void put(@NonNull String engineId, @Nullable FlutterEngine engine) { if (engine != null) { @@ -76,14 +82,17 @@ public class FlutterEngineCache { } /** - * Removes any {@link FlutterEngine} that is currently in the cache that is identified by the - * given {@code engineId}. + * Removes any {@link io.flutter.embedding.engine.FlutterEngine} that is currently in the cache + * that is identified by the given {@code engineId}. */ public void remove(@NonNull String engineId) { put(engineId, null); } - /** Removes all {@link FlutterEngine}'s that are currently in the cache. */ + /** + * Removes all {@link io.flutter.embedding.engine.FlutterEngine}'s that are currently in the + * cache. + */ public void clear() { cachedEngines.clear(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java index d2c95db7e8..9f23b2e732 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java @@ -38,8 +38,8 @@ import java.util.Map; import java.util.Set; /** - * This class is owned by the {@link FlutterEngine} and its role is to managed its connections with - * Android App Components and Flutter plugins. + * This class is owned by the {@link io.flutter.embedding.engine.FlutterEngine} and its role is to + * managed its connections with Android App Components and Flutter plugins. * *

        It enforces the {0|1}:1 relationship between activity and engine, and propagates the app * component connection to the plugins. @@ -700,8 +700,9 @@ import java.util.Set; } /** - * Invoked by the {@link FlutterEngine} that owns this {@code ActivityPluginBinding} when its - * associated {@link Activity} has its {@code onRequestPermissionsResult(...)} method invoked. + * Invoked by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * ActivityPluginBinding} when its associated {@link android.app.Activity} has its {@code + * onRequestPermissionsResult(...)} method invoked. */ boolean onRequestPermissionsResult( int requestCode, @NonNull String[] permissions, @NonNull int[] grantResult) { @@ -728,8 +729,9 @@ import java.util.Set; } /** - * Invoked by the {@link FlutterEngine} that owns this {@code ActivityPluginBinding} when its - * associated {@link Activity} has its {@code onActivityResult(...)} method invoked. + * Invoked by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * ActivityPluginBinding} when its associated {@link android.app.Activity} has its {@code + * onActivityResult(...)} method invoked. */ boolean onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { boolean didConsumeResult = false; @@ -754,8 +756,9 @@ import java.util.Set; } /** - * Invoked by the {@link FlutterEngine} that owns this {@code ActivityPluginBinding} when its - * associated {@link Activity} has its {@code onNewIntent(...)} method invoked. + * Invoked by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * ActivityPluginBinding} when its associated {@link android.app.Activity} has its {@code + * onNewIntent(...)} method invoked. */ void onNewIntent(@Nullable Intent intent) { for (io.flutter.plugin.common.PluginRegistry.NewIntentListener listener : @@ -787,8 +790,9 @@ import java.util.Set; } /** - * Invoked by the {@link FlutterEngine} that owns this {@code ActivityPluginBinding} when its - * associated {@link Activity} has its {@code onUserLeaveHint()} method invoked. + * Invoked by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * ActivityPluginBinding} when its associated {@link android.app.Activity} has its {@code + * onUserLeaveHint()} method invoked. */ void onUserLeaveHint() { for (io.flutter.plugin.common.PluginRegistry.UserLeaveHintListener listener : @@ -798,9 +802,9 @@ import java.util.Set; } /** - * Invoked by the {@link FlutterEngine} that owns this {@code ActivityPluginBinding} when its - * associated {@link Activity} or {@code Fragment} has its {@code onSaveInstanceState(Bundle)} - * method invoked. + * Invoked by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * ActivityPluginBinding} when its associated {@link android.app.Activity} or {@code Fragment} + * has its {@code onSaveInstanceState(Bundle)} method invoked. */ void onSaveInstanceState(@NonNull Bundle bundle) { for (OnSaveInstanceStateListener listener : onSaveInstanceStateListeners) { @@ -809,9 +813,9 @@ import java.util.Set; } /** - * Invoked by the {@link FlutterEngine} that owns this {@code ActivityPluginBinding} when its - * associated {@link Activity} or {@code Fragment} has its {@code onCreate(Bundle)} method - * invoked. + * Invoked by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * ActivityPluginBinding} when its associated {@link android.app.Activity} or {@code Fragment} + * has its {@code onCreate(Bundle)} method invoked. */ void onRestoreInstanceState(@Nullable Bundle bundle) { for (OnSaveInstanceStateListener listener : onSaveInstanceStateListeners) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 18d9d5ea44..8bbf773705 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -23,7 +23,6 @@ import io.flutter.embedding.engine.dart.PlatformMessageHandler; import io.flutter.embedding.engine.deferredcomponents.DeferredComponentManager; import io.flutter.embedding.engine.mutatorsstack.FlutterMutatorsStack; import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener; -import io.flutter.embedding.engine.renderer.RenderSurface; import io.flutter.embedding.engine.renderer.SurfaceTextureWrapper; import io.flutter.plugin.common.StandardMessageCodec; import io.flutter.plugin.localization.LocalizationPlugin; @@ -77,13 +76,10 @@ import java.util.concurrent.CopyOnWriteArraySet; * flutterJNI.detachFromNativeAndReleaseResources(); * }

    * - *

    To provide a visual, interactive surface for Flutter rendering and touch events, register a - * {@link RenderSurface} with {@link #setRenderSurface(RenderSurface)} - * *

    To receive callbacks for certain events that occur on the native side, register listeners: * *

      - *
    1. {@link #addEngineLifecycleListener(EngineLifecycleListener)} + *
    2. {@link #addEngineLifecycleListener(FlutterEngine.EngineLifecycleListener)} *
    3. {@link #addIsDisplayingFlutterUiListener(FlutterUiDisplayListener)} *
    * @@ -722,7 +718,7 @@ public class FlutterJNI { /** * Call this method to inform Flutter that a texture previously registered with {@link - * #registerTexture(long, SurfaceTexture)} has a new frame available. + * #registerTexture(long, SurfaceTextureWrapper)} has a new frame available. * *

    Invoking this method instructs Flutter to update its presentation of the given texture so * that the new frame is displayed. @@ -737,7 +733,8 @@ public class FlutterJNI { private native void nativeMarkTextureFrameAvailable(long nativeShellHolderId, long textureId); /** - * Unregisters a texture that was registered with {@link #registerTexture(long, SurfaceTexture)}. + * Unregisters a texture that was registered with {@link #registerTexture(long, + * SurfaceTextureWrapper)}. */ @UiThread public void unregisterTexture(long textureId) { @@ -803,8 +800,8 @@ public class FlutterJNI { * will be dropped (ignored). Therefore, when using {@code FlutterJNI} to integrate a Flutter * context in an app, a {@link PlatformMessageHandler} must be registered for 2-way Java/Dart * communication to operate correctly. Moreover, the handler must be implemented such that - * fundamental platform messages are handled as expected. See {@link FlutterNativeView} for an - * example implementation. + * fundamental platform messages are handled as expected. See {@link + * io.flutter.view.FlutterNativeView} for an example implementation. */ @UiThread public void setPlatformMessageHandler(@Nullable PlatformMessageHandler platformMessageHandler) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java index e7aabf7c6a..4572f20aba 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java @@ -246,7 +246,7 @@ public class DartExecutor implements BinaryMessenger { * is an appropriate time to free resources, such as going to the background. * *

    This does not notify a Flutter application about memory pressure. For that, use the {@link - * SystemChannel#sendMemoryPressureWarning}. + * io.flutter.embedding.engine.systemchannels.SystemChannel#sendMemoryPressureWarning}. */ public void notifyLowMemoryWarning() { if (flutterJNI.isAttached()) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/loader/ApplicationInfoLoader.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/loader/ApplicationInfoLoader.java index 1d86ac964f..24c5029835 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/loader/ApplicationInfoLoader.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/loader/ApplicationInfoLoader.java @@ -56,7 +56,8 @@ public final class ApplicationInfoLoader { private static String getNetworkPolicy(ApplicationInfo appInfo, Context context) { // We cannot use reflection to look at networkSecurityConfigRes because - // Android throws an error when we try to access fields marked as @hide. + // Android throws an error when we try to access fields marked as This member is not intended + // for public use, and is only visible for testing.. // Instead we rely on metadata. Bundle metadata = appInfo.metaData; if (metadata == null) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorView.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorView.java index 7d89c83ada..00971545dd 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorView.java @@ -18,8 +18,8 @@ import androidx.annotation.VisibleForTesting; import io.flutter.embedding.android.AndroidTouchProcessor; /** - * A view that applies the {@link io.flutter.embedding.engine.mutatorsstack.MutatorsStack} to its - * children. + * A view that applies the {@link io.flutter.embedding.engine.mutatorsstack.FlutterMutatorsStack} to + * its children. */ public class FlutterMutatorView extends FrameLayout { private FlutterMutatorsStack mutatorsStack; diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack.java index c8a7fb181e..f7c8b3ee9d 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack.java @@ -18,14 +18,13 @@ import java.util.List; * The mutator stack containing a list of mutators * *

    The mutators can be applied to a {@link io.flutter.plugin.platform.PlatformView} to perform a - * series mutations. See {@link io.flutter.embedding.engine.mutatorsstack.Mutator} for informations - * on Mutators. + * series mutations. See {@link FlutterMutatorsStack.FlutterMutator} for informations on Mutators. */ @Keep public class FlutterMutatorsStack { /** - * The type of a Mutator See {@link io.flutter.embedding.engine.mutatorsstack.Mutator} for - * informations on Mutators. + * The type of a Mutator See {@link FlutterMutatorsStack.FlutterMutator} for informations on + * Mutators. */ public enum FlutterMutatorType { CLIP_RECT, @@ -40,7 +39,7 @@ public class FlutterMutatorsStack { * *

    A mutator contains information of a single mutation operation that can be applied to a * {@link io.flutter.plugin.platform.PlatformView}. See {@link - * io.flutter.embedding.engine.mutatorsstack.Mutator} for informations on Mutators. + * FlutterMutatorsStack.FlutterMutator} for informations on Mutators. */ public class FlutterMutator { @@ -77,7 +76,7 @@ public class FlutterMutatorsStack { /** * Initialize a clip path mutator. * - * @param rect the path to be clipped. + * @param path the path to be clipped. */ public FlutterMutator(Path path) { this.type = FlutterMutatorType.CLIP_PATH; @@ -144,7 +143,7 @@ public class FlutterMutatorsStack { } /** - * Push a transform {@link io.flutter.embedding.engine.mutatorsstack.Mutator} to the stack. + * Push a transform {@link FlutterMutatorsStack.FlutterMutator} to the stack. * * @param values the transform matrix to be pushed to the stack. The array matches how a {@link * android.graphics.Matrix} is constructed. @@ -157,7 +156,7 @@ public class FlutterMutatorsStack { finalMatrix.preConcat(mutator.getMatrix()); } - /** Push a clipRect {@link io.flutter.embedding.engine.mutatorsstack.Mutator} to the stack. */ + /** Push a clipRect {@link FlutterMutatorsStack.FlutterMutator} to the stack. */ public void pushClipRect(int left, int top, int right, int bottom) { Rect rect = new Rect(left, top, right, bottom); FlutterMutator mutator = new FlutterMutator(rect); @@ -169,7 +168,7 @@ public class FlutterMutatorsStack { } /** - * Push a clipRRect {@link io.flutter.embedding.engine.mutatorsstack.Mutator} to the stack. + * Push a clipRRect {@link FlutterMutatorsStack.FlutterMutator} to the stack. * * @param left left offset of the rrect. * @param top top offset of the rrect. @@ -199,8 +198,8 @@ public class FlutterMutatorsStack { * Get a list of all the clipping operations. All the clipping operations -- whether it is clip * rect, clip rrect, or clip path -- are converted into Paths. The paths are also transformed with * the matrix that up to their stack positions. For example: If the stack looks like (from top to - * bottom): TransA -> ClipA -> TransB -> ClipB, the final paths will look like [TransA*ClipA, - * TransA*TransB*ClipB]. + * bottom): TransA -> ClipA -> TransB -> ClipB, the final paths will look like + * [TransA*ClipA, TransA*TransB*ClipB]. * *

    Clipping this list to the parent canvas of a view results the final clipping path. */ diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/FlutterPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/FlutterPlugin.java index 7c2e4c2ee2..c9ed009a44 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/FlutterPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/FlutterPlugin.java @@ -21,18 +21,21 @@ import io.flutter.view.TextureRegistry; * communicate between platform code and Dart code. * *

    A Flutter plugin has a lifecycle. First, a developer must add a {@code FlutterPlugin} to an - * instance of {@link FlutterEngine}. To do this, obtain a {@link PluginRegistry} with {@link - * FlutterEngine#getPlugins()}, then call {@link PluginRegistry#add(FlutterPlugin)}, passing the - * instance of the Flutter plugin. During the call to {@link PluginRegistry#add(FlutterPlugin)}, the - * {@link FlutterEngine} will invoke {@link #onAttachedToEngine(FlutterPluginBinding)} on the given - * {@code FlutterPlugin}. If the {@code FlutterPlugin} is removed from the {@link FlutterEngine} via - * {@link PluginRegistry#remove(Class)}, or if the {@link FlutterEngine} is destroyed, the {@link - * FlutterEngine} will invoke {@link FlutterPlugin#onDetachedFromEngine(FlutterPluginBinding)} on - * the given {@code FlutterPlugin}. + * instance of {@link io.flutter.embedding.engine.FlutterEngine}. To do this, obtain a {@link + * PluginRegistry} with {@link FlutterEngine#getPlugins()}, then call {@link + * PluginRegistry#add(FlutterPlugin)}, passing the instance of the Flutter plugin. During the call + * to {@link PluginRegistry#add(FlutterPlugin)}, the {@link + * io.flutter.embedding.engine.FlutterEngine} will invoke {@link + * #onAttachedToEngine(FlutterPluginBinding)} on the given {@code FlutterPlugin}. If the {@code + * FlutterPlugin} is removed from the {@link io.flutter.embedding.engine.FlutterEngine} via {@link + * PluginRegistry#remove(Class)}, or if the {@link io.flutter.embedding.engine.FlutterEngine} is + * destroyed, the {@link FlutterEngine} will invoke {@link + * FlutterPlugin#onDetachedFromEngine(FlutterPluginBinding)} on the given {@code FlutterPlugin}. * - *

    Once a {@code FlutterPlugin} is attached to a {@link FlutterEngine}, the plugin's code is - * permitted to access and invoke methods on resources within the {@link FlutterPluginBinding} that - * the {@link FlutterEngine} gave to the {@code FlutterPlugin} in {@link + *

    Once a {@code FlutterPlugin} is attached to a {@link + * io.flutter.embedding.engine.FlutterEngine}, the plugin's code is permitted to access and invoke + * methods on resources within the {@link FlutterPluginBinding} that the {@link + * io.flutter.embedding.engine.FlutterEngine} gave to the {@code FlutterPlugin} in {@link * #onAttachedToEngine(FlutterPluginBinding)}. This includes, for example, the application {@link * Context} for the running app. * @@ -63,7 +66,8 @@ import io.flutter.view.TextureRegistry; public interface FlutterPlugin { /** - * This {@code FlutterPlugin} has been associated with a {@link FlutterEngine} instance. + * This {@code FlutterPlugin} has been associated with a {@link + * io.flutter.embedding.engine.FlutterEngine} instance. * *

    Relevant resources that this {@code FlutterPlugin} may need are provided via the {@code * binding}. The {@code binding} may be cached and referenced until {@link @@ -72,7 +76,8 @@ public interface FlutterPlugin { void onAttachedToEngine(@NonNull FlutterPluginBinding binding); /** - * This {@code FlutterPlugin} has been removed from a {@link FlutterEngine} instance. + * This {@code FlutterPlugin} has been removed from a {@link + * io.flutter.embedding.engine.FlutterEngine} instance. * *

    The {@code binding} passed to this method is the same instance that was passed in {@link * #onAttachedToEngine(FlutterPluginBinding)}. It is provided again in this method as a @@ -84,13 +89,15 @@ public interface FlutterPlugin { void onDetachedFromEngine(@NonNull FlutterPluginBinding binding); /** - * Resources made available to all plugins registered with a given {@link FlutterEngine}. + * Resources made available to all plugins registered with a given {@link + * io.flutter.embedding.engine.FlutterEngine}. * *

    The provided {@link BinaryMessenger} can be used to communicate with Dart code running in * the Flutter context associated with this plugin binding. * *

    Plugins that need to respond to {@code Lifecycle} events should implement the additional - * {@link ActivityAware} and/or {@link ServiceAware} interfaces, where a {@link Lifecycle} + * {@link io.flutter.embedding.engine.plugins.activity.ActivityAware} and/or {@link + * io.flutter.embedding.engine.plugins.service.ServiceAware} interfaces, where a {@link Lifecycle} * reference can be obtained. */ class FlutterPluginBinding { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityAware.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityAware.java index ac6bc2a007..10fb098316 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityAware.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityAware.java @@ -7,46 +7,53 @@ package io.flutter.embedding.engine.plugins.activity; import androidx.annotation.NonNull; /** - * {@link FlutterPlugin} that is interested in {@link Activity} lifecycle events related to a {@link - * FlutterEngine} running within the given {@link Activity}. + * {@link io.flutter.embedding.engine.plugins.FlutterPlugin} that is interested in {@link + * android.app.Activity} lifecycle events related to a {@link + * io.flutter.embedding.engine.FlutterEngine} running within the given {@link android.app.Activity}. */ public interface ActivityAware { /** - * This {@code ActivityAware} {@link FlutterPlugin} is now associated with an {@link Activity}. + * This {@code ActivityAware} {@link io.flutter.embedding.engine.plugins.FlutterPlugin} is now + * associated with an {@link android.app.Activity}. * *

    This method can be invoked in 1 of 2 situations: * *

    * - * The given {@link ActivityPluginBinding} contains {@link Activity}-related references that an - * {@code ActivityAware} {@link FlutterPlugin} may require, such as a reference to the actual - * {@link Activity} in question. The {@link ActivityPluginBinding} may be referenced until either - * {@link #onDetachedFromActivityForConfigChanges()} or {@link #onDetachedFromActivity()} is - * invoked. At the conclusion of either of those methods, the binding is no longer valid. Clear - * any references to the binding or its resources, and do not invoke any further methods on the - * binding or its resources. + * The given {@link ActivityPluginBinding} contains {@link android.app.Activity}-related + * references that an {@code ActivityAware} {@link + * io.flutter.embedding.engine.plugins.FlutterPlugin} may require, such as a reference to the + * actual {@link android.app.Activity} in question. The {@link ActivityPluginBinding} may be + * referenced until either {@link #onDetachedFromActivityForConfigChanges()} or {@link + * #onDetachedFromActivity()} is invoked. At the conclusion of either of those methods, the + * binding is no longer valid. Clear any references to the binding or its resources, and do not + * invoke any further methods on the binding or its resources. */ void onAttachedToActivity(@NonNull ActivityPluginBinding binding); /** - * The {@link Activity} that was attached and made available in {@link + * The {@link android.app.Activity} that was attached and made available in {@link * #onAttachedToActivity(ActivityPluginBinding)} has been detached from this {@code - * ActivityAware}'s {@link FlutterEngine} for the purpose of processing a configuration change. + * ActivityAware}'s {@link io.flutter.embedding.engine.FlutterEngine} for the purpose of + * processing a configuration change. * - *

    By the end of this method, the {@link Activity} that was made available in {@link - * #onAttachedToActivity(ActivityPluginBinding)} is no longer valid. Any references to the - * associated {@link Activity} or {@link ActivityPluginBinding} should be cleared. + *

    By the end of this method, the {@link android.app.Activity} that was made available in + * {@link #onAttachedToActivity(ActivityPluginBinding)} is no longer valid. Any references to the + * associated {@link android.app.Activity} or {@link ActivityPluginBinding} should be cleared. * *

    This method should be quickly followed by {@link * #onReattachedToActivityForConfigChanges(ActivityPluginBinding)}, which signifies that a new - * {@link Activity} has been created with the new configuration options. That method provides a - * new {@link ActivityPluginBinding}, which references the newly created and associated {@link - * Activity}. + * {@link android.app.Activity} has been created with the new configuration options. That method + * provides a new {@link ActivityPluginBinding}, which references the newly created and associated + * {@link android.app.Activity}. * *

    Any {@code Lifecycle} listeners that were registered in {@link * #onAttachedToActivity(ActivityPluginBinding)} should be deregistered here to avoid a possible @@ -55,33 +62,36 @@ public interface ActivityAware { void onDetachedFromActivityForConfigChanges(); /** - * This plugin and its {@link FlutterEngine} have been re-attached to an {@link Activity} after - * the {@link Activity} was recreated to handle configuration changes. + * This plugin and its {@link io.flutter.embedding.engine.FlutterEngine} have been re-attached to + * an {@link android.app.Activity} after the {@link android.app.Activity} was recreated to handle + * configuration changes. * - *

    {@code binding} includes a reference to the new instance of the {@link Activity}. {@code - * binding} and its references may be cached and used from now until either {@link - * #onDetachedFromActivityForConfigChanges()} or {@link #onDetachedFromActivity()} is invoked. At - * the conclusion of either of those methods, the binding is no longer valid. Clear any references - * to the binding or its resources, and do not invoke any further methods on the binding or its - * resources. + *

    {@code binding} includes a reference to the new instance of the {@link + * android.app.Activity}. {@code binding} and its references may be cached and used from now until + * either {@link #onDetachedFromActivityForConfigChanges()} or {@link #onDetachedFromActivity()} + * is invoked. At the conclusion of either of those methods, the binding is no longer valid. Clear + * any references to the binding or its resources, and do not invoke any further methods on the + * binding or its resources. */ void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding); /** - * This plugin has been detached from an {@link Activity}. + * This plugin has been detached from an {@link android.app.Activity}. * *

    Detachment can occur for a number of reasons. * *

    * - * By the end of this method, the {@link Activity} that was made available in {@link + * By the end of this method, the {@link android.app.Activity} that was made available in {@link * #onAttachedToActivity(ActivityPluginBinding)} is no longer valid. Any references to the - * associated {@link Activity} or {@link ActivityPluginBinding} should be cleared. + * associated {@link android.app.Activity} or {@link ActivityPluginBinding} should be cleared. * *

    Any {@code Lifecycle} listeners that were registered in {@link * #onAttachedToActivity(ActivityPluginBinding)} or {@link diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java index 60228ea3bb..7e1e8812f9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityControlSurface.java @@ -13,47 +13,54 @@ import androidx.lifecycle.Lifecycle; import io.flutter.embedding.android.ExclusiveAppComponent; /** - * Control surface through which an {@link Activity} attaches to a {@link FlutterEngine}. + * Control surface through which an {@link android.app.Activity} attaches to a {@link + * io.flutter.embedding.engine.FlutterEngine}. * - *

    An {@link Activity} that contains a {@link FlutterView} and associated {@link FlutterEngine} - * should coordinate itself with the {@link FlutterEngine}'s {@code ActivityControlSurface}. + *

    An {@link android.app.Activity} that contains a {@link + * io.flutter.embedding.android.FlutterView} and associated {@link + * io.flutter.embedding.engine.FlutterEngine} should coordinate itself with the {@link + * io.flutter.embedding.engine.FlutterEngine}'s {@code ActivityControlSurface}. * *

      - *
    1. Once an {@link Activity} is created, and its associated {@link FlutterEngine} is executing - * Dart code, the {@link Activity} should invoke {@link #attachToActivity( - * ExclusiveAppComponent, Lifecycle)}. At this point the {@link FlutterEngine} is considered - * "attached" to the {@link Activity} and all {@link ActivityAware} plugins are given access - * to the {@link Activity}. - *
    2. Just before an attached {@link Activity} is destroyed for configuration change purposes, - * that {@link Activity} should invoke {@link #detachFromActivityForConfigChanges()}, giving - * each {@link ActivityAware} plugin an opportunity to clean up its references before the - * {@link Activity is destroyed}. - *
    3. When an {@link Activity} is recreated after configuration changes, that {@link Activity} - * should invoke {@link #reattachToActivityAfterConfigChange(Activity)} so that all {@link - * ActivityAware} plugins can re-establish references to the {@link Activity}. - *
    4. When an {@link Activity} is destroyed for non-configuration-change purposes, or when the - * {@link Activity} is no longer interested in displaying a {@link FlutterEngine}'s content, - * the {@link Activity} should invoke {@link #detachFromActivity()}. - *
    5. When a {@link Activity} is being attached while an existing {@link ExclusiveAppComponent} - * is already attached, the existing {@link ExclusiveAppComponent} is given a chance to detach - * first via {@link ExclusiveAppComponent#detachFromFlutterEngine()} before the new activity - * attaches. + *
    6. Once an {@link android.app.Activity} is created, and its associated {@link + * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link + * android.app.Activity} should invoke {@link #attachToActivity( ExclusiveAppComponent, + * Lifecycle)}. At this point the {@link io.flutter.embedding.engine.FlutterEngine} is + * considered "attached" to the {@link android.app.Activity} and all {@link ActivityAware} + * plugins are given access to the {@link android.app.Activity}. + *
    7. Just before an attached {@link android.app.Activity} is destroyed for configuration change + * purposes, that {@link android.app.Activity} should invoke {@link + * #detachFromActivityForConfigChanges()}, giving each {@link ActivityAware} plugin an + * opportunity to clean up its references before the {@link android.app.Activity is + * destroyed}. + *
    8. When an {@link android.app.Activity} is destroyed for non-configuration-change purposes, or + * when the {@link android.app.Activity} is no longer interested in displaying a {@link + * io.flutter.embedding.engine.FlutterEngine}'s content, the {@link android.app.Activity} + * should invoke {@link #detachFromActivity()}. + *
    9. When a {@link android.app.Activity} is being attached while an existing {@link + * ExclusiveAppComponent} is already attached, the existing {@link ExclusiveAppComponent} is + * given a chance to detach first via {@link ExclusiveAppComponent#detachFromFlutterEngine()} + * before the new activity attaches. *
    * - * The attached {@link Activity} should also forward all {@link Activity} calls that this {@code - * ActivityControlSurface} supports, e.g., {@link #onRequestPermissionsResult(int, String[], - * int[])}. These forwarded calls are made available to all {@link ActivityAware} plugins that are - * added to the attached {@link FlutterEngine}. + * The attached {@link android.app.Activity} should also forward all {@link android.app.Activity} + * calls that this {@code ActivityControlSurface} supports, e.g., {@link + * #onRequestPermissionsResult(int, String[], int[])}. These forwarded calls are made available to + * all {@link ActivityAware} plugins that are added to the attached {@link + * io.flutter.embedding.engine.FlutterEngine}. */ public interface ActivityControlSurface { /** - * Call this method from the {@link Activity} that is displaying the visual content of the {@link - * FlutterEngine} that is associated with this {@code ActivityControlSurface}. + * Call this method from the {@link android.app.Activity} that is displaying the visual content of + * the {@link io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code + * ActivityControlSurface}. * - *

    Once an {@link Activity} is created, and its associated {@link FlutterEngine} is executing - * Dart code, the {@link Activity} should invoke this method. At that point the {@link - * FlutterEngine} is considered "attached" to the {@link Activity} and all {@link ActivityAware} - * plugins are given access to the {@link Activity}. + *

    Once an {@link android.app.Activity} is created, and its associated {@link + * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link + * android.app.Activity} should invoke this method. At that point the {@link + * io.flutter.embedding.engine.FlutterEngine} is considered "attached" to the {@link + * android.app.Activity} and all {@link ActivityAware} plugins are given access to the {@link + * android.app.Activity}. * * @deprecated Prefer using the {@link #attachToActivity(ExclusiveAppComponent, Lifecycle)} API to * avoid situations where multiple activities are driving the FlutterEngine simultaneously. @@ -64,13 +71,15 @@ public interface ActivityControlSurface { /** * Call this method from the {@link ExclusiveAppComponent} that is displaying the visual content - * of the {@link FlutterEngine} that is associated with this {@code ActivityControlSurface}. + * of the {@link io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code + * ActivityControlSurface}. * - *

    Once an {@link ExclusiveAppComponent} is created, and its associated {@link FlutterEngine} - * is executing Dart code, the {@link ExclusiveAppComponent} should invoke this method. At that - * point the {@link FlutterEngine} is considered "attached" to the {@link ExclusiveAppComponent} - * and all {@link ActivityAware} plugins are given access to the {@link ExclusiveAppComponent}'s - * {@link Activity}. + *

    Once an {@link ExclusiveAppComponent} is created, and its associated {@link + * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link + * ExclusiveAppComponent} should invoke this method. At that point the {@link + * io.flutter.embedding.engine.FlutterEngine} is considered "attached" to the {@link + * ExclusiveAppComponent} and all {@link ActivityAware} plugins are given access to the {@link + * ExclusiveAppComponent}'s {@link android.app.Activity}. * *

    This method differs from {@link #attachToActivity(Activity, Lifecycle)} in that it calls * back the existing {@link ExclusiveAppComponent} to give it a chance to cleanly detach before a @@ -80,29 +89,29 @@ public interface ActivityControlSurface { @NonNull ExclusiveAppComponent exclusiveActivity, @NonNull Lifecycle lifecycle); /** - * Call this method from the {@link Activity} that is attached to this {@code - * ActivityControlSurfaces}'s {@link FlutterEngine} when the {@link Activity} is about to be - * destroyed due to configuration changes. + * Call this method from the {@link android.app.Activity} that is attached to this {@code + * ActivityControlSurfaces}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link + * android.app.Activity} is about to be destroyed due to configuration changes. * *

    This method gives each {@link ActivityAware} plugin an opportunity to clean up its - * references before the {@link Activity is destroyed}. + * references before the {@link android.app.Activity is destroyed}. */ void detachFromActivityForConfigChanges(); /** - * Call this method from the {@link Activity} that is attached to this {@code - * ActivityControlSurfaces}'s {@link FlutterEngine} when the {@link Activity} is about to be - * destroyed for non-configuration-change reasons. + * Call this method from the {@link android.app.Activity} that is attached to this {@code + * ActivityControlSurfaces}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link + * android.app.Activity} is about to be destroyed for non-configuration-change reasons. * *

    This method gives each {@link ActivityAware} plugin an opportunity to clean up its - * references before the {@link Activity is destroyed}. + * references before the {@link android.app.Activity is destroyed}. */ void detachFromActivity(); /** - * Call this method from the {@link Activity} that is attached to this {@code - * ActivityControlSurface}'s {@link FlutterEngine} and the associated method in the {@link - * Activity} is invoked. + * Call this method from the {@link android.app.Activity} that is attached to this {@code + * ActivityControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} and the associated + * method in the {@link Activity} is invoked. * *

    Returns true if one or more plugins utilized this permission result. */ @@ -110,39 +119,40 @@ public interface ActivityControlSurface { int requestCode, @NonNull String[] permissions, @NonNull int[] grantResult); /** - * Call this method from the {@link Activity} that is attached to this {@code - * ActivityControlSurface}'s {@link FlutterEngine} and the associated method in the {@link - * Activity} is invoked. + * Call this method from the {@link android.app.Activity} that is attached to this {@code + * ActivityControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} and the associated + * method in the {@link Activity} is invoked. * - *

    Returns true if one or more plugins utilized this {@link Activity} result. + *

    Returns true if one or more plugins utilized this {@link android.app.Activity} result. */ boolean onActivityResult(int requestCode, int resultCode, @Nullable Intent data); /** - * Call this method from the {@link Activity} that is attached to this {@code - * ActivityControlSurface}'s {@link FlutterEngine} and the associated method in the {@link - * Activity} is invoked. + * Call this method from the {@link android.app.Activity} that is attached to this {@code + * ActivityControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} and the associated + * method in the {@link Activity} is invoked. */ void onNewIntent(@NonNull Intent intent); /** - * Call this method from the {@link Activity} that is attached to this {@code - * ActivityControlSurface}'s {@link FlutterEngine} and the associated method in the {@link - * Activity} is invoked. + * Call this method from the {@link android.app.Activity} that is attached to this {@code + * ActivityControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} and the associated + * method in the {@link Activity} is invoked. */ void onUserLeaveHint(); /** - * Call this method from the {@link Activity} or {@code Fragment} that is attached to this {@code - * ActivityControlSurface}'s {@link FlutterEngine} when the associated method is invoked in the - * {@link Activity} or {@code Fragment}. + * Call this method from the {@link android.app.Activity} or {@code Fragment} that is attached to + * this {@code ActivityControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} when + * the associated method is invoked in the {@link android.app.Activity} or {@code Fragment}. */ void onSaveInstanceState(@NonNull Bundle bundle); /** - * Call this method from the {@link Activity} or {@code Fragment} that is attached to this {@code - * ActivityControlSurface}'s {@link FlutterEngine} when {@link Activity#onCreate(Bundle)} or - * {@code Fragment#onCreate(Bundle)} is invoked in the {@link Activity} or {@code Fragment}. + * Call this method from the {@link android.app.Activity} or {@code Fragment} that is attached to + * this {@code ActivityControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} when + * {@link android.app.Activity#onCreate(Bundle)} or {@code Fragment#onCreate(Bundle)} is invoked + * in the {@link android.app.Activity} or {@code Fragment}. */ void onRestoreInstanceState(@Nullable Bundle bundle); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityPluginBinding.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityPluginBinding.java index 055610adc8..fc2deca721 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityPluginBinding.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/activity/ActivityPluginBinding.java @@ -11,8 +11,8 @@ import androidx.annotation.Nullable; import io.flutter.plugin.common.PluginRegistry; /** - * Binding that gives {@link ActivityAware} plugins access to an associated {@link Activity} and the - * {@link Activity}'s lifecycle methods. + * Binding that gives {@link ActivityAware} plugins access to an associated {@link + * android.app.Activity} and the {@link android.app.Activity}'s lifecycle methods. * *

    To obtain an instance of an {@code ActivityPluginBinding} in a Flutter plugin, implement the * {@link ActivityAware} interface. A binding is provided in {@link @@ -22,8 +22,8 @@ import io.flutter.plugin.common.PluginRegistry; public interface ActivityPluginBinding { /** - * Returns the {@link Activity} that is currently attached to the {@link FlutterEngine} that owns - * this {@code ActivityPluginBinding}. + * Returns the {@link android.app.Activity} that is currently attached to the {@link + * io.flutter.embedding.engine.FlutterEngine} that owns this {@code ActivityPluginBinding}. */ @NonNull Activity getActivity(); @@ -42,7 +42,7 @@ public interface ActivityPluginBinding { Object getLifecycle(); /** - * Adds a listener that is invoked whenever the associated {@link Activity}'s {@code + * Adds a listener that is invoked whenever the associated {@link android.app.Activity}'s {@code * onRequestPermissionsResult(...)} method is invoked. */ void addRequestPermissionsResultListener( @@ -56,7 +56,7 @@ public interface ActivityPluginBinding { @NonNull PluginRegistry.RequestPermissionsResultListener listener); /** - * Adds a listener that is invoked whenever the associated {@link Activity}'s {@code + * Adds a listener that is invoked whenever the associated {@link android.app.Activity}'s {@code * onActivityResult(...)} method is invoked. */ void addActivityResultListener(@NonNull PluginRegistry.ActivityResultListener listener); @@ -68,7 +68,7 @@ public interface ActivityPluginBinding { void removeActivityResultListener(@NonNull PluginRegistry.ActivityResultListener listener); /** - * Adds a listener that is invoked whenever the associated {@link Activity}'s {@code + * Adds a listener that is invoked whenever the associated {@link android.app.Activity}'s {@code * onNewIntent(...)} method is invoked. */ void addOnNewIntentListener(@NonNull PluginRegistry.NewIntentListener listener); @@ -80,7 +80,7 @@ public interface ActivityPluginBinding { void removeOnNewIntentListener(@NonNull PluginRegistry.NewIntentListener listener); /** - * Adds a listener that is invoked whenever the associated {@link Activity}'s {@code + * Adds a listener that is invoked whenever the associated {@link android.app.Activity}'s {@code * onUserLeaveHint()} method is invoked. */ void addOnUserLeaveHintListener(@NonNull PluginRegistry.UserLeaveHintListener listener); @@ -111,8 +111,9 @@ public interface ActivityPluginBinding { void onSaveInstanceState(@NonNull Bundle bundle); /** - * Invoked when the associated {@code Activity} executes {@link Activity#onCreate(Bundle)} or - * associated {@code Fragment} executes {@code Fragment#onCreate(Bundle)}. + * Invoked when the associated {@code Activity} executes {@link + * android.app.Activity#onCreate(Bundle)} or associated {@code Fragment} executes {@code + * Fragment#onCreate(Bundle)}. */ void onRestoreInstanceState(@Nullable Bundle bundle); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverAware.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverAware.java index dbe3d681d0..1b7f8b9213 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverAware.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverAware.java @@ -7,18 +7,21 @@ package io.flutter.embedding.engine.plugins.broadcastreceiver; import androidx.annotation.NonNull; /** - * A {@link FlutterPlugin} that wants to know when it is running within a {@link BroadcastReceiver}. + * A {@link io.flutter.embedding.engine.plugins.FlutterPlugin} that wants to know when it is running + * within a {@link android.content.BroadcastReceiver}. */ public interface BroadcastReceiverAware { /** - * Callback triggered when a {@code BroadcastReceiverAware} {@link FlutterPlugin} is associated - * with a {@link BroadcastReceiver}. + * Callback triggered when a {@code BroadcastReceiverAware} {@link + * io.flutter.embedding.engine.plugins.FlutterPlugin} is associated with a {@link + * android.content.BroadcastReceiver}. */ void onAttachedToBroadcastReceiver(@NonNull BroadcastReceiverPluginBinding binding); /** - * Callback triggered when a {@code BroadcastReceiverAware} {@link FlutterPlugin} is detached from - * a {@link BroadcastReceiver}. + * Callback triggered when a {@code BroadcastReceiverAware} {@link + * io.flutter.embedding.engine.plugins.FlutterPlugin} is detached from a {@link + * android.content.BroadcastReceiver}. */ void onDetachedFromBroadcastReceiver(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverControlSurface.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverControlSurface.java index d529af512f..d3fc947b54 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverControlSurface.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverControlSurface.java @@ -9,28 +9,33 @@ import androidx.annotation.NonNull; import androidx.lifecycle.Lifecycle; /** - * Control surface through which a {@link BroadcastReceiver} attaches to a {@link FlutterEngine}. + * Control surface through which a {@link BroadcastReceiver} attaches to a {@link + * io.flutter.embedding.engine.FlutterEngine}. * - *

    A {@link BroadcastReceiver} that contains a {@link FlutterEngine} should coordinate itself - * with the {@link FlutterEngine}'s {@code BroadcastReceiverControlSurface}. + *

    A {@link BroadcastReceiver} that contains a {@link io.flutter.embedding.engine.FlutterEngine} + * should coordinate itself with the {@link io.flutter.embedding.engine.FlutterEngine}'s {@code + * BroadcastReceiverControlSurface}. */ public interface BroadcastReceiverControlSurface { /** - * Call this method from the {@link BroadcastReceiver} that is running the {@link FlutterEngine} - * that is associated with this {@code BroadcastReceiverControlSurface}. + * Call this method from the {@link BroadcastReceiver} that is running the {@link + * io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code + * BroadcastReceiverControlSurface}. * - *

    Once a {@link BroadcastReceiver} is created, and its associated {@link FlutterEngine} is - * executing Dart code, the {@link BroadcastReceiver} should invoke this method. At that point the - * {@link FlutterEngine} is considered "attached" to the {@link BroadcastReceiver} and all {@link - * BroadcastReceiverAware} plugins are given access to the {@link BroadcastReceiver}. + *

    Once a {@link BroadcastReceiver} is created, and its associated {@link + * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link + * BroadcastReceiver} should invoke this method. At that point the {@link + * io.flutter.embedding.engine.FlutterEngine} is considered "attached" to the {@link + * BroadcastReceiver} and all {@link BroadcastReceiverAware} plugins are given access to the + * {@link BroadcastReceiver}. */ void attachToBroadcastReceiver( @NonNull BroadcastReceiver broadcastReceiver, @NonNull Lifecycle lifecycle); /** * Call this method from the {@link BroadcastReceiver} that is attached to this {@code - * BroadcastReceiverControlSurfaces}'s {@link FlutterEngine} when the {@link BroadcastReceiver} is - * about to be destroyed. + * BroadcastReceiverControlSurfaces}'s {@link io.flutter.embedding.engine.FlutterEngine} when the + * {@link BroadcastReceiver} is about to be destroyed. * *

    This method gives each {@link BroadcastReceiverAware} plugin an opportunity to clean up its * references before the {@link BroadcastReceiver is destroyed}. diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverPluginBinding.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverPluginBinding.java index 73ba8486c4..568bf35ec8 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverPluginBinding.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/broadcastreceiver/BroadcastReceiverPluginBinding.java @@ -14,8 +14,9 @@ import androidx.annotation.NonNull; public interface BroadcastReceiverPluginBinding { /** - * Returns the {@link BroadcastReceiver} that is currently attached to the {@link FlutterEngine} - * that owns this {@code BroadcastReceiverAwarePluginBinding}. + * Returns the {@link BroadcastReceiver} that is currently attached to the {@link + * io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * BroadcastReceiverAwarePluginBinding}. */ @NonNull BroadcastReceiver getBroadcastReceiver(); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderAware.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderAware.java index 5f0308154f..344fe57a42 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderAware.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderAware.java @@ -7,18 +7,21 @@ package io.flutter.embedding.engine.plugins.contentprovider; import androidx.annotation.NonNull; /** - * A {@link FlutterPlugin} that wants to know when it is running within a {@link ContentProvider}. + * A {@link io.flutter.embedding.engine.plugins.FlutterPlugin} that wants to know when it is running + * within a {@link android.content.ContentProvider}. */ public interface ContentProviderAware { /** - * Callback triggered when a {@code ContentProviderAware} {@link FlutterPlugin} is associated with - * a {@link ContentProvider}. + * Callback triggered when a {@code ContentProviderAware} {@link + * io.flutter.embedding.engine.plugins.FlutterPlugin} is associated with a {@link + * android.content.ContentProvider}. */ void onAttachedToContentProvider(@NonNull ContentProviderPluginBinding binding); /** - * Callback triggered when a {@code ContentProviderAware} {@link FlutterPlugin} is detached from a - * {@link ContentProvider}. + * Callback triggered when a {@code ContentProviderAware} {@link + * io.flutter.embedding.engine.plugins.FlutterPlugin} is detached from a {@link + * android.content.ContentProvider}. */ void onDetachedFromContentProvider(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderControlSurface.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderControlSurface.java index a53496939e..c8f9571bed 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderControlSurface.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderControlSurface.java @@ -9,28 +9,32 @@ import androidx.annotation.NonNull; import androidx.lifecycle.Lifecycle; /** - * Control surface through which a {@link ContentProvider} attaches to a {@link FlutterEngine}. + * Control surface through which a {@link ContentProvider} attaches to a {@link + * io.flutter.embedding.engine.FlutterEngine}. * - *

    A {@link ContentProvider} that contains a {@link FlutterEngine} should coordinate itself with - * the {@link FlutterEngine}'s {@code ContentProviderControlSurface}. + *

    A {@link ContentProvider} that contains a {@link io.flutter.embedding.engine.FlutterEngine} + * should coordinate itself with the {@link io.flutter.embedding.engine.FlutterEngine}'s {@code + * ContentProviderControlSurface}. */ public interface ContentProviderControlSurface { /** - * Call this method from the {@link ContentProvider} that is running the {@link FlutterEngine} - * that is associated with this {@code ContentProviderControlSurface}. + * Call this method from the {@link ContentProvider} that is running the {@link + * io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code + * ContentProviderControlSurface}. * - *

    Once a {@link ContentProvider} is created, and its associated {@link FlutterEngine} is - * executing Dart code, the {@link ContentProvider} should invoke this method. At that point the - * {@link FlutterEngine} is considered "attached" to the {@link ContentProvider} and all {@link - * ContentProviderAware} plugins are given access to the {@link ContentProvider}. + *

    Once a {@link ContentProvider} is created, and its associated {@link + * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link ContentProvider} + * should invoke this method. At that point the {@link io.flutter.embedding.engine.FlutterEngine} + * is considered "attached" to the {@link ContentProvider} and all {@link ContentProviderAware} + * plugins are given access to the {@link ContentProvider}. */ void attachToContentProvider( @NonNull ContentProvider contentProvider, @NonNull Lifecycle lifecycle); /** * Call this method from the {@link ContentProvider} that is attached to this {@code - * ContentProviderControlSurfaces}'s {@link FlutterEngine} when the {@link ContentProvider} is - * about to be destroyed. + * ContentProviderControlSurfaces}'s {@link io.flutter.embedding.engine.FlutterEngine} when the + * {@link ContentProvider} is about to be destroyed. * *

    This method gives each {@link ContentProviderAware} plugin an opportunity to clean up its * references before the {@link ContentProvider is destroyed}. diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderPluginBinding.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderPluginBinding.java index d55d7e45a2..0bb22822d9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderPluginBinding.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/contentprovider/ContentProviderPluginBinding.java @@ -14,8 +14,9 @@ import androidx.annotation.NonNull; public interface ContentProviderPluginBinding { /** - * Returns the {@link ContentProvider} that is currently attached to the {@link FlutterEngine} - * that owns this {@code ContentProviderAwarePluginBinding}. + * Returns the {@link ContentProvider} that is currently attached to the {@link + * io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * ContentProviderAwarePluginBinding}. */ @NonNull ContentProvider getContentProvider(); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceAware.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceAware.java index f0d78456b0..f983565c46 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceAware.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceAware.java @@ -6,17 +6,22 @@ package io.flutter.embedding.engine.plugins.service; import androidx.annotation.NonNull; -/** A {@link FlutterPlugin} that wants to know when it is running within a {@link Service}. */ +/** + * A {@link io.flutter.embedding.engine.plugins.FlutterPlugin} that wants to know when it is running + * within a {@link android.app.Service}. + */ public interface ServiceAware { /** - * Callback triggered when a {@code ServiceAware} {@link FlutterPlugin} is associated with a - * {@link Service}. + * Callback triggered when a {@code ServiceAware} {@link + * io.flutter.embedding.engine.plugins.FlutterPlugin} is associated with a {@link + * android.app.Service}. */ void onAttachedToService(@NonNull ServicePluginBinding binding); /** - * Callback triggered when a {@code ServiceAware} {@link FlutterPlugin} is detached from a {@link - * Service}. + * Callback triggered when a {@code ServiceAware} {@link + * io.flutter.embedding.engine.plugins.FlutterPlugin} is detached from a {@link + * android.app.Service}. * *

    Any {@code Lifecycle} listeners that were registered in {@link * #onAttachedToService(ServicePluginBinding)} should be deregistered here to avoid a possible @@ -26,14 +31,14 @@ public interface ServiceAware { interface OnModeChangeListener { /** - * Callback triggered when the associated {@link Service} goes from background execution to - * foreground execution. + * Callback triggered when the associated {@link android.app.Service} goes from background + * execution to foreground execution. */ void onMoveToForeground(); /** - * Callback triggered when the associated {@link Service} goes from foreground execution to - * background execution. + * Callback triggered when the associated {@link android.app.Service} goes from foreground + * execution to background execution. */ void onMoveToBackground(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceControlSurface.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceControlSurface.java index e5450fe4c1..554f1cbcac 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceControlSurface.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceControlSurface.java @@ -10,20 +10,24 @@ import androidx.annotation.Nullable; import androidx.lifecycle.Lifecycle; /** - * Control surface through which a {@link Service} attaches to a {@link FlutterEngine}. + * Control surface through which a {@link Service} attaches to a {@link + * io.flutter.embedding.engine.FlutterEngine}. * - *

    A {@link Service} that contains a {@link FlutterEngine} should coordinate itself with the - * {@link FlutterEngine}'s {@code ServiceControlSurface}. + *

    A {@link Service} that contains a {@link io.flutter.embedding.engine.FlutterEngine} should + * coordinate itself with the {@link io.flutter.embedding.engine.FlutterEngine}'s {@code + * ServiceControlSurface}. */ public interface ServiceControlSurface { /** - * Call this method from the {@link Service} that is running the {@link FlutterEngine} that is - * associated with this {@code ServiceControlSurface}. + * Call this method from the {@link Service} that is running the {@link + * io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code + * ServiceControlSurface}. * - *

    Once a {@link Service} is created, and its associated {@link FlutterEngine} is executing - * Dart code, the {@link Service} should invoke this method. At that point the {@link - * FlutterEngine} is considered "attached" to the {@link Service} and all {@link ServiceAware} - * plugins are given access to the {@link Service}. + *

    Once a {@link Service} is created, and its associated {@link + * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link Service} should + * invoke this method. At that point the {@link io.flutter.embedding.engine.FlutterEngine} is + * considered "attached" to the {@link Service} and all {@link ServiceAware} plugins are given + * access to the {@link Service}. * *

    {@code isForeground} should be true if the given {@link Service} is running in the * foreground, false otherwise. @@ -33,8 +37,8 @@ public interface ServiceControlSurface { /** * Call this method from the {@link Service} that is attached to this {@code - * ServiceControlSurfaces}'s {@link FlutterEngine} when the {@link Service} is about to be - * destroyed. + * ServiceControlSurfaces}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link + * Service} is about to be destroyed. * *

    This method gives each {@link ServiceAware} plugin an opportunity to clean up its references * before the {@link Service is destroyed}. @@ -43,15 +47,15 @@ public interface ServiceControlSurface { /** * Call this method from the {@link Service} that is attached to this {@code - * ServiceControlSurface}'s {@link FlutterEngine} when the {@link Service} goes from background to - * foreground. + * ServiceControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link + * Service} goes from background to foreground. */ void onMoveToForeground(); /** * Call this method from the {@link Service} that is attached to this {@code - * ServiceControlSurface}'s {@link FlutterEngine} when the {@link Service} goes from foreground to - * background. + * ServiceControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link + * Service} goes from foreground to background. */ void onMoveToBackground(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServicePluginBinding.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServicePluginBinding.java index 62a51e321a..1fc867c87a 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServicePluginBinding.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServicePluginBinding.java @@ -12,8 +12,8 @@ import androidx.annotation.Nullable; public interface ServicePluginBinding { /** - * Returns the {@link Service} that is currently attached to the {@link FlutterEngine} that owns - * this {@code ServicePluginBinding}. + * Returns the {@link Service} that is currently attached to the {@link + * io.flutter.embedding.engine.FlutterEngine} that owns this {@code ServicePluginBinding}. */ @NonNull Service getService(); @@ -39,7 +39,7 @@ public interface ServicePluginBinding { /** * Removes the given {@code listener}, which was previously added with {@link - * #addOnModeChangeListener(OnModeChangeListener)}. + * #addOnModeChangeListener(ServiceAware.OnModeChangeListener)}. */ void removeOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/util/GeneratedPluginRegister.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/util/GeneratedPluginRegister.java index bcc1b969d9..18316811d9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/util/GeneratedPluginRegister.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/plugins/util/GeneratedPluginRegister.java @@ -29,14 +29,16 @@ public class GeneratedPluginRegister { *

    In a normal full-Flutter application, the {@link * io.flutter.embedding.android.FlutterActivity} will automatically call the {@code * GeneratedPluginRegistrant} to register all plugins. In a typical full-Flutter application, the - * {@link io.flutter.embedding.android.FlutterActivity} creates a {@link FlutterEngine}. When a - * {@link FlutterEngine} is explicitly created, it automatically registers plugins during its - * construction. + * {@link io.flutter.embedding.android.FlutterActivity} creates a {@link + * io.flutter.embedding.engine.FlutterEngine}. When a {@link + * io.flutter.embedding.engine.FlutterEngine} is explicitly created, it automatically registers + * plugins during its construction. * - *

    Since the {@link FlutterEngine} belongs to the Flutter engine and the - * GeneratedPluginRegistrant class belongs to the app project, the {@link FlutterEngine} cannot - * place a compile-time dependency on GeneratedPluginRegistrant to invoke it. Instead, this class - * uses reflection to attempt to locate the generated file and then uses it at runtime. + *

    Since the {@link io.flutter.embedding.engine.FlutterEngine} belongs to the Flutter engine + * and the GeneratedPluginRegistrant class belongs to the app project, the {@link + * io.flutter.embedding.engine.FlutterEngine} cannot place a compile-time dependency on + * GeneratedPluginRegistrant to invoke it. Instead, this class uses reflection to attempt to + * locate the generated file and then uses it at runtime. * *

    This method fizzles if the GeneratedPluginRegistrant cannot be found or invoked. This * situation should never occur, but if any eventuality comes up that prevents an app from using @@ -45,12 +47,14 @@ public class GeneratedPluginRegister { *

    To disable this automatic plugin registration behavior: * *

    * *

    Disabling the automatic plugin registration or deferring it by calling this method diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java index 19ebe0abe1..3d3f78f73f 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java @@ -301,8 +301,8 @@ public class PlatformViewsChannel { /** * The layout direction of the new platform view. * - *

    See {@link android.view.View.LAYOUT_DIRECTION_LTR} and {@link - * android.view.View.LAYOUT_DIRECTION_RTL} + *

    See {@link android.view.View#LAYOUT_DIRECTION_LTR} and {@link + * android.view.View#LAYOUT_DIRECTION_RTL} */ public final int direction; diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java index ce86f02b11..c42a9d2d3d 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java @@ -166,7 +166,8 @@ public class TextInputChannel { * Instructs Flutter to reattach the last active text input client, if any. * *

    This is necessary when the view hierarchy has been detached and reattached to a {@link - * FlutterEngine}, as the engine may have kept alive a text editing client on the Dart side. + * io.flutter.embedding.engine.FlutterEngine}, as the engine may have kept alive a text editing + * client on the Dart side. */ public void requestExistingInputState() { channel.invokeMethod("TextInputClient.requestExistingInputState", null); @@ -347,7 +348,8 @@ public class TextInputChannel { void requestAutofill(); /** - * Requests that the {@link AutofillManager} cancel or commit the current autofill context. + * Requests that the {@link android.view.autofill.AutofillManager} cancel or commit the current + * autofill context. * *

    The method calls {@link android.view.autofill.AutofillManager#commit()} when {@code * shouldSave} is true, and calls {@link android.view.autofill.AutofillManager#cancel()} diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java index a13edac534..d00311cf52 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java @@ -22,7 +22,7 @@ public final class BinaryCodec implements MessageCodec { /** * A BinaryCodec that returns direct ByteBuffers from `decodeMessage` for better performance. * - * @see BinaryCodec.BinaryCodec(boolean) + * @see BinaryCodec#BinaryCodec(boolean) */ public static final BinaryCodec INSTANCE_DIRECT = new BinaryCodec(true); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/EventChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/EventChannel.java index 05dae1c01b..984b251b29 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/EventChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/EventChannel.java @@ -91,10 +91,10 @@ public final class EventChannel { * Handler of stream setup and teardown requests. * *

    Implementations must be prepared to accept sequences of alternating calls to {@link - * #onListen(Object, EventSink)} and {@link #onCancel(Object)}. Implementations should ideally - * consume no resources when the last such call is not {@code onListen}. In typical situations, - * this means that the implementation should register itself with platform-specific event sources - * {@code onListen} and deregister again {@code onCancel}. + * #onListen(Object, EventChannel.EventSink)} and {@link #onCancel(Object)}. Implementations + * should ideally consume no resources when the last such call is not {@code onListen}. In typical + * situations, this means that the implementation should register itself with platform-specific + * event sources {@code onListen} and deregister again {@code onCancel}. */ public interface StreamHandler { /** diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java index 5585da0c86..750520ea88 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java @@ -23,8 +23,8 @@ import io.flutter.view.TextureRegistry; *

    In v1 Android applications, an auto-generated and auto-updated plugin registrant class * (GeneratedPluginRegistrant) makes use of a {@link PluginRegistry} to register contributions from * each plugin mentioned in the application's pubspec file. The generated registrant class is, again - * by default, called from the application's main {@link Activity}, which defaults to an instance of - * {@link io.flutter.app.FlutterActivity}, itself a {@link PluginRegistry}. + * by default, called from the application's main {@link android.app.Activity}, which defaults to an + * instance of {@link io.flutter.app.FlutterActivity}, itself a {@link PluginRegistry}. */ public interface PluginRegistry { /** @@ -32,6 +32,7 @@ public interface PluginRegistry { * * @param pluginKey a unique String identifying the plugin; typically the fully qualified name of * the plugin's main class. + * @return A {@link Registrar} for receiving the registrations pertianing to the specified plugin. * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ @Deprecated @@ -55,6 +56,7 @@ public interface PluginRegistry { * situations where external control or interaction is needed. Clients are expected to know the * value's type. * + * @param The type of the value. * @param pluginKey a unique String identifying the plugin; typically the fully qualified name of * the plugin's main class. * @return the published value, possibly null. @@ -73,7 +75,7 @@ public interface PluginRegistry { @Deprecated interface Registrar { /** - * Returns the {@link Activity} that forms the plugin's operating context. + * Returns the {@link android.app.Activity} that forms the plugin's operating context. * *

    Plugin authors should not assume the type returned by this method is any specific subclass * of {@code Activity} (such as {@link io.flutter.app.FlutterActivity} or {@link @@ -230,7 +232,7 @@ public interface PluginRegistry { * *

    This registrar is for Flutter's v1 embedding. To listen for permission results in the v2 * embedding, use {@link - * ActivityPluginBinding#addRequestPermissionsResultListener(RequestPermissionsResultListener)}. + * ActivityPluginBinding#addRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener)}. * *

    For instructions on migrating a plugin from Flutter's v1 Android embedding to v2, visit * http://flutter.dev/go/android-plugin-migration @@ -246,7 +248,7 @@ public interface PluginRegistry { * *

    This registrar is for Flutter's v1 embedding. To listen for {@code Activity} results in * the v2 embedding, use {@link - * ActivityPluginBinding#addActivityResultListener(ActivityResultListener)}. + * ActivityPluginBinding#addActivityResultListener(PluginRegistry.ActivityResultListener)}. * *

    For instructions on migrating a plugin from Flutter's v1 Android embedding to v2, visit * http://flutter.dev/go/android-plugin-migration @@ -261,7 +263,8 @@ public interface PluginRegistry { * Activity#onNewIntent(Intent)}. * *

    This registrar is for Flutter's v1 embedding. To listen for new {@code Intent}s in the v2 - * embedding, use {@link ActivityPluginBinding#addOnNewIntentListener(NewIntentListener)}. + * embedding, use {@link + * ActivityPluginBinding#addOnNewIntentListener(PluginRegistry.NewIntentListener)}. * *

    For instructions on migrating a plugin from Flutter's v1 Android embedding to v2, visit * http://flutter.dev/go/android-plugin-migration @@ -277,7 +280,7 @@ public interface PluginRegistry { * *

    This registrar is for Flutter's v1 embedding. To listen for leave hints in the v2 * embedding, use {@link - * ActivityPluginBinding#addOnUserLeaveHintListener(UserLeaveHintListener)}. + * ActivityPluginBinding#addOnUserLeaveHintListener(PluginRegistry.UserLeaveHintListener)}. * *

    For instructions on migrating a plugin from Flutter's v1 Android embedding to v2, visit * http://flutter.dev/go/android-plugin-migration @@ -321,27 +324,35 @@ public interface PluginRegistry { boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults); } - /** Delegate interface for handling activity results on behalf of the main {@link Activity}. */ + /** + * Delegate interface for handling activity results on behalf of the main {@link + * android.app.Activity}. + */ interface ActivityResultListener { /** @return true if the result has been handled. */ boolean onActivityResult(int requestCode, int resultCode, Intent data); } - /** Delegate interface for handling new intents on behalf of the main {@link Activity}. */ + /** + * Delegate interface for handling new intents on behalf of the main {@link android.app.Activity}. + */ interface NewIntentListener { /** @return true if the new intent has been handled. */ boolean onNewIntent(Intent intent); } - /** Delegate interface for handling user leave hints on behalf of the main {@link Activity}. */ + /** + * Delegate interface for handling user leave hints on behalf of the main {@link + * android.app.Activity}. + */ interface UserLeaveHintListener { void onUserLeaveHint(); } /** - * Delegate interface for handling an {@link Activity}'s onDestroy method being called. A plugin - * that implements this interface can adopt the FlutterNativeView by retaining a reference and - * returning true. + * Delegate interface for handling an {@link android.app.Activity}'s onDestroy method being + * called. A plugin that implements this interface can adopt the {@link FlutterNativeView} by + * retaining a reference and returning true. * * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java index b00ffd1898..0daa4959d6 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java @@ -118,7 +118,7 @@ public class MouseCursorPlugin { * *

    If typeis not recognized, returns the default pointer icon. * - *

    This is typically implemented by calling {@link android.view.PointerIcon.getSystemIcon} + *

    This is typically implemented by calling {@link android.view.PointerIcon#getSystemIcon} * with the context associated with this view. */ public PointerIcon getSystemPointerIcon(int type); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index 2140ce39f7..03cc41ed7e 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -244,7 +244,8 @@ public class PlatformPlugin { * PlatformChannel.SystemChromeStyle}. * *

    Updating the system UI Overlays is accomplished by altering the decor view of the {@link - * Window} associated with the {@link Activity} that was provided to this {@code PlatformPlugin}. + * Window} associated with the {@link android.app.Activity} that was provided to this {@code + * PlatformPlugin}. */ public void updateSystemUiOverlays() { activity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformView.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformView.java index fc22e8440f..0de5c2651b 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformView.java @@ -14,11 +14,12 @@ public interface PlatformView { View getView(); /** - * Called by the {@link FlutterEngine} that owns this {@code PlatformView} when the Android {@link - * View} responsible for rendering a Flutter UI is associated with the {@link FlutterEngine}. + * Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * PlatformView} when the Android {@link View} responsible for rendering a Flutter UI is + * associated with the {@link io.flutter.embedding.engine.FlutterEngine}. * - *

    This means that our associated {@link FlutterEngine} can now render a UI and interact with - * the user. + *

    This means that our associated {@link io.flutter.embedding.engine.FlutterEngine} can now + * render a UI and interact with the user. * *

    Some platform views may have unusual dependencies on the {@link View} that renders Flutter * UIs, such as unique keyboard interactions. That {@link View} is provided here for those @@ -31,12 +32,12 @@ public interface PlatformView { default void onFlutterViewAttached(@NonNull View flutterView) {} /** - * Called by the {@link FlutterEngine} that owns this {@code PlatformView} when the Android {@link - * View} responsible for rendering a Flutter UI is detached and disassociated from the {@link - * FlutterEngine}. + * Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code + * PlatformView} when the Android {@link View} responsible for rendering a Flutter UI is detached + * and disassociated from the {@link io.flutter.embedding.engine.FlutterEngine}. * - *

    This means that our associated {@link FlutterEngine} no longer has a rendering surface, or a - * user interaction surface of any kind. + *

    This means that our associated {@link io.flutter.embedding.engine.FlutterEngine} no longer + * has a rendering surface, or a user interaction surface of any kind. * *

    This platform view must release any references related to the Android {@link View} that was * provided in {@link #onFlutterViewAttached(View)}. @@ -60,7 +61,7 @@ public interface PlatformView { /** * Callback fired when the platform's input connection is locked, or should be used. See also - * {@link TextInputPlugin#lockPlatformViewInputConnection}. + * {@link io.flutter.plugin.editing.TextInputPlugin#lockPlatformViewInputConnection}. * *

    This hook only exists for rare cases where the plugin relies on the state of the input * connection. This probably doesn't need to be implemented. @@ -71,7 +72,7 @@ public interface PlatformView { /** * Callback fired when the platform input connection has been unlocked. See also {@link - * TextInputPlugin#lockPlatformViewInputConnection}. + * io.flutter.plugin.editing.TextInputPlugin#lockPlatformViewInputConnection}. * *

    This hook only exists for rare cases where the plugin relies on the state of the input * connection. This probably doesn't need to be implemented. diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java index 4b16c0a33f..503e9c8d66 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java @@ -15,11 +15,7 @@ public interface PlatformViewsAccessibilityDelegate { */ View getPlatformViewById(Integer id); - /** - * Returns true if the platform view uses virtual displays. - * - * @hide - */ + /** Returns true if the platform view uses virtual displays. */ boolean usesVirtualDisplay(Integer id); /** diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index b60a3b66a5..ca5247cc84 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -713,8 +713,8 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega /** * Initializes a platform view and adds it to the view hierarchy. * - * @param viewId The view ID. - * @hide + * @param viewId The view ID. This member is not intended for public use, and is only visible for + * testing. */ @VisibleForTesting void initializePlatformViewIfNeeded(int viewId) { @@ -766,8 +766,8 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega * @param height The height of the platform view. * @param viewWidth The original width of the platform view before applying the mutator stack. * @param viewHeight The original height of the platform view before applying the mutator stack. - * @param mutatorsStack The mutator stack. - * @hide + * @param mutatorsStack The mutator stack. This member is not intended for public use, and is only + * visible for testing. */ public void onDisplayPlatformView( int viewId, @@ -803,8 +803,8 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega * @param x The left position relative to {@code FlutterView}. * @param y The top position relative to {@code FlutterView}. * @param width The width of the surface. - * @param height The height of the surface. - * @hide + * @param height The height of the surface. This member is not intended for public use, and is + * only visible for testing. */ public void onDisplayOverlaySurface(int id, int x, int y, int width, int height) { if (overlayLayerViews.get(id) == null) { @@ -834,7 +834,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega /** * Called by {@code FlutterJNI} when the Flutter frame was submitted. * - * @hide + *

    This member is not intended for public use, and is only visible for testing. */ public void onEndFrame() { final FlutterView view = (FlutterView) flutterView; @@ -908,8 +908,8 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega * Creates and tracks the overlay surface. * * @param imageView The surface that displays the overlay. - * @return Wrapper object that provides the layer id and the surface. - * @hide + * @return Wrapper object that provides the layer id and the surface. This member is not intended + * for public use, and is only visible for testing. */ @VisibleForTesting @TargetApi(19) @@ -924,7 +924,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega * *

    This method is invoked by {@code FlutterJNI} only. * - * @hide + *

    This member is not intended for public use, and is only visible for testing. */ @TargetApi(19) public FlutterOverlaySurface createOverlaySurface() { @@ -947,7 +947,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega * *

    This method is used only internally by {@code FlutterJNI}. * - * @hide + *

    This member is not intended for public use, and is only visible for testing. */ public void destroyOverlaySurfaces() { for (int i = 0; i < overlayLayerViews.size(); i++) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java index bbba096bf6..4392986574 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -56,7 +56,7 @@ import java.util.regex.Pattern; * View#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)}. The {@link * #rootAccessibilityView} is expected to notify the {@code AccessibilityBridge} of relevant * interactions: {@link #onAccessibilityHoverEvent(MotionEvent)}, {@link #reset()}, {@link - * #updateSemantics(ByteBuffer, String[])}, and {@link + * #updateSemantics(ByteBuffer, String[], ByteBuffer[])}, and {@link * #updateCustomAccessibilityActions(ByteBuffer, String[])} *

  • An {@link AccessibilityChannel} that is connected to the running Flutter app. *
  • Android's {@link AccessibilityManager} to query and listen for accessibility settings. diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java index 3988f84c9c..c5e6bb7a13 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java @@ -91,6 +91,8 @@ public class FlutterView extends SurfaceView public interface Provider { /** * Returns a reference to the Flutter view maintained by this object. This may be {@code null}. + * + * @return a reference to the Flutter view maintained by this object. */ FlutterView getFlutterView(); } diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java index b88b38dbe8..8dbe0ba8df 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java @@ -747,12 +747,13 @@ public class FlutterActivityAndFragmentDelegateTest { } /** - * Creates a mock {@link FlutterEngine}. + * Creates a mock {@link io.flutter.embedding.engine.FlutterEngine}. * - *

    The heuristic for deciding what to mock in the given {@link FlutterEngine} is that we should - * mock the minimum number of necessary methods and associated objects. Maintaining developers - * should add more mock behavior as required for tests, but should avoid mocking things that are - * not required for the correct execution of tests. + *

    The heuristic for deciding what to mock in the given {@link + * io.flutter.embedding.engine.FlutterEngine} is that we should mock the minimum number of + * necessary methods and associated objects. Maintaining developers should add more mock behavior + * as required for tests, but should avoid mocking things that are not required for the correct + * execution of tests. */ @NonNull private FlutterEngine mockFlutterEngine() { diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java index ce0a89e5c3..6abd080c1b 100644 --- a/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java @@ -109,7 +109,8 @@ public class TestActivity extends TestableFlutterActivity { } /** - * This method verifies that {@link FlutterLoader#ensureInitializationCompleteAsync(Context, + * This method verifies that {@link + * io.flutter.embedding.engine.loader.FlutterLoader#ensureInitializationCompleteAsync(Context, * String[], Handler, Runnable)} invokes its callback when called after initialization. */ private void testFlutterLoaderCallbackWhenInitializedTwice() { diff --git a/engine/src/flutter/tools/gen_javadoc.py b/engine/src/flutter/tools/gen_javadoc.py index 797fb8f988..2a8752889d 100755 --- a/engine/src/flutter/tools/gen_javadoc.py +++ b/engine/src/flutter/tools/gen_javadoc.py @@ -17,6 +17,7 @@ def main(): parser.add_argument('--android-source-root', type=str, default=ANDROID_SRC_ROOT) parser.add_argument('--build-config-path', type=str) parser.add_argument('--third-party', type=str, default='third_party') + parser.add_argument('--quiet', default=False, action='store_true') args = parser.parse_args() if not os.path.exists(args.android_source_root): @@ -30,6 +31,7 @@ def main(): classpath = [ args.android_source_root, os.path.join(args.third_party, 'android_embedding_dependencies', 'lib', '*'), + os.path.join(args.third_party, 'android_tools/sdk//platforms/android-30/android.jar'), ] if args.build_config_path: classpath.append(args.build_config_path) @@ -63,9 +65,19 @@ def main(): '-d', args.out_dir, '-link', 'https://developer.android.com/reference/', ] + packages - print(' '.join(command)) - return subprocess.call(command) + if not args.quiet: + print(' '.join(command)) + + try: + output = subprocess.check_output(command, stderr=subprocess.STDOUT) + if not args.quiet: + print(output) + except subprocess.CalledProcessError as e: + print(e.output) + return e.returncode + + return 0 if __name__ == '__main__':