summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityThread.java2
-rw-r--r--core/java/android/window/SplashScreenView.java73
2 files changed, 3 insertions, 72 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 852dd974ae42..7d68eb92f206 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4114,8 +4114,8 @@ public final class ActivityThread extends ClientTransactionHandler
@NonNull SurfaceControl startingWindowLeash) {
final SplashScreenView.Builder builder = new SplashScreenView.Builder(r.activity);
final SplashScreenView view = builder.createFromParcel(parcelable).build();
+ view.attachHostWindow(r.window);
decorView.addView(view);
- view.attachHostActivityAndSetSystemUIColors(r.activity, r.window);
view.requestLayout();
view.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() {
diff --git a/core/java/android/window/SplashScreenView.java b/core/java/android/window/SplashScreenView.java
index 2d1deb2a57bb..bc9f74ecec99 100644
--- a/core/java/android/window/SplashScreenView.java
+++ b/core/java/android/window/SplashScreenView.java
@@ -16,9 +16,6 @@
package android.window;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
-import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
-import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
-import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLASHSCREEN_AVD;
@@ -29,11 +26,9 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.annotation.UiThread;
-import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
@@ -52,15 +47,12 @@ import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
-import android.view.WindowInsetsController;
-import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.android.internal.R;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.internal.policy.DecorView;
-import com.android.internal.util.ContrastColorUtil;
import java.time.Duration;
import java.time.Instant;
@@ -87,12 +79,6 @@ public final class SplashScreenView extends FrameLayout {
private static final String TAG = SplashScreenView.class.getSimpleName();
private static final boolean DEBUG = Build.IS_DEBUGGABLE;
- private static final int LIGHT_BARS_MASK =
- WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
- | WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
- private static final int WINDOW_FLAG_MASK = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
- | FLAG_TRANSLUCENT_NAVIGATION | FLAG_TRANSLUCENT_STATUS;
-
private boolean mNotCopyable;
private boolean mIsCopied;
private int mInitBackgroundColor;
@@ -107,9 +93,6 @@ public final class SplashScreenView extends FrameLayout {
private final Rect mTmpRect = new Rect();
private final int[] mTmpPos = new int[2];
- // The host activity when transfer view to it.
- private Activity mHostActivity;
-
@Nullable
private SurfaceControlViewHost.SurfacePackage mSurfacePackageCopy;
@Nullable
@@ -123,14 +106,7 @@ public final class SplashScreenView extends FrameLayout {
// cache original window and status
private Window mWindow;
- private int mAppWindowFlags;
- private int mStatusBarColor;
- private int mNavigationBarColor;
- private int mSystemBarsAppearance;
private boolean mHasRemoved;
- private boolean mNavigationContrastEnforced;
- private boolean mStatusContrastEnforced;
- private boolean mDecorFitsSystemWindows;
/**
* Internal builder to create a SplashScreenView object.
@@ -570,7 +546,6 @@ public final class SplashScreenView extends FrameLayout {
if (decorView != null) {
decorView.removeView(this);
}
- restoreSystemUIColors();
mWindow = null;
}
mHasRemoved = true;
@@ -651,56 +626,12 @@ public final class SplashScreenView extends FrameLayout {
}
/**
- * Called when this view is attached to an activity. This also makes SystemUI colors
- * transparent so the content of splash screen view can draw fully.
+ * Called when this view is attached to a window of an activity.
*
* @hide
*/
- public void attachHostActivityAndSetSystemUIColors(Activity activity, Window window) {
- mHostActivity = activity;
+ public void attachHostWindow(Window window) {
mWindow = window;
- final WindowManager.LayoutParams attr = window.getAttributes();
- mAppWindowFlags = attr.flags;
- mStatusBarColor = window.getStatusBarColor();
- mNavigationBarColor = window.getNavigationBarColor();
- mSystemBarsAppearance = window.getInsetsController().getSystemBarsAppearance();
- mNavigationContrastEnforced = window.isNavigationBarContrastEnforced();
- mStatusContrastEnforced = window.isStatusBarContrastEnforced();
- mDecorFitsSystemWindows = window.decorFitsSystemWindows();
-
- applySystemBarsContrastColor(window.getInsetsController(), mInitBackgroundColor);
- // Let app draw the background of bars.
- window.addFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- // Use specified bar colors instead of window background.
- window.clearFlags(FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION);
- window.setStatusBarColor(Color.TRANSPARENT);
- window.setNavigationBarColor(Color.TRANSPARENT);
- window.setDecorFitsSystemWindows(false);
- window.setStatusBarContrastEnforced(false);
- window.setNavigationBarContrastEnforced(false);
- }
-
- /** Called when this view is removed from the host activity. */
- private void restoreSystemUIColors() {
- mWindow.setFlags(mAppWindowFlags, WINDOW_FLAG_MASK);
- mWindow.setStatusBarColor(mStatusBarColor);
- mWindow.setNavigationBarColor(mNavigationBarColor);
- mWindow.getInsetsController().setSystemBarsAppearance(mSystemBarsAppearance,
- LIGHT_BARS_MASK);
- mWindow.setDecorFitsSystemWindows(mDecorFitsSystemWindows);
- mWindow.setStatusBarContrastEnforced(mStatusContrastEnforced);
- mWindow.setNavigationBarContrastEnforced(mNavigationContrastEnforced);
- }
-
- /**
- * Makes the icon color of system bars contrast.
- * @hide
- */
- public static void applySystemBarsContrastColor(WindowInsetsController windowInsetsController,
- int backgroundColor) {
- final int lightBarAppearance = ContrastColorUtil.isColorLight(backgroundColor)
- ? LIGHT_BARS_MASK : 0;
- windowInsetsController.setSystemBarsAppearance(lightBarAppearance, LIGHT_BARS_MASK);
}
/**