• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
5 package io.flutter.embedding.engine.plugins.contentprovider;
6 
7 import android.content.ContentProvider;
8 import android.arch.lifecycle.Lifecycle;
9 import android.support.annotation.NonNull;
10 
11 /**
12  * Control surface through which a {@link ContentProvider} attaches to a {@link FlutterEngine}.
13  * <p>
14  * A {@link ContentProvider} that contains a {@link FlutterEngine} should coordinate itself with the
15  * {@link FlutterEngine}'s {@code ContentProviderControlSurface}.
16  */
17 public interface ContentProviderControlSurface {
18   /**
19    * Call this method from the {@link ContentProvider} that is running the {@link FlutterEngine}
20    * that is associated with this {@code ContentProviderControlSurface}.
21    * <p>
22    * Once a {@link ContentProvider} is created, and its associated {@link FlutterEngine} is
23    * executing Dart code, the {@link ContentProvider} should invoke this method. At that point the
24    * {@link FlutterEngine} is considered "attached" to the {@link ContentProvider} and all
25    * {@link ContentProviderAware} plugins are given access to the {@link ContentProvider}.
26    */
attachToContentProvider(@onNull ContentProvider contentProvider, @NonNull Lifecycle lifecycle)27   void attachToContentProvider(@NonNull ContentProvider contentProvider, @NonNull Lifecycle lifecycle);
28 
29   /**
30    * Call this method from the {@link ContentProvider} that is attached to this
31    * {@code ContentProviderControlSurfaces}'s {@link FlutterEngine} when the {@link ContentProvider}
32    * is about to be destroyed.
33    * <p>
34    * This method gives each {@link ContentProviderAware} plugin an opportunity to clean up its references
35    * before the {@link ContentProvider is destroyed}.
36    */
detachFromContentProvider()37   void detachFromContentProvider();
38 }
39