Merge "Fix splashscreen listener not being called" into tm-dev
This commit is contained in:
@@ -237,7 +237,6 @@ public final class SplashScreenView extends FrameLayout {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Runnable that can receive the task which should be executed on UI thread.
|
* Set the Runnable that can receive the task which should be executed on UI thread.
|
||||||
* @param uiThreadInitTask
|
|
||||||
*/
|
*/
|
||||||
public Builder setUiThreadInitConsumer(Consumer<Runnable> uiThreadInitTask) {
|
public Builder setUiThreadInitConsumer(Consumer<Runnable> uiThreadInitTask) {
|
||||||
mUiThreadInitTask = uiThreadInitTask;
|
mUiThreadInitTask = uiThreadInitTask;
|
||||||
@@ -281,9 +280,11 @@ public final class SplashScreenView extends FrameLayout {
|
|||||||
|
|
||||||
view.mBrandingImageView = view.findViewById(R.id.splashscreen_branding_view);
|
view.mBrandingImageView = view.findViewById(R.id.splashscreen_branding_view);
|
||||||
|
|
||||||
|
boolean hasIcon = false;
|
||||||
// center icon
|
// center icon
|
||||||
if (mIconDrawable instanceof SplashScreenView.IconAnimateListener
|
if (mIconDrawable instanceof SplashScreenView.IconAnimateListener
|
||||||
|| mSurfacePackage != null) {
|
|| mSurfacePackage != null) {
|
||||||
|
hasIcon = true;
|
||||||
if (mUiThreadInitTask != null) {
|
if (mUiThreadInitTask != null) {
|
||||||
mUiThreadInitTask.accept(() -> view.mIconView = createSurfaceView(view));
|
mUiThreadInitTask.accept(() -> view.mIconView = createSurfaceView(view));
|
||||||
} else {
|
} else {
|
||||||
@@ -306,9 +307,10 @@ public final class SplashScreenView extends FrameLayout {
|
|||||||
if (mIconBackground != null) {
|
if (mIconBackground != null) {
|
||||||
imageView.setBackground(mIconBackground);
|
imageView.setBackground(mIconBackground);
|
||||||
}
|
}
|
||||||
|
hasIcon = true;
|
||||||
view.mIconView = imageView;
|
view.mIconView = imageView;
|
||||||
}
|
}
|
||||||
if (mOverlayDrawable != null || (view.mIconView == null && !mAllowHandleSolidColor)) {
|
if (mOverlayDrawable != null || (!hasIcon && !mAllowHandleSolidColor)) {
|
||||||
view.setNotCopyable();
|
view.setNotCopyable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,11 @@ public final class StartingWindowInfo implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public static final int TYPE_PARAMETER_ACTIVITY_DRAWN = 0x00000040;
|
public static final int TYPE_PARAMETER_ACTIVITY_DRAWN = 0x00000040;
|
||||||
/**
|
/**
|
||||||
* Application is allowed to handle solid color splash screen.
|
* Application will receive the
|
||||||
|
* {@link
|
||||||
|
* android.window.SplashScreen.OnExitAnimationListener#onSplashScreenExit(SplashScreenView)}
|
||||||
|
* callback, even when the splash screen only shows a solid color.
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN = 0x00000080;
|
public static final int TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN = 0x00000080;
|
||||||
|
|||||||
@@ -363,6 +363,7 @@ public class SplashscreenContentDrawer {
|
|||||||
private Drawable[] mFinalIconDrawables;
|
private Drawable[] mFinalIconDrawables;
|
||||||
private int mFinalIconSize = mIconSize;
|
private int mFinalIconSize = mIconSize;
|
||||||
private Consumer<Runnable> mUiThreadInitTask;
|
private Consumer<Runnable> mUiThreadInitTask;
|
||||||
|
/** @see #setAllowHandleSolidColor(boolean) **/
|
||||||
private boolean mAllowHandleSolidColor;
|
private boolean mAllowHandleSolidColor;
|
||||||
|
|
||||||
StartingWindowViewBuilder(@NonNull Context context, @NonNull ActivityInfo aInfo) {
|
StartingWindowViewBuilder(@NonNull Context context, @NonNull ActivityInfo aInfo) {
|
||||||
@@ -390,6 +391,12 @@ public class SplashscreenContentDrawer {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the application will receive a the
|
||||||
|
* {@link
|
||||||
|
* android.window.SplashScreen.OnExitAnimationListener#onSplashScreenExit(SplashScreenView)}
|
||||||
|
* callback, effectively copying the {@link SplashScreenView} into the client process.
|
||||||
|
*/
|
||||||
StartingWindowViewBuilder setAllowHandleSolidColor(boolean allowHandleSolidColor) {
|
StartingWindowViewBuilder setAllowHandleSolidColor(boolean allowHandleSolidColor) {
|
||||||
mAllowHandleSolidColor = allowHandleSolidColor;
|
mAllowHandleSolidColor = allowHandleSolidColor;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import android.compat.annotation.EnabledSince;
|
|||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
import android.window.SplashScreenView;
|
||||||
import android.window.TaskSnapshot;
|
import android.window.TaskSnapshot;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -51,8 +52,10 @@ public class StartingSurfaceController {
|
|||||||
private static final String TAG = TAG_WITH_CLASS_NAME
|
private static final String TAG = TAG_WITH_CLASS_NAME
|
||||||
? StartingSurfaceController.class.getSimpleName() : TAG_WM;
|
? StartingSurfaceController.class.getSimpleName() : TAG_WM;
|
||||||
/**
|
/**
|
||||||
* Allow the solid color style splash screen view can be copy and transfer to another process if
|
* Application is allowed to receive the
|
||||||
* the app targeting to {@link android.os.Build.VERSION_CODES#TIRAMISU} or higher.
|
* {@link
|
||||||
|
* android.window.SplashScreen.OnExitAnimationListener#onSplashScreenExit(SplashScreenView)}
|
||||||
|
* callback, even when the splash screen only shows a solid color.
|
||||||
*/
|
*/
|
||||||
@ChangeId
|
@ChangeId
|
||||||
@EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.TIRAMISU)
|
@EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.TIRAMISU)
|
||||||
|
|||||||
Reference in New Issue
Block a user