Flutter Engine
The Flutter Engine
ServiceControlSurface.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package io.flutter.embedding.engine.plugins.service;
6
7import android.app.Service;
8import androidx.annotation.NonNull;
9import androidx.annotation.Nullable;
10import androidx.lifecycle.Lifecycle;
11
12/**
13 * Control surface through which a {@link Service} attaches to a {@link
14 * io.flutter.embedding.engine.FlutterEngine}.
15 *
16 * <p>A {@link Service} that contains a {@link io.flutter.embedding.engine.FlutterEngine} should
17 * coordinate itself with the {@link io.flutter.embedding.engine.FlutterEngine}'s {@code
18 * ServiceControlSurface}.
19 */
20public interface ServiceControlSurface {
21 /**
22 * Call this method from the {@link Service} that is running the {@link
23 * io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code
24 * ServiceControlSurface}.
25 *
26 * <p>Once a {@link Service} is created, and its associated {@link
27 * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link Service} should
28 * invoke this method. At that point the {@link io.flutter.embedding.engine.FlutterEngine} is
29 * considered "attached" to the {@link Service} and all {@link ServiceAware} plugins are given
30 * access to the {@link Service}.
31 *
32 * <p>{@code isForeground} should be true if the given {@link Service} is running in the
33 * foreground, false otherwise.
34 */
36 @NonNull Service service, @Nullable Lifecycle lifecycle, boolean isForeground);
37
38 /**
39 * Call this method from the {@link Service} that is attached to this {@code
40 * ServiceControlSurfaces}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link
41 * Service} is about to be destroyed.
42 *
43 * <p>This method gives each {@link ServiceAware} plugin an opportunity to clean up its references
44 * before the {@link Service is destroyed}.
45 */
47
48 /**
49 * Call this method from the {@link Service} that is attached to this {@code
50 * ServiceControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link
51 * Service} goes from background to foreground.
52 */
54
55 /**
56 * Call this method from the {@link Service} that is attached to this {@code
57 * ServiceControlSurface}'s {@link io.flutter.embedding.engine.FlutterEngine} when the {@link
58 * Service} goes from foreground to background.
59 */
61}
void attachToService( @NonNull Service service, @Nullable Lifecycle lifecycle, boolean isForeground)
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 service
Definition: switches.h:99