Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | Package Functions | List of all members
io.flutter.view.FlutterView Class Reference
Inheritance diagram for io.flutter.view.FlutterView:
io.flutter.plugin.common.BinaryMessenger io.flutter.view.TextureRegistry io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate io.flutter.embedding.android.KeyboardManager.ViewDelegate

Classes

interface  FirstFrameListener
 
interface  Provider
 
class  SurfaceTextureRegistryEntry
 
class  ViewportMetrics
 

Public Member Functions

 FlutterView (Context context)
 
 FlutterView (Context context, AttributeSet attrs)
 
 FlutterView (Context context, AttributeSet attrs, FlutterNativeView nativeView)
 
DartExecutor getDartExecutor ()
 
boolean dispatchKeyEvent (KeyEvent event)
 
FlutterNativeView getFlutterNativeView ()
 
FlutterPluginRegistry getPluginRegistry ()
 
String getLookupKeyForAsset (String asset)
 
String getLookupKeyForAsset (String asset, String packageName)
 
void addActivityLifecycleListener (ActivityLifecycleListener listener)
 
void onStart ()
 
void onPause ()
 
void onPostResume ()
 
void onStop ()
 
void onMemoryPressure ()
 
boolean hasRenderedFirstFrame ()
 
void addFirstFrameListener (FirstFrameListener listener)
 
void removeFirstFrameListener (FirstFrameListener listener)
 
void enableBufferingIncomingMessages ()
 
void disableBufferingIncomingMessages ()
 
void disableTransparentBackground ()
 
void setInitialRoute (String route)
 
void pushRoute (String route)
 
void popRoute ()
 
void startBackGesture (@NonNull BackEvent backEvent)
 
void updateBackGestureProgress (@NonNull BackEvent backEvent)
 
void commitBackGesture ()
 
void cancelBackGesture ()
 
FlutterNativeView detach ()
 
void destroy ()
 
InputConnection onCreateInputConnection (EditorInfo outAttrs)
 
boolean checkInputConnectionProxy (View view)
 
void onProvideAutofillVirtualStructure (ViewStructure structure, int flags)
 
void autofill (SparseArray< AutofillValue > values)
 
boolean onTouchEvent (MotionEvent event)
 
boolean onHoverEvent (MotionEvent event)
 
boolean onGenericMotionEvent (MotionEvent event)
 
final WindowInsets onApplyWindowInsets (WindowInsets insets)
 
void runFromBundle (FlutterRunArguments args)
 
Bitmap getBitmap ()
 
void onFirstFrame ()
 
AccessibilityNodeProvider getAccessibilityNodeProvider ()
 
PointerIcon getSystemPointerIcon (int type)
 
BinaryMessenger getBinaryMessenger ()
 
boolean onTextInputKeyEvent (@NonNull KeyEvent keyEvent)
 
void redispatch (@NonNull KeyEvent keyEvent)
 
TaskQueue makeBackgroundTaskQueue (TaskQueueOptions options)
 
void send (String channel, ByteBuffer message)
 
void send (String channel, ByteBuffer message, BinaryReply callback)
 
void setMessageHandler (@NonNull String channel, @NonNull BinaryMessageHandler handler)
 
void setMessageHandler ( @NonNull String channel, @NonNull BinaryMessageHandler handler, @NonNull TaskQueue taskQueue)
 
TextureRegistry.SurfaceTextureEntry createSurfaceTexture ()
 
ImageTextureEntry createImageTexture ()
 
SurfaceProducer createSurfaceProducer ()
 
TextureRegistry.SurfaceTextureEntry registerSurfaceTexture ( @NonNull SurfaceTexture surfaceTexture)
 
- Public Member Functions inherited from io.flutter.plugin.common.BinaryMessenger
default TaskQueue makeBackgroundTaskQueue ()
 
default TaskQueue makeBackgroundTaskQueue (TaskQueueOptions options)
 
void send (@NonNull String channel, @Nullable ByteBuffer message)
 
void send (@NonNull String channel, @Nullable ByteBuffer message, @Nullable BinaryReply callback)
 
void setMessageHandler (@NonNull String channel, @Nullable BinaryMessageHandler handler)
 
default void setMessageHandler ( @NonNull String channel, @Nullable BinaryMessageHandler handler, @Nullable TaskQueue taskQueue)
 
default void enableBufferingIncomingMessages ()
 
default void disableBufferingIncomingMessages ()
 
- Public Member Functions inherited from io.flutter.view.TextureRegistry
SurfaceProducer createSurfaceProducer ()
 
SurfaceTextureEntry createSurfaceTexture ()
 
SurfaceTextureEntry registerSurfaceTexture (@NonNull SurfaceTexture surfaceTexture)
 
ImageTextureEntry createImageTexture ()
 
default void onTrimMemory (int level)
 
- Public Member Functions inherited from io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate
PointerIcon getSystemPointerIcon (int type)
 
void setPointerIcon (@NonNull PointerIcon icon)
 
BinaryMessenger getBinaryMessenger ()
 
boolean onTextInputKeyEvent (@NonNull KeyEvent keyEvent)
 
void redispatch (@NonNull KeyEvent keyEvent)
 

Protected Member Functions

void onConfigurationChanged (Configuration newConfig)
 
void onSizeChanged (int width, int height, int oldWidth, int oldHeight)
 
void onAttachedToWindow ()
 
void onDetachedFromWindow ()
 

Package Functions

float getDevicePixelRatio ()
 
void assertAttached ()
 
void resetAccessibilityTree ()
 

Detailed Description

Deprecated Android view containing a Flutter app.

Deprecated:
io.flutter.embedding.android.FlutterView is the new API that now replaces this class. See https://flutter.dev/go/android-project-migration for more migration details.

Definition at line 82 of file FlutterView.java.

Constructor & Destructor Documentation

◆ FlutterView() [1/3]

io.flutter.view.FlutterView.FlutterView ( Context  context)
inline

Definition at line 160 of file FlutterView.java.

160 {
161 this(context, null);
162 }

◆ FlutterView() [2/3]

io.flutter.view.FlutterView.FlutterView ( Context  context,
AttributeSet  attrs 
)
inline

Definition at line 164 of file FlutterView.java.

164 {
165 this(context, attrs, null);
166 }

◆ FlutterView() [3/3]

io.flutter.view.FlutterView.FlutterView ( Context  context,
AttributeSet  attrs,
FlutterNativeView  nativeView 
)
inline

Definition at line 168 of file FlutterView.java.

168 {
169 super(context, attrs);
170
171 Activity activity = ViewUtils.getActivity(getContext());
172 if (activity == null) {
173 throw new IllegalArgumentException("Bad context");
174 }
175
176 if (nativeView == null) {
177 mNativeView = new FlutterNativeView(activity.getApplicationContext());
178 } else {
179 mNativeView = nativeView;
180 }
181
182 dartExecutor = mNativeView.getDartExecutor();
183 flutterRenderer = new FlutterRenderer(mNativeView.getFlutterJNI());
184 mIsSoftwareRenderingEnabled = mNativeView.getFlutterJNI().getIsSoftwareRenderingEnabled();
185 mMetrics = new ViewportMetrics();
186 mMetrics.devicePixelRatio = context.getResources().getDisplayMetrics().density;
187 mMetrics.physicalTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
188 setFocusable(true);
189 setFocusableInTouchMode(true);
190
191 mNativeView.attachViewAndActivity(this, activity);
192
193 mSurfaceCallback =
194 new SurfaceHolder.Callback() {
195 @Override
196 public void surfaceCreated(SurfaceHolder holder) {
198 mNativeView.getFlutterJNI().onSurfaceCreated(holder.getSurface());
199 }
200
201 @Override
202 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
205 }
206
207 @Override
208 public void surfaceDestroyed(SurfaceHolder holder) {
210 mNativeView.getFlutterJNI().onSurfaceDestroyed();
211 }
212 };
213 getHolder().addCallback(mSurfaceCallback);
214
215 mActivityLifecycleListeners = new ArrayList<>();
216 mFirstFrameListeners = new ArrayList<>();
217
218 // Create all platform channels
219 navigationChannel = new NavigationChannel(dartExecutor);
220 backGestureChannel = new BackGestureChannel(dartExecutor);
221 lifecycleChannel = new LifecycleChannel(dartExecutor);
222 localizationChannel = new LocalizationChannel(dartExecutor);
223 platformChannel = new PlatformChannel(dartExecutor);
224 systemChannel = new SystemChannel(dartExecutor);
225 settingsChannel = new SettingsChannel(dartExecutor);
226
227 // Create and set up plugins
228 PlatformPlugin platformPlugin = new PlatformPlugin(activity, platformChannel);
230 new ActivityLifecycleListener() {
231 @Override
232 public void onPostResume() {
233 platformPlugin.updateSystemUiOverlays();
234 }
235 });
236 mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
237 PlatformViewsController platformViewsController =
239 mTextInputPlugin =
240 new TextInputPlugin(this, new TextInputChannel(dartExecutor), platformViewsController);
241 mKeyboardManager = new KeyboardManager(this);
242
243 if (Build.VERSION.SDK_INT >= API_LEVELS.API_24) {
244 mMouseCursorPlugin = new MouseCursorPlugin(this, new MouseCursorChannel(dartExecutor));
245 } else {
246 mMouseCursorPlugin = null;
247 }
248 mLocalizationPlugin = new LocalizationPlugin(context, localizationChannel);
249 androidTouchProcessor =
250 new AndroidTouchProcessor(flutterRenderer, /*trackMotionEvents=*/ false);
251 platformViewsController.attachToFlutterRenderer(flutterRenderer);
252 mNativeView
255 .attachTextInputPlugin(mTextInputPlugin);
256 mNativeView.getFlutterJNI().setLocalizationPlugin(mLocalizationPlugin);
257
258 // Send initial platform information to Dart
259 mLocalizationPlugin.sendLocalesToFlutter(getResources().getConfiguration());
260 sendUserPlatformSettingsToDart();
261 }
PlatformViewsController getPlatformViewsController()
void onSurfaceCreated(@NonNull Surface surface)
void setLocalizationPlugin(@Nullable LocalizationPlugin localizationPlugin)
void onSurfaceChanged(int width, int height)
void sendLocalesToFlutter(@NonNull Configuration config)
void attachTextInputPlugin(@NonNull TextInputPlugin textInputPlugin)
FlutterPluginRegistry getPluginRegistry()
void attachViewAndActivity(FlutterView flutterView, Activity activity)
void addActivityLifecycleListener(ActivityLifecycleListener listener)
uint32_t uint32_t * format
def Build(configs, env, options)
Definition: build.py:232
int32_t height
int32_t width

Member Function Documentation

◆ addActivityLifecycleListener()

void io.flutter.view.FlutterView.addActivityLifecycleListener ( ActivityLifecycleListener  listener)
inline

Definition at line 301 of file FlutterView.java.

301 {
302 mActivityLifecycleListeners.add(listener);
303 }

◆ addFirstFrameListener()

void io.flutter.view.FlutterView.addFirstFrameListener ( FirstFrameListener  listener)
inline

Provide a listener that will be called once when the FlutterView renders its first frame to the underlaying SurfaceView.

Definition at line 341 of file FlutterView.java.

341 {
342 mFirstFrameListeners.add(listener);
343 }

◆ assertAttached()

void io.flutter.view.FlutterView.assertAttached ( )
inlinepackage

Definition at line 694 of file FlutterView.java.

694 {
695 if (!isAttached()) throw new AssertionError("Platform view is not attached");
696 }

◆ autofill()

void io.flutter.view.FlutterView.autofill ( SparseArray< AutofillValue >  values)
inline

Definition at line 469 of file FlutterView.java.

469 {
470 mTextInputPlugin.autofill(values);
471 }
void autofill(@NonNull SparseArray< AutofillValue > values)

◆ cancelBackGesture()

void io.flutter.view.FlutterView.cancelBackGesture ( )
inline

Definition at line 396 of file FlutterView.java.

◆ checkInputConnectionProxy()

boolean io.flutter.view.FlutterView.checkInputConnectionProxy ( View  view)
inline

Definition at line 455 of file FlutterView.java.

455 {
456 return mNativeView
460 }

◆ commitBackGesture()

void io.flutter.view.FlutterView.commitBackGesture ( )
inline

Definition at line 390 of file FlutterView.java.

◆ createImageTexture()

ImageTextureEntry io.flutter.view.FlutterView.createImageTexture ( )
inline

Creates and registers a texture managed by the Flutter engine.

Returns
a ImageTextureEntry.

Implements io.flutter.view.TextureRegistry.

Definition at line 901 of file FlutterView.java.

901 {
902 throw new UnsupportedOperationException("Image textures are not supported in this mode.");
903 }

◆ createSurfaceProducer()

SurfaceProducer io.flutter.view.FlutterView.createSurfaceProducer ( )
inline

Creates and registers a SurfaceProducer texture managed by the Flutter engine.

Returns
A SurfaceProducer.

Implements io.flutter.view.TextureRegistry.

Definition at line 906 of file FlutterView.java.

906 {
907 throw new UnsupportedOperationException(
908 "SurfaceProducer textures are not supported in this mode.");
909 }

◆ createSurfaceTexture()

TextureRegistry.SurfaceTextureEntry io.flutter.view.FlutterView.createSurfaceTexture ( )
inline

Creates and registers a SurfaceTexture managed by the Flutter engine.

Returns
A SurfaceTextureEntry.

Implements io.flutter.view.TextureRegistry.

Definition at line 894 of file FlutterView.java.

894 {
895 final SurfaceTexture surfaceTexture = new SurfaceTexture(0);
896 return registerSurfaceTexture(surfaceTexture);
897 }
TextureRegistry.SurfaceTextureEntry registerSurfaceTexture( @NonNull SurfaceTexture surfaceTexture)

◆ destroy()

void io.flutter.view.FlutterView.destroy ( )
inline

Definition at line 439 of file FlutterView.java.

439 {
440 if (!isAttached()) return;
441
442 getHolder().removeCallback(mSurfaceCallback);
443 releaseAccessibilityNodeProvider();
444
445 mNativeView.destroy();
446 mNativeView = null;
447 }

◆ detach()

FlutterNativeView io.flutter.view.FlutterView.detach ( )
inline

Definition at line 429 of file FlutterView.java.

429 {
430 if (!isAttached()) return null;
431 getHolder().removeCallback(mSurfaceCallback);
432 mNativeView.detachFromFlutterView();
433
434 FlutterNativeView view = mNativeView;
435 mNativeView = null;
436 return view;
437 }

◆ disableBufferingIncomingMessages()

void io.flutter.view.FlutterView.disableBufferingIncomingMessages ( )
inline

Disables the ability to queue messages received from Dart.

This can be used after all pending channel handlers have been registered.

Implements io.flutter.plugin.common.BinaryMessenger.

Definition at line 354 of file FlutterView.java.

354{}

◆ disableTransparentBackground()

void io.flutter.view.FlutterView.disableTransparentBackground ( )
inline

Reverts this back to the SurfaceView defaults, at the back of its window and opaque.

Definition at line 359 of file FlutterView.java.

359 {
360 setZOrderOnTop(false);
361 getHolder().setFormat(PixelFormat.OPAQUE);
362 }
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99

◆ dispatchKeyEvent()

boolean io.flutter.view.FlutterView.dispatchKeyEvent ( KeyEvent  event)
inline

Definition at line 269 of file FlutterView.java.

269 {
270 Log.e(TAG, "dispatchKeyEvent: " + event.toString());
271 if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
272 // Tell Android to start tracking this event.
273 getKeyDispatcherState().startTracking(event, this);
274 } else if (event.getAction() == KeyEvent.ACTION_UP) {
275 // Stop tracking the event.
276 getKeyDispatcherState().handleUpEvent(event);
277 }
278 // If the key processor doesn't handle it, then send it on to the
279 // superclass. The key processor will typically handle all events except
280 // those where it has re-dispatched the event after receiving a reply from
281 // the framework that the framework did not handle it.
282 return (isAttached() && mKeyboardManager.handleEvent(event)) || super.dispatchKeyEvent(event);
283 }
boolean handleEvent(@NonNull KeyEvent keyEvent)
FlKeyEvent * event
void Log(const char *format,...) SK_PRINTF_LIKE(1
Definition: TestRunner.cpp:137

◆ enableBufferingIncomingMessages()

void io.flutter.view.FlutterView.enableBufferingIncomingMessages ( )
inline

Enables the ability to queue messages received from Dart.

This is useful when there are pending channel handler registrations. For example, Dart may be initialized concurrently, and prior to the registration of the channel handlers. This implies that Dart may start sending messages while plugins are being registered.

Implements io.flutter.plugin.common.BinaryMessenger.

Definition at line 351 of file FlutterView.java.

351{}

◆ getAccessibilityNodeProvider()

AccessibilityNodeProvider io.flutter.view.FlutterView.getAccessibilityNodeProvider ( )
inline

Definition at line 801 of file FlutterView.java.

801 {
802 if (mAccessibilityNodeProvider != null && mAccessibilityNodeProvider.isAccessibilityEnabled()) {
803 return mAccessibilityNodeProvider;
804 } else {
805 // TODO(goderbauer): when a11y is off this should return a one-off snapshot of
806 // the a11y
807 // tree.
808 return null;
809 }
810 }

◆ getBinaryMessenger()

BinaryMessenger io.flutter.view.FlutterView.getBinaryMessenger ( )
inline

Returns a BinaryMessenger to send platform messages with.

Implements io.flutter.embedding.android.KeyboardManager.ViewDelegate.

Definition at line 834 of file FlutterView.java.

834 {
835 return this;
836 }

◆ getBitmap()

Bitmap io.flutter.view.FlutterView.getBitmap ( )
inline

Return the most recent frame as a bitmap.

Returns
A bitmap.

Definition at line 722 of file FlutterView.java.

722 {
724 return mNativeView.getFlutterJNI().getBitmap();
725 }

◆ getDartExecutor()

DartExecutor io.flutter.view.FlutterView.getDartExecutor ( )
inline

Definition at line 264 of file FlutterView.java.

264 {
265 return dartExecutor;
266 }

◆ getDevicePixelRatio()

float io.flutter.view.FlutterView.getDevicePixelRatio ( )
inlinepackage

Definition at line 425 of file FlutterView.java.

425 {
426 return mMetrics.devicePixelRatio;
427 }

◆ getFlutterNativeView()

FlutterNativeView io.flutter.view.FlutterView.getFlutterNativeView ( )
inline

Definition at line 285 of file FlutterView.java.

285 {
286 return mNativeView;
287 }

◆ getLookupKeyForAsset() [1/2]

String io.flutter.view.FlutterView.getLookupKeyForAsset ( String  asset)
inline

Definition at line 293 of file FlutterView.java.

293 {
294 return FlutterMain.getLookupKeyForAsset(asset);
295 }

◆ getLookupKeyForAsset() [2/2]

String io.flutter.view.FlutterView.getLookupKeyForAsset ( String  asset,
String  packageName 
)
inline

Definition at line 297 of file FlutterView.java.

297 {
298 return FlutterMain.getLookupKeyForAsset(asset, packageName);
299 }

◆ getPluginRegistry()

FlutterPluginRegistry io.flutter.view.FlutterView.getPluginRegistry ( )
inline

Definition at line 289 of file FlutterView.java.

289 {
290 return mNativeView.getPluginRegistry();
291 }

◆ getSystemPointerIcon()

PointerIcon io.flutter.view.FlutterView.getSystemPointerIcon ( int  type)
inline

Gets a system pointer icon object for the given type.

If typeis not recognized, returns the default pointer icon.

This is typically implemented by calling android.view.PointerIcon#getSystemIcon with the context associated with this view.

Implements io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate.

Definition at line 825 of file FlutterView.java.

825 {
826 return PointerIcon.getSystemIcon(getContext(), type);
827 }
GLenum type

◆ hasRenderedFirstFrame()

boolean io.flutter.view.FlutterView.hasRenderedFirstFrame ( )
inline

Returns true if the Flutter experience associated with this FlutterView has rendered its first frame, or false otherwise.

Definition at line 333 of file FlutterView.java.

333 {
334 return didRenderFirstFrame;
335 }

◆ makeBackgroundTaskQueue()

TaskQueue io.flutter.view.FlutterView.makeBackgroundTaskQueue ( TaskQueueOptions  options)
inline

Creates a TaskQueue that executes the tasks serially on a background thread.

TaskQueueOptions can be used to configure the task queue to execute tasks concurrently. Doing so can be more performant, though users need to ensure that the task handlers are thread-safe.

Implements io.flutter.plugin.common.BinaryMessenger.

Definition at line 852 of file FlutterView.java.

852 {
853 return null;
854 }

◆ onApplyWindowInsets()

final WindowInsets io.flutter.view.FlutterView.onApplyWindowInsets ( WindowInsets  insets)
inline

Definition at line 591 of file FlutterView.java.

591 {
592 // getSystemGestureInsets() was introduced in API 29 and immediately deprecated in 30.
593 if (Build.VERSION.SDK_INT == API_LEVELS.API_29) {
594 Insets systemGestureInsets = insets.getSystemGestureInsets();
595 mMetrics.systemGestureInsetTop = systemGestureInsets.top;
596 mMetrics.systemGestureInsetRight = systemGestureInsets.right;
597 mMetrics.systemGestureInsetBottom = systemGestureInsets.bottom;
598 mMetrics.systemGestureInsetLeft = systemGestureInsets.left;
599 }
600
601 boolean statusBarVisible = (SYSTEM_UI_FLAG_FULLSCREEN & getWindowSystemUiVisibility()) == 0;
602 boolean navigationBarVisible =
603 (SYSTEM_UI_FLAG_HIDE_NAVIGATION & getWindowSystemUiVisibility()) == 0;
604
605 if (Build.VERSION.SDK_INT >= API_LEVELS.API_30) {
606 int mask = 0;
607 if (navigationBarVisible) {
608 mask = mask | android.view.WindowInsets.Type.navigationBars();
609 }
610 if (statusBarVisible) {
611 mask = mask | android.view.WindowInsets.Type.statusBars();
612 }
613 Insets uiInsets = insets.getInsets(mask);
614 mMetrics.physicalViewPaddingTop = uiInsets.top;
615 mMetrics.physicalViewPaddingRight = uiInsets.right;
616 mMetrics.physicalViewPaddingBottom = uiInsets.bottom;
617 mMetrics.physicalViewPaddingLeft = uiInsets.left;
618
619 Insets imeInsets = insets.getInsets(android.view.WindowInsets.Type.ime());
620 mMetrics.physicalViewInsetTop = imeInsets.top;
621 mMetrics.physicalViewInsetRight = imeInsets.right;
622 mMetrics.physicalViewInsetBottom = imeInsets.bottom; // Typically, only bottom is non-zero
623 mMetrics.physicalViewInsetLeft = imeInsets.left;
624
625 Insets systemGestureInsets =
626 insets.getInsets(android.view.WindowInsets.Type.systemGestures());
627 mMetrics.systemGestureInsetTop = systemGestureInsets.top;
628 mMetrics.systemGestureInsetRight = systemGestureInsets.right;
629 mMetrics.systemGestureInsetBottom = systemGestureInsets.bottom;
630 mMetrics.systemGestureInsetLeft = systemGestureInsets.left;
631
632 // TODO(garyq): Expose the full rects of the display cutout.
633
634 // Take the max of the display cutout insets and existing padding to merge them
635 DisplayCutout cutout = insets.getDisplayCutout();
636 if (cutout != null) {
637 Insets waterfallInsets = cutout.getWaterfallInsets();
638 mMetrics.physicalViewPaddingTop =
639 Math.max(
640 Math.max(mMetrics.physicalViewPaddingTop, waterfallInsets.top),
641 cutout.getSafeInsetTop());
642 mMetrics.physicalViewPaddingRight =
643 Math.max(
644 Math.max(mMetrics.physicalViewPaddingRight, waterfallInsets.right),
645 cutout.getSafeInsetRight());
646 mMetrics.physicalViewPaddingBottom =
647 Math.max(
648 Math.max(mMetrics.physicalViewPaddingBottom, waterfallInsets.bottom),
649 cutout.getSafeInsetBottom());
650 mMetrics.physicalViewPaddingLeft =
651 Math.max(
652 Math.max(mMetrics.physicalViewPaddingLeft, waterfallInsets.left),
653 cutout.getSafeInsetLeft());
654 }
655 } else {
656 // We zero the left and/or right sides to prevent the padding the
657 // navigation bar would have caused.
658 ZeroSides zeroSides = ZeroSides.NONE;
659 if (!navigationBarVisible) {
660 zeroSides = calculateShouldZeroSides();
661 }
662
663 // Status bar (top), navigation bar (bottom) and left/right system insets should
664 // partially obscure the content (padding).
665 mMetrics.physicalViewPaddingTop = statusBarVisible ? insets.getSystemWindowInsetTop() : 0;
666 mMetrics.physicalViewPaddingRight =
667 zeroSides == ZeroSides.RIGHT || zeroSides == ZeroSides.BOTH
668 ? 0
669 : insets.getSystemWindowInsetRight();
670 mMetrics.physicalViewPaddingBottom =
671 navigationBarVisible && guessBottomKeyboardInset(insets) == 0
672 ? insets.getSystemWindowInsetBottom()
673 : 0;
674 mMetrics.physicalViewPaddingLeft =
675 zeroSides == ZeroSides.LEFT || zeroSides == ZeroSides.BOTH
676 ? 0
677 : insets.getSystemWindowInsetLeft();
678
679 // Bottom system inset (keyboard) should adjust scrollable bottom edge (inset).
680 mMetrics.physicalViewInsetTop = 0;
681 mMetrics.physicalViewInsetRight = 0;
682 mMetrics.physicalViewInsetBottom = guessBottomKeyboardInset(insets);
683 mMetrics.physicalViewInsetLeft = 0;
684 }
685
686 updateViewportMetrics();
687 return super.onApplyWindowInsets(insets);
688 }

◆ onAttachedToWindow()

void io.flutter.view.FlutterView.onAttachedToWindow ( )
inlineprotected

Definition at line 765 of file FlutterView.java.

765 {
766 super.onAttachedToWindow();
767
768 PlatformViewsController platformViewsController =
770 mAccessibilityNodeProvider =
771 new AccessibilityBridge(
772 this,
773 new AccessibilityChannel(dartExecutor, getFlutterNativeView().getFlutterJNI()),
774 (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE),
775 getContext().getContentResolver(),
776 platformViewsController);
777 mAccessibilityNodeProvider.setOnAccessibilityChangeListener(onAccessibilityChangeListener);
778
779 resetWillNotDraw(
780 mAccessibilityNodeProvider.isAccessibilityEnabled(),
781 mAccessibilityNodeProvider.isTouchExplorationEnabled());
782 }
FlutterNativeView getFlutterNativeView()
FlutterPluginRegistry getPluginRegistry()

◆ onConfigurationChanged()

void io.flutter.view.FlutterView.onConfigurationChanged ( Configuration  newConfig)
inlineprotected

Definition at line 419 of file FlutterView.java.

419 {
420 super.onConfigurationChanged(newConfig);
421 mLocalizationPlugin.sendLocalesToFlutter(newConfig);
422 sendUserPlatformSettingsToDart();
423 }

◆ onCreateInputConnection()

InputConnection io.flutter.view.FlutterView.onCreateInputConnection ( EditorInfo  outAttrs)
inline

Definition at line 450 of file FlutterView.java.

450 {
451 return mTextInputPlugin.createInputConnection(this, mKeyboardManager, outAttrs);
452 }
InputConnection createInputConnection( @NonNull View view, @NonNull KeyboardManager keyboardManager, @NonNull EditorInfo outAttrs)

◆ onDetachedFromWindow()

void io.flutter.view.FlutterView.onDetachedFromWindow ( )
inlineprotected

Definition at line 785 of file FlutterView.java.

785 {
786 super.onDetachedFromWindow();
787 releaseAccessibilityNodeProvider();
788 }

◆ onFirstFrame()

void io.flutter.view.FlutterView.onFirstFrame ( )
inline

Definition at line 754 of file FlutterView.java.

754 {
755 didRenderFirstFrame = true;
756
757 // Allow listeners to remove themselves when they are called.
758 List<FirstFrameListener> listeners = new ArrayList<>(mFirstFrameListeners);
759 for (FirstFrameListener listener : listeners) {
760 listener.onFirstFrame();
761 }
762 }

◆ onGenericMotionEvent()

boolean io.flutter.view.FlutterView.onGenericMotionEvent ( MotionEvent  event)
inline

Invoked by Android when a generic motion event occurs, e.g., joystick movement, mouse hover, track pad touches, scroll wheel movements, etc.

Flutter handles all of its own gesture detection and processing, therefore this method forwards all MotionEvent data from Android to Flutter.

Definition at line 506 of file FlutterView.java.

506 {
507 boolean handled =
508 isAttached() && androidTouchProcessor.onGenericMotionEvent(event, getContext());
509 return handled ? true : super.onGenericMotionEvent(event);
510 }
boolean onGenericMotionEvent(@NonNull MotionEvent event, @NonNull Context context)

◆ onHoverEvent()

boolean io.flutter.view.FlutterView.onHoverEvent ( MotionEvent  event)
inline

Definition at line 485 of file FlutterView.java.

485 {
486 if (!isAttached()) {
487 return super.onHoverEvent(event);
488 }
489
490 boolean handled = mAccessibilityNodeProvider.onAccessibilityHoverEvent(event);
491 if (!handled) {
492 // TODO(ianh): Expose hover events to the platform,
493 // implementing ADD, REMOVE, etc.
494 }
495 return handled;
496 }

◆ onMemoryPressure()

void io.flutter.view.FlutterView.onMemoryPressure ( )
inline

◆ onPause()

void io.flutter.view.FlutterView.onPause ( )
inline

Definition at line 309 of file FlutterView.java.

◆ onPostResume()

void io.flutter.view.FlutterView.onPostResume ( )
inline

Definition at line 313 of file FlutterView.java.

313 {
314 for (ActivityLifecycleListener listener : mActivityLifecycleListeners) {
315 listener.onPostResume();
316 }
317 lifecycleChannel.appIsResumed();
318 }

◆ onProvideAutofillVirtualStructure()

void io.flutter.view.FlutterView.onProvideAutofillVirtualStructure ( ViewStructure  structure,
int  flags 
)
inline

Definition at line 463 of file FlutterView.java.

463 {
464 super.onProvideAutofillVirtualStructure(structure, flags);
465 mTextInputPlugin.onProvideAutofillVirtualStructure(structure, flags);
466 }
void onProvideAutofillVirtualStructure(@NonNull ViewStructure structure, int flags)
FlutterSemanticsFlag flags

◆ onSizeChanged()

void io.flutter.view.FlutterView.onSizeChanged ( int  width,
int  height,
int  oldWidth,
int  oldHeight 
)
inlineprotected

Definition at line 513 of file FlutterView.java.

513 {
514 mMetrics.physicalWidth = width;
515 mMetrics.physicalHeight = height;
516 updateViewportMetrics();
517 super.onSizeChanged(width, height, oldWidth, oldHeight);
518 }

◆ onStart()

void io.flutter.view.FlutterView.onStart ( )
inline

Definition at line 305 of file FlutterView.java.

305 {
306 lifecycleChannel.appIsInactive();
307 }

◆ onStop()

void io.flutter.view.FlutterView.onStop ( )
inline

Definition at line 320 of file FlutterView.java.

◆ onTextInputKeyEvent()

boolean io.flutter.view.FlutterView.onTextInputKeyEvent ( @NonNull KeyEvent  keyEvent)
inline

Send a KeyEvent that is not handled by the keyboard responders to the text input system.

Parameters
keyEventthe KeyEvent that should be processed by the text input system. It must not be null.
Returns
Whether the text input handles the key event.

Implements io.flutter.embedding.android.KeyboardManager.ViewDelegate.

Definition at line 839 of file FlutterView.java.

839 {
840 return mTextInputPlugin.handleKeyEvent(keyEvent);
841 }
boolean handleKeyEvent(@NonNull KeyEvent keyEvent)

◆ onTouchEvent()

boolean io.flutter.view.FlutterView.onTouchEvent ( MotionEvent  event)
inline

Definition at line 474 of file FlutterView.java.

474 {
475 if (!isAttached()) {
476 return super.onTouchEvent(event);
477 }
478
479 requestUnbufferedDispatch(event);
480
481 return androidTouchProcessor.onTouchEvent(event);
482 }

◆ popRoute()

void io.flutter.view.FlutterView.popRoute ( )
inline

Definition at line 372 of file FlutterView.java.

◆ pushRoute()

void io.flutter.view.FlutterView.pushRoute ( String  route)
inline

Definition at line 368 of file FlutterView.java.

368 {
369 navigationChannel.pushRoute(route);
370 }
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however route
Definition: switches.h:137

◆ redispatch()

void io.flutter.view.FlutterView.redispatch ( @NonNull KeyEvent  keyEvent)
inline

Send a KeyEvent that is not handled by Flutter back to the platform.

Implements io.flutter.embedding.android.KeyboardManager.ViewDelegate.

Definition at line 844 of file FlutterView.java.

844 {
845 getRootView().dispatchKeyEvent(keyEvent);
846 }

◆ registerSurfaceTexture()

TextureRegistry.SurfaceTextureEntry io.flutter.view.FlutterView.registerSurfaceTexture ( @NonNull SurfaceTexture  surfaceTexture)
inline

Registers a SurfaceTexture managed by the Flutter engine.

Returns
A SurfaceTextureEntry.

Implements io.flutter.view.TextureRegistry.

Definition at line 913 of file FlutterView.java.

914 {
915 surfaceTexture.detachFromGLContext();
916 final SurfaceTextureRegistryEntry entry =
917 new SurfaceTextureRegistryEntry(nextTextureId.getAndIncrement(), surfaceTexture);
918 mNativeView.getFlutterJNI().registerTexture(entry.id(), entry.textureWrapper());
919 return entry;
920 }
void registerTexture(long textureId, @NonNull SurfaceTextureWrapper textureWrapper)

◆ removeFirstFrameListener()

void io.flutter.view.FlutterView.removeFirstFrameListener ( FirstFrameListener  listener)
inline

Remove an existing first frame listener.

Definition at line 346 of file FlutterView.java.

346 {
347 mFirstFrameListeners.remove(listener);
348 }

◆ resetAccessibilityTree()

void io.flutter.view.FlutterView.resetAccessibilityTree ( )
inlinepackage

Definition at line 702 of file FlutterView.java.

702 {
703 if (mAccessibilityNodeProvider != null) {
704 mAccessibilityNodeProvider.reset();
705 }
706 }

◆ runFromBundle()

void io.flutter.view.FlutterView.runFromBundle ( FlutterRunArguments  args)
inline

Definition at line 710 of file FlutterView.java.

710 {
712 preRun();
713 mNativeView.runFromBundle(args);
714 postRun();
715 }
void runFromBundle(FlutterRunArguments args)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ send() [1/2]

void io.flutter.view.FlutterView.send ( String  channel,
ByteBuffer  message 
)
inline

Definition at line 858 of file FlutterView.java.

858 {
859 send(channel, message, null);
860 }
void send(String channel, ByteBuffer message)
Win32Message message

◆ send() [2/2]

void io.flutter.view.FlutterView.send ( String  channel,
ByteBuffer  message,
BinaryReply  callback 
)
inline

Definition at line 864 of file FlutterView.java.

864 {
865 if (!isAttached()) {
866 Log.d(TAG, "FlutterView.send called on a detached view, channel=" + channel);
867 return;
868 }
869 mNativeView.send(channel, message, callback);
870 }
void send(String channel, ByteBuffer message)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ setInitialRoute()

void io.flutter.view.FlutterView.setInitialRoute ( String  route)
inline

Definition at line 364 of file FlutterView.java.

364 {
365 navigationChannel.setInitialRoute(route);
366 }

◆ setMessageHandler() [1/2]

void io.flutter.view.FlutterView.setMessageHandler ( @NonNull String  channel,
@NonNull BinaryMessageHandler  handler,
@NonNull TaskQueue  taskQueue 
)
inline

Definition at line 880 of file FlutterView.java.

883 {
884 mNativeView.setMessageHandler(channel, handler, taskQueue);
885 }
void setMessageHandler(String channel, BinaryMessageHandler handler)

◆ setMessageHandler() [2/2]

void io.flutter.view.FlutterView.setMessageHandler ( @NonNull String  channel,
@NonNull BinaryMessageHandler  handler 
)
inline

Definition at line 874 of file FlutterView.java.

874 {
875 mNativeView.setMessageHandler(channel, handler);
876 }

◆ startBackGesture()

void io.flutter.view.FlutterView.startBackGesture ( @NonNull BackEvent  backEvent)
inline

Definition at line 378 of file FlutterView.java.

378 {
379 backGestureChannel.startBackGesture(backEvent);
380 }

◆ updateBackGestureProgress()

void io.flutter.view.FlutterView.updateBackGestureProgress ( @NonNull BackEvent  backEvent)
inline

Definition at line 384 of file FlutterView.java.

384 {
385 backGestureChannel.updateBackGestureProgress(backEvent);
386 }

The documentation for this class was generated from the following file: