/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.window;
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.annotation.ColorInt;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import com.android.internal.R;
import com.android.internal.policy.DecorView;
import java.util.function.Consumer;
/**
*
The view which allows an activity to customize its splash screen exit animation.
*
* Activities will receive this view as a parameter of
* {@link SplashScreen.OnExitAnimationListener#onSplashScreenExit} if
* they set {@link SplashScreen#setOnExitAnimationListener}.
* When this callback is called, this view will be on top of the activity.
*
* This view is composed of a view containing the splashscreen icon (see
* windowSplashscreenAnimatedIcon) and a background.
* Developers can use {@link #getIconView} to get this view and replace the drawable or
* add animation to it. The background of this view is filled with a single color, which can be
* edited during the animation by {@link View#setBackground} or {@link View#setBackgroundColor}.
*
* @see SplashScreen
*/
public final class SplashScreenView extends FrameLayout {
private static final String TAG = SplashScreenView.class.getSimpleName();
private static final boolean DEBUG = false;
private boolean mNotCopyable;
private int mInitBackgroundColor;
private View mIconView;
private Bitmap mParceledIconBitmap;
private View mBrandingImageView;
private Bitmap mParceledBrandingBitmap;
private long mIconAnimationDuration;
private long mIconAnimationStart;
private Animatable mAnimatableIcon;
private ValueAnimator mAnimator;
private Runnable mAnimationFinishListener;
private Consumer