The function realization of Android 11.0 system shutdown animation

1 Introduction


  In the customized development of the system rom of System 11.0, there is a boot animation function by default in the native system, but the function of the system shutdown animation is not perfect. If only the shutdown animation is built in, you will find that the shutdown animation has not finished playing before it shuts down
. Therefore, it is necessary to wait until the shutdown animation is finished before performing the shutdown action after the system is shut down. Next, we will analyze the shutdown process, and then implement this function.

2. The core class for realizing the function of system shutdown animation

frameworks/base/cmds/bootanimation/BootAnimation.cpp
frameworks/base/services/core/java/com/android/server/power/ShutdownThread.java

3. Realization and analysis of the core functions of the function realization of the system shutdown animation
3.1 Add the shutdown animation class ShutdownAnimation.java

package com.android.server.power;

import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.view.IWindowManager;
import android.util.Slog;
import java.io.File;

/** {@hide} */
public class ShutdownAnimation {
    private static final String TAG = "ShutdownAnimation";
    private static final int BOOT_ANIMATION_CHECK_SPAN = 200;
    private static final int MAX_BOOTANI

Guess you like

Origin blog.csdn.net/baidu_41666295/article/details/130066853