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

Commit 5dca50d

Browse files
Reverts "Delete engine v1 android embedding (#51229)" (#51996)
Reverts: #51229 Initiated by: gmackall Reason for reverting: blocking engine->framework roll (I missed some framework code referencing the v1 embedding). Original PR Author: gmackall Reviewed By: {matanlurey, reidbaker} This change reverts the following previous change: Fixes flutter/flutter#143531 Also fixes a random typo I found ~TODO to test this~ (no more todo): -~test the framework against this as well, probably with a dummy PR changing the engine commit to my branch if this is possible~ not possible, made a best effort removal of framework code in flutter/flutter#144726. -~figure out if the old embedding is used in g3 at all~ removed all uses -~figure out exactly what the ShimPluginRegistry/ShimRegistrar are doing, and if fully deleting them was right~ (see #51229 (comment)) [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent b735b76 commit 5dca50d

23 files changed

+3574
-8
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41186,6 +41186,13 @@ ORIGIN: ../../../flutter/shell/platform/android/io/flutter/Build.java + ../../..
4118641186
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/BuildConfig.java + ../../../flutter/LICENSE
4118741187
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/FlutterInjector.java + ../../../flutter/LICENSE
4118841188
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/Log.java + ../../../flutter/LICENSE
41189+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivity.java + ../../../flutter/LICENSE
41190+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java + ../../../flutter/LICENSE
41191+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityEvents.java + ../../../flutter/LICENSE
41192+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterApplication.java + ../../../flutter/LICENSE
41193+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java + ../../../flutter/LICENSE
41194+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPlayStoreSplitApplication.java + ../../../flutter/LICENSE
41195+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java + ../../../flutter/LICENSE
4118941196
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/ExclusiveAppComponent.java + ../../../flutter/LICENSE
4119041197
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java + ../../../flutter/LICENSE
4119141198
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java + ../../../flutter/LICENSE
@@ -41241,6 +41248,8 @@ ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plug
4124141248
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceAware.java + ../../../flutter/LICENSE
4124241249
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceControlSurface.java + ../../../flutter/LICENSE
4124341250
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServicePluginBinding.java + ../../../flutter/LICENSE
41251+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimPluginRegistry.java + ../../../flutter/LICENSE
41252+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimRegistrar.java + ../../../flutter/LICENSE
4124441253
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/util/GeneratedPluginRegister.java + ../../../flutter/LICENSE
4124541254
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java + ../../../flutter/LICENSE
4124641255
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterUiDisplayListener.java + ../../../flutter/LICENSE
@@ -41312,7 +41321,10 @@ ORIGIN: ../../../flutter/shell/platform/android/io/flutter/util/ViewUtils.java +
4131241321
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java + ../../../flutter/LICENSE
4131341322
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java + ../../../flutter/LICENSE
4131441323
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java + ../../../flutter/LICENSE
41324+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/FlutterMain.java + ../../../flutter/LICENSE
41325+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java + ../../../flutter/LICENSE
4131541326
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java + ../../../flutter/LICENSE
41327+
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java + ../../../flutter/LICENSE
4131641328
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/TextureRegistry.java + ../../../flutter/LICENSE
4131741329
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/view/VsyncWaiter.java + ../../../flutter/LICENSE
4131841330
ORIGIN: ../../../flutter/shell/platform/android/jni/jni_mock.h + ../../../flutter/LICENSE
@@ -44056,6 +44068,13 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/Build.java
4405644068
FILE: ../../../flutter/shell/platform/android/io/flutter/BuildConfig.java
4405744069
FILE: ../../../flutter/shell/platform/android/io/flutter/FlutterInjector.java
4405844070
FILE: ../../../flutter/shell/platform/android/io/flutter/Log.java
44071+
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivity.java
44072+
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java
44073+
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityEvents.java
44074+
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterApplication.java
44075+
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java
44076+
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPlayStoreSplitApplication.java
44077+
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java
4405944078
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
4406044079
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/ExclusiveAppComponent.java
4406144080
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java
@@ -44114,6 +44133,8 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugin
4411444133
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceAware.java
4411544134
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServiceControlSurface.java
4411644135
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/service/ServicePluginBinding.java
44136+
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimPluginRegistry.java
44137+
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/shim/ShimRegistrar.java
4411744138
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/plugins/util/GeneratedPluginRegister.java
4411844139
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
4411944140
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterUiDisplayListener.java
@@ -44193,7 +44214,10 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/util/ViewUtils.java
4419344214
FILE: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java
4419444215
FILE: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
4419544216
FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java
44217+
FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterMain.java
44218+
FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java
4419644219
FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java
44220+
FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java
4419744221
FILE: ../../../flutter/shell/platform/android/io/flutter/view/TextureRegistry.java
4419844222
FILE: ../../../flutter/shell/platform/android/io/flutter/view/VsyncWaiter.java
4419944223
FILE: ../../../flutter/shell/platform/android/jni/jni_mock.h

shell/platform/android/AndroidManifest.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@
33
Use of this source code is governed by a BSD-style license that can be
44
found in the LICENSE file.
55
-->
6-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.flutter.embedding" android:versionCode="1" android:versionName="0.0.1">
6+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.flutter.app" android:versionCode="1" android:versionName="0.0.1">
77

88
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />
99
<uses-permission android:name="android.permission.INTERNET" />
1010
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1111
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
1212

13+
<application android:label="Flutter Shell" android:name="FlutterApplication" android:debuggable="true">
14+
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
15+
android:hardwareAccelerated="true"
16+
android:launchMode="standard"
17+
android:name="FlutterActivity"
18+
android:theme="@android:style/Theme.Black.NoTitleBar"
19+
android:windowSoftInputMode="adjustResize"
20+
android:exported="true">
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN" />
23+
<category android:name="android.intent.category.LAUNCHER" />
24+
</intent-filter>
25+
</activity>
26+
</application>
27+
1328
<!-- Required for io.flutter.plugin.text.ProcessTextPlugin to query activities that can process text. -->
1429
<queries>
1530
<intent>

shell/platform/android/BUILD.gn

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@ android_java_sources = [
198198
"io/flutter/Build.java",
199199
"io/flutter/FlutterInjector.java",
200200
"io/flutter/Log.java",
201+
"io/flutter/app/FlutterActivity.java",
202+
"io/flutter/app/FlutterActivityDelegate.java",
203+
"io/flutter/app/FlutterActivityEvents.java",
204+
"io/flutter/app/FlutterApplication.java",
205+
"io/flutter/app/FlutterFragmentActivity.java",
206+
"io/flutter/app/FlutterPlayStoreSplitApplication.java",
207+
"io/flutter/app/FlutterPluginRegistry.java",
201208
"io/flutter/embedding/android/AndroidTouchProcessor.java",
202209
"io/flutter/embedding/android/ExclusiveAppComponent.java",
203210
"io/flutter/embedding/android/FlutterActivity.java",
@@ -256,6 +263,8 @@ android_java_sources = [
256263
"io/flutter/embedding/engine/plugins/service/ServiceAware.java",
257264
"io/flutter/embedding/engine/plugins/service/ServiceControlSurface.java",
258265
"io/flutter/embedding/engine/plugins/service/ServicePluginBinding.java",
266+
"io/flutter/embedding/engine/plugins/shim/ShimPluginRegistry.java",
267+
"io/flutter/embedding/engine/plugins/shim/ShimRegistrar.java",
259268
"io/flutter/embedding/engine/plugins/util/GeneratedPluginRegister.java",
260269
"io/flutter/embedding/engine/renderer/FlutterRenderer.java",
261270
"io/flutter/embedding/engine/renderer/FlutterUiDisplayListener.java",
@@ -335,7 +344,10 @@ android_java_sources = [
335344
"io/flutter/view/AccessibilityBridge.java",
336345
"io/flutter/view/AccessibilityViewEmbedder.java",
337346
"io/flutter/view/FlutterCallbackInformation.java",
347+
"io/flutter/view/FlutterMain.java",
348+
"io/flutter/view/FlutterNativeView.java",
338349
"io/flutter/view/FlutterRunArguments.java",
350+
"io/flutter/view/FlutterView.java",
339351
"io/flutter/view/TextureRegistry.java",
340352
"io/flutter/view/VsyncWaiter.java",
341353
]
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
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.app;
6+
7+
import android.app.Activity;
8+
import android.content.Context;
9+
import android.content.Intent;
10+
import android.content.res.Configuration;
11+
import android.os.Bundle;
12+
import androidx.annotation.NonNull;
13+
import io.flutter.app.FlutterActivityDelegate.ViewFactory;
14+
import io.flutter.plugin.common.PluginRegistry;
15+
import io.flutter.view.FlutterNativeView;
16+
import io.flutter.view.FlutterView;
17+
18+
/**
19+
* Deprecated base class for activities that use Flutter.
20+
*
21+
* @deprecated {@link io.flutter.embedding.android.FlutterActivity} is the new API that now replaces
22+
* this class. See https://flutter.dev/go/android-project-migration for more migration details.
23+
*/
24+
@Deprecated
25+
public class FlutterActivity extends Activity
26+
implements FlutterView.Provider, PluginRegistry, ViewFactory {
27+
private static final String TAG = "FlutterActivity";
28+
29+
private final FlutterActivityDelegate delegate = new FlutterActivityDelegate(this, this);
30+
31+
// These aliases ensure that the methods we forward to the delegate adhere
32+
// to relevant interfaces versus just existing in FlutterActivityDelegate.
33+
private final FlutterActivityEvents eventDelegate = delegate;
34+
private final FlutterView.Provider viewProvider = delegate;
35+
private final PluginRegistry pluginRegistry = delegate;
36+
37+
/**
38+
* Returns the Flutter view used by this activity; will be null before {@link #onCreate(Bundle)}
39+
* is called.
40+
*/
41+
@Override
42+
public FlutterView getFlutterView() {
43+
return viewProvider.getFlutterView();
44+
}
45+
46+
/**
47+
* Hook for subclasses to customize the creation of the {@code FlutterView}.
48+
*
49+
* <p>The default implementation returns {@code null}, which will cause the activity to use a
50+
* newly instantiated full-screen view.
51+
*/
52+
@Override
53+
public FlutterView createFlutterView(Context context) {
54+
return null;
55+
}
56+
57+
/**
58+
* Hook for subclasses to customize the creation of the {@code FlutterNativeView}.
59+
*
60+
* <p>The default implementation returns {@code null}, which will cause the activity to use a
61+
* newly instantiated native view object.
62+
*/
63+
@Override
64+
public FlutterNativeView createFlutterNativeView() {
65+
return null;
66+
}
67+
68+
@Override
69+
public boolean retainFlutterNativeView() {
70+
return false;
71+
}
72+
73+
@Override
74+
public final boolean hasPlugin(String key) {
75+
return pluginRegistry.hasPlugin(key);
76+
}
77+
78+
@Override
79+
public final <T> T valuePublishedByPlugin(String pluginKey) {
80+
return pluginRegistry.valuePublishedByPlugin(pluginKey);
81+
}
82+
83+
@Override
84+
public final Registrar registrarFor(String pluginKey) {
85+
return pluginRegistry.registrarFor(pluginKey);
86+
}
87+
88+
@Override
89+
protected void onCreate(Bundle savedInstanceState) {
90+
super.onCreate(savedInstanceState);
91+
eventDelegate.onCreate(savedInstanceState);
92+
}
93+
94+
@Override
95+
protected void onStart() {
96+
super.onStart();
97+
eventDelegate.onStart();
98+
}
99+
100+
@Override
101+
protected void onResume() {
102+
super.onResume();
103+
eventDelegate.onResume();
104+
}
105+
106+
@Override
107+
protected void onDestroy() {
108+
eventDelegate.onDestroy();
109+
super.onDestroy();
110+
}
111+
112+
@Override
113+
public void onBackPressed() {
114+
if (!eventDelegate.onBackPressed()) {
115+
super.onBackPressed();
116+
}
117+
}
118+
119+
@Override
120+
protected void onStop() {
121+
eventDelegate.onStop();
122+
super.onStop();
123+
}
124+
125+
@Override
126+
protected void onPause() {
127+
super.onPause();
128+
eventDelegate.onPause();
129+
}
130+
131+
@Override
132+
protected void onPostResume() {
133+
super.onPostResume();
134+
eventDelegate.onPostResume();
135+
}
136+
137+
// @Override - added in API level 23
138+
public void onRequestPermissionsResult(
139+
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
140+
eventDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults);
141+
}
142+
143+
@Override
144+
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
145+
if (!eventDelegate.onActivityResult(requestCode, resultCode, data)) {
146+
super.onActivityResult(requestCode, resultCode, data);
147+
}
148+
}
149+
150+
@Override
151+
protected void onNewIntent(Intent intent) {
152+
eventDelegate.onNewIntent(intent);
153+
}
154+
155+
@Override
156+
public void onUserLeaveHint() {
157+
eventDelegate.onUserLeaveHint();
158+
}
159+
160+
@Override
161+
public void onWindowFocusChanged(boolean hasFocus) {
162+
super.onWindowFocusChanged(hasFocus);
163+
eventDelegate.onWindowFocusChanged(hasFocus);
164+
}
165+
166+
@Override
167+
public void onTrimMemory(int level) {
168+
eventDelegate.onTrimMemory(level);
169+
}
170+
171+
@Override
172+
public void onLowMemory() {
173+
eventDelegate.onLowMemory();
174+
}
175+
176+
@Override
177+
public void onConfigurationChanged(Configuration newConfig) {
178+
super.onConfigurationChanged(newConfig);
179+
eventDelegate.onConfigurationChanged(newConfig);
180+
}
181+
}

0 commit comments

Comments
 (0)