Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c19a30b

Browse files
committed
update imports
1 parent d4cabcc commit c19a30b

File tree

6 files changed

+18
-28
lines changed

6 files changed

+18
-28
lines changed

shell/platform/android/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ android_java_sources = [
150150
"io/flutter/embedding/engine/FlutterEngineCache.java",
151151
"io/flutter/embedding/engine/FlutterEnginePluginRegistry.java",
152152
"io/flutter/embedding/engine/FlutterJNI.java",
153+
"io/flutter/embedding/engine/FlutterOverlaySurface.java",
153154
"io/flutter/embedding/engine/FlutterShellArgs.java",
154155
"io/flutter/embedding/engine/dart/DartExecutor.java",
155156
"io/flutter/embedding/engine/dart/DartMessenger.java",

shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ public FlutterOverlaySurface createOverlaySurface() {
830830
throw new RuntimeException(
831831
"platformViewsController must be set before attempting to position an overlay surface");
832832
}
833-
platformViewsController.onDisplayOverlaySurface(id, x, y, width, height);
833+
return platformViewsController.createOverlaySurface();
834834
}
835835
// ----- End Engine Lifecycle Support ----
836836

shell/platform/android/io/flutter/embedding/engine/FlutterOverlaySurface.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
package io.flutter.embedding.engine;
66

77
import android.view.Surface;
8+
import androidx.annotation.Keep;
9+
import androidx.annotation.NonNull;
810

911
public class FlutterOverlaySurface {
10-
// @NonNull
12+
@NonNull
1113
private final Surface surface;
1214

1315
private final long id;
1416

15-
// @Keep
16-
public FlutterOverlaySurface(long id, Surface surface) {
17+
@Keep
18+
public FlutterOverlaySurface(long id, @NonNull Surface surface) {
1719
this.id = id;
1820
this.surface = surface;
1921
}

shell/platform/android/jni/platform_view_android_jni.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ class PlatformViewAndroidJNI {
146146
/// @note Must be called from the platform thread.
147147
///
148148
virtual void FlutterViewEndFrame() = 0;
149+
150+
//----------------------------------------------------------------------------
151+
/// @brief Instantiates an overlay surface in hybrid composition.
152+
///
153+
///
154+
/// @note Must be called from the platform thread.
155+
///
156+
virtual void FlutterViewCreateOverlaySurface() = 0;
149157
};
150158

151159
} // namespace flutter

shell/platform/android/platform_view_android_jni.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
// Copyright 2013 The Flutter Authors. All rights reserved.
23
// Use of this source code is governed by a BSD-style license that can be
34
// found in the LICENSE file.

shell/platform/android/platform_view_android_jni_impl.cc

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "flutter/shell/platform/android/apk_asset_provider.h"
2626
#include "flutter/shell/platform/android/flutter_main.h"
2727
#include "flutter/shell/platform/android/platform_view_android.h"
28+
#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
29+
#include "flutter/shell/platform/android/platform_view_android_jni.h"
2830

2931
#define ANDROID_SHELL_HOLDER \
3032
(reinterpret_cast<AndroidShellHolder*>(shell_holder))
@@ -81,35 +83,11 @@ static jmethodID g_on_first_frame_method = nullptr;
8183
static jmethodID g_on_engine_restart_method = nullptr;
8284

8385
static jmethodID g_create_overlay_surface_method = nullptr;
84-
static jmethodID g_flutter_overlay_layer_get_id_method = nullptr;
85-
static jmethodID g_flutter_overlay_layer_get_surface_method = nullptr;
86-
87-
std::unique_ptr<AndroidFlutterOverlaySurface> FlutterViewCreateOverlaySurface(
88-
JNIEnv* env,
89-
jobject obj) {
90-
jobject joverlay_layer =
91-
env->CallObjectMethod(obj, g_create_overlay_surface_method);
92-
jlong layer_id = env->CallLongMethod(joverlay_layer,
93-
g_flutter_overlay_layer_get_id_method);
94-
jobject surface = env->CallObjectMethod(
95-
joverlay_layer, g_flutter_overlay_layer_get_surface_method);
96-
97-
FML_CHECK(CheckException(env));
98-
return std::make_unique<AndroidFlutterOverlaySurface>(
99-
layer_id, fml::MakeRefCounted<AndroidNativeWindow>(
100-
ANativeWindow_fromSurface(env, surface)));
101-
}
10286

10387
static jmethodID g_on_begin_frame_method = nullptr;
10488

10589
static jmethodID g_on_end_frame_method = nullptr;
10690

107-
static jmethodID g_create_overlay_surface_method = nullptr;
108-
109-
static jmethodID g_flutter_overlay_layer_get_id_method = nullptr;
110-
111-
static jmethodID g_flutter_overlay_layer_get_surface_method = nullptr;
112-
11391
static jmethodID g_attach_to_gl_context_method = nullptr;
11492

11593
static jmethodID g_update_tex_image_method = nullptr;

0 commit comments

Comments
 (0)