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

Commit 632b276

Browse files
authored
[Android] Removes handling of Flutter splash screen (#44047)
Fixes flutter/flutter#105173. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent aa1278e commit 632b276

17 files changed

+4
-2008
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,7 +2326,6 @@ ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterApplicatio
23262326
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java + ../../../flutter/LICENSE
23272327
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPlayStoreSplitApplication.java + ../../../flutter/LICENSE
23282328
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java + ../../../flutter/LICENSE
2329-
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/DrawableSplashScreen.java + ../../../flutter/LICENSE
23302329
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/ExclusiveAppComponent.java + ../../../flutter/LICENSE
23312330
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java + ../../../flutter/LICENSE
23322331
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java + ../../../flutter/LICENSE
@@ -2337,7 +2336,6 @@ ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/Flu
23372336
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java + ../../../flutter/LICENSE
23382337
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterImageView.java + ../../../flutter/LICENSE
23392338
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterPlayStoreSplitApplication.java + ../../../flutter/LICENSE
2340-
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterSplashView.java + ../../../flutter/LICENSE
23412339
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java + ../../../flutter/LICENSE
23422340
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java + ../../../flutter/LICENSE
23432341
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java + ../../../flutter/LICENSE
@@ -2347,8 +2345,6 @@ ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/Key
23472345
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/KeyboardManager.java + ../../../flutter/LICENSE
23482346
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/KeyboardMap.java + ../../../flutter/LICENSE
23492347
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/RenderMode.java + ../../../flutter/LICENSE
2350-
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreen.java + ../../../flutter/LICENSE
2351-
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreenProvider.java + ../../../flutter/LICENSE
23522348
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/TransparencyMode.java + ../../../flutter/LICENSE
23532349
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/android/WindowInfoRepositoryCallbackAdapterWrapper.java + ../../../flutter/LICENSE
23542350
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java + ../../../flutter/LICENSE
@@ -5024,7 +5020,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActi
50245020
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPlayStoreSplitApplication.java
50255021
FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java
50265022
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
5027-
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/DrawableSplashScreen.java
50285023
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/ExclusiveAppComponent.java
50295024
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java
50305025
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java
@@ -5035,7 +5030,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/Flutt
50355030
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java
50365031
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterImageView.java
50375032
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterPlayStoreSplitApplication.java
5038-
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterSplashView.java
50395033
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java
50405034
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java
50415035
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java
@@ -5046,8 +5040,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/Keybo
50465040
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/KeyboardMap.java
50475041
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/MotionEventTracker.java
50485042
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/RenderMode.java
5049-
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreen.java
5050-
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreenProvider.java
50515043
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/TransparencyMode.java
50525044
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/WindowInfoRepositoryCallbackAdapterWrapper.java
50535045
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java

shell/platform/android/BUILD.gn

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ android_java_sources = [
180180
"io/flutter/app/FlutterPlayStoreSplitApplication.java",
181181
"io/flutter/app/FlutterPluginRegistry.java",
182182
"io/flutter/embedding/android/AndroidTouchProcessor.java",
183-
"io/flutter/embedding/android/DrawableSplashScreen.java",
184183
"io/flutter/embedding/android/ExclusiveAppComponent.java",
185184
"io/flutter/embedding/android/FlutterActivity.java",
186185
"io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java",
@@ -191,7 +190,6 @@ android_java_sources = [
191190
"io/flutter/embedding/android/FlutterFragmentActivity.java",
192191
"io/flutter/embedding/android/FlutterImageView.java",
193192
"io/flutter/embedding/android/FlutterPlayStoreSplitApplication.java",
194-
"io/flutter/embedding/android/FlutterSplashView.java",
195193
"io/flutter/embedding/android/FlutterSurfaceView.java",
196194
"io/flutter/embedding/android/FlutterTextureView.java",
197195
"io/flutter/embedding/android/FlutterView.java",
@@ -202,8 +200,6 @@ android_java_sources = [
202200
"io/flutter/embedding/android/KeyboardMap.java",
203201
"io/flutter/embedding/android/MotionEventTracker.java",
204202
"io/flutter/embedding/android/RenderMode.java",
205-
"io/flutter/embedding/android/SplashScreen.java",
206-
"io/flutter/embedding/android/SplashScreenProvider.java",
207203
"io/flutter/embedding/android/TransparencyMode.java",
208204
"io/flutter/embedding/android/WindowInfoRepositoryCallbackAdapterWrapper.java",
209205
"io/flutter/embedding/engine/FlutterEngine.java",

shell/platform/android/io/flutter/embedding/android/DrawableSplashScreen.java

Lines changed: 0 additions & 125 deletions
This file was deleted.

shell/platform/android/io/flutter/embedding/android/FlutterActivity.java

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@
2020
import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.HANDLE_DEEPLINKING_META_DATA_KEY;
2121
import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.INITIAL_ROUTE_META_DATA_KEY;
2222
import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.NORMAL_THEME_META_DATA_KEY;
23-
import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.SPLASH_SCREEN_META_DATA_KEY;
2423

2524
import android.app.Activity;
2625
import android.content.Context;
2726
import android.content.Intent;
2827
import android.content.pm.ActivityInfo;
2928
import android.content.pm.ApplicationInfo;
3029
import android.content.pm.PackageManager;
31-
import android.content.res.Resources;
3230
import android.graphics.Color;
3331
import android.graphics.drawable.ColorDrawable;
34-
import android.graphics.drawable.Drawable;
3532
import android.os.Build;
3633
import android.os.Bundle;
3734
import android.view.View;
@@ -42,7 +39,6 @@
4239
import androidx.annotation.NonNull;
4340
import androidx.annotation.Nullable;
4441
import androidx.annotation.VisibleForTesting;
45-
import androidx.core.content.res.ResourcesCompat;
4642
import androidx.lifecycle.Lifecycle;
4743
import androidx.lifecycle.LifecycleOwner;
4844
import androidx.lifecycle.LifecycleRegistry;
@@ -69,7 +65,6 @@
6965
*
7066
* <ul>
7167
* <li>Displays an Android launch screen.
72-
* <li>Displays a Flutter splash screen.
7368
* <li>Configures the status bar appearance.
7469
* <li>Chooses the Dart execution app bundle path, entrypoint and entrypoint arguments.
7570
* <li>Chooses Flutter's initial route.
@@ -167,7 +162,7 @@
167162
* FlutterView}. Using a {@link FlutterView} requires forwarding some calls from an {@code
168163
* Activity}, as well as forwarding lifecycle calls from an {@code Activity} or a {@code Fragment}.
169164
*
170-
* <p><strong>Launch Screen and Splash Screen</strong>
165+
* <p><strong>Launch Screen</strong>
171166
*
172167
* <p>{@code FlutterActivity} supports the display of an Android "launch screen", which is displayed
173168
* while the Android application loads. It is only applicable if {@code FlutterActivity} is the
@@ -201,10 +196,6 @@
201196
* <p>With themes defined, and AndroidManifest.xml updated, Flutter displays the specified launch
202197
* screen until the Android application is initialized.
203198
*
204-
* <p>Flutter also requires initialization time. To specify a splash screen for Flutter
205-
* initialization, subclass {@code FlutterActivity} and override {@link #provideSplashScreen()}. See
206-
* {@link SplashScreen} for details on implementing a splash screen.
207-
*
208199
* <p><strong>Alternative Activity</strong> {@link FlutterFragmentActivity} is also available, which
209200
* is similar to {@code FlutterActivity} but it extends {@code FragmentActivity}. You should use
210201
* {@code FlutterActivity}, if possible, but if you need a {@code FragmentActivity} then you should
@@ -756,41 +747,6 @@ private void switchLaunchThemeForNormalTheme() {
756747
}
757748
}
758749

759-
@Nullable
760-
@Override
761-
public SplashScreen provideSplashScreen() {
762-
Drawable manifestSplashDrawable = getSplashScreenFromManifest();
763-
if (manifestSplashDrawable != null) {
764-
return new DrawableSplashScreen(manifestSplashDrawable);
765-
} else {
766-
return null;
767-
}
768-
}
769-
770-
/**
771-
* Returns a {@link Drawable} to be used as a splash screen as requested by meta-data in the
772-
* {@code AndroidManifest.xml} file, or null if no such splash screen is requested.
773-
*
774-
* <p>See {@link FlutterActivityLaunchConfigs#SPLASH_SCREEN_META_DATA_KEY} for the meta-data key
775-
* to be used in a manifest file.
776-
*/
777-
@Nullable
778-
private Drawable getSplashScreenFromManifest() {
779-
try {
780-
Bundle metaData = getMetaData();
781-
int splashScreenId = metaData != null ? metaData.getInt(SPLASH_SCREEN_META_DATA_KEY) : 0;
782-
return splashScreenId != 0
783-
? ResourcesCompat.getDrawable(getResources(), splashScreenId, getTheme())
784-
: null;
785-
} catch (Resources.NotFoundException e) {
786-
Log.e(TAG, "Splash screen not found. Ensure the drawable exists and that it's valid.");
787-
throw e;
788-
} catch (PackageManager.NameNotFoundException e) {
789-
// This is never expected to happen.
790-
return null;
791-
}
792-
}
793-
794750
/**
795751
* Sets this {@code Activity}'s {@code Window} background to be transparent, and hides the status
796752
* bar, if this {@code Activity}'s desired {@link BackgroundMode} is {@link

shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import io.flutter.embedding.engine.dart.DartExecutor;
3131
import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener;
3232
import io.flutter.plugin.platform.PlatformPlugin;
33-
import io.flutter.util.ViewUtils;
3433
import java.util.Arrays;
3534
import java.util.List;
3635

@@ -344,9 +343,7 @@ private FlutterEngineGroup.Options addEntrypointOptions(FlutterEngineGroup.Optio
344343
* with Android tools, such as "Displayed" timing printed with `am start`.
345344
*
346345
* <p>Note that it should only be set to true when {@code Host#getRenderMode()} is {@code
347-
* RenderMode.surface}. This parameter is also ignored, disabling the delay should the legacy
348-
* {@code Host#provideSplashScreen()} be non-null. See <a
349-
* href="https://flutter.dev/go/android-splash-migration">Android Splash Migration</a>.
346+
* RenderMode.surface}.
350347
*
351348
* <p>This method:
352349
*
@@ -397,20 +394,6 @@ View onCreateView(
397394
flutterView.attachToFlutterEngine(flutterEngine);
398395
flutterView.setId(flutterViewId);
399396

400-
SplashScreen splashScreen = host.provideSplashScreen();
401-
402-
if (splashScreen != null) {
403-
Log.w(
404-
TAG,
405-
"A splash screen was provided to Flutter, but this is deprecated. See"
406-
+ " flutter.dev/go/android-splash-migration for migration steps.");
407-
FlutterSplashView flutterSplashView = new FlutterSplashView(host.getContext());
408-
flutterSplashView.setId(ViewUtils.generateViewId(FLUTTER_SPLASH_VIEW_FALLBACK_ID));
409-
flutterSplashView.displayFlutterViewWithSplash(flutterView, splashScreen);
410-
411-
return flutterSplashView;
412-
}
413-
414397
if (shouldDelayFirstAndroidViewDraw) {
415398
delayFirstAndroidViewDraw(flutterView);
416399
}
@@ -952,8 +935,7 @@ private void ensureAlive() {
952935
* FlutterActivityAndFragmentDelegate}.
953936
*/
954937
/* package */ interface Host
955-
extends SplashScreenProvider,
956-
FlutterEngineProvider,
938+
extends FlutterEngineProvider,
957939
FlutterEngineConfigurator,
958940
PlatformPlugin.PlatformPluginDelegate {
959941
/**
@@ -1070,9 +1052,6 @@ private void ensureAlive() {
10701052
*/
10711053
ExclusiveAppComponent<Activity> getExclusiveAppComponent();
10721054

1073-
@Nullable
1074-
SplashScreen provideSplashScreen();
1075-
10761055
/**
10771056
* Returns the {@link io.flutter.embedding.engine.FlutterEngine} that should be rendered to a
10781057
* {@link FlutterView}.

shell/platform/android/io/flutter/embedding/android/FlutterActivityLaunchConfigs.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ public class FlutterActivityLaunchConfigs {
1313
/* package */ static final String DART_ENTRYPOINT_META_DATA_KEY = "io.flutter.Entrypoint";
1414
/* package */ static final String DART_ENTRYPOINT_URI_META_DATA_KEY = "io.flutter.EntrypointUri";
1515
/* package */ static final String INITIAL_ROUTE_META_DATA_KEY = "io.flutter.InitialRoute";
16-
/* package */ static final String SPLASH_SCREEN_META_DATA_KEY =
17-
"io.flutter.embedding.android.SplashScreenDrawable";
1816
/* package */ static final String NORMAL_THEME_META_DATA_KEY =
1917
"io.flutter.embedding.android.NormalTheme";
2018
/* package */ static final String HANDLE_DEEPLINKING_META_DATA_KEY =

shell/platform/android/io/flutter/embedding/android/FlutterFragment.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,18 +1447,6 @@ public TransparencyMode getTransparencyMode() {
14471447
return TransparencyMode.valueOf(transparencyModeName);
14481448
}
14491449

1450-
@Override
1451-
@Nullable
1452-
public SplashScreen provideSplashScreen() {
1453-
FragmentActivity parentActivity = getActivity();
1454-
if (parentActivity instanceof SplashScreenProvider) {
1455-
SplashScreenProvider splashScreenProvider = (SplashScreenProvider) parentActivity;
1456-
return splashScreenProvider.provideSplashScreen();
1457-
}
1458-
1459-
return null;
1460-
}
1461-
14621450
/**
14631451
* Hook for subclasses to return a {@link io.flutter.embedding.engine.FlutterEngine} with whatever
14641452
* configuration is desired.

0 commit comments

Comments
 (0)