Delay boot time. To avoid the inexplicable white screen after the first boot.

Delay boot time:

frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java

In private void performEnableScreen() { method

is having a

if (!mBootAnimationStopped) {

source code is executed

SystemProperties.set("service.bootanim.exit","1");

mBootAnimationStopped = true;

It is to tell the system that the boot animation is loaded

let's make a delay here

mH.postDelayed(
                    new Runnable() {
                        @Override
                            public void run() {
                           SystemProperties.set("service.bootanim.exit", "1");
                           mBootAnimationStopped = true;
                        }
                    },2000);

The mH of the handler used is the source code

To avoid the inexplicable white screen after the first flashing and starting:

Optimal solution:

packages/apps/Provision/AndroidManifest.xml

Just one <activityandroid:name="DefaultActivity"

Add attributes:

android:directBootAware="true"

After FallbackHome starts, it needs to receive the user's cancellation of the unlock broadcast before finishing itself and starting the next homeActivity, which causes a white screen to flash. Therefore, open the directBootAware attribute of Provision so that it can be started directly.

After joining, the first time you swipe to open it, a reading bar will appear: your phone is starting

Provision is a boot wizard application, and this application is prior to the launcher. The white screen pulled out is probably the DefaultActivity

source code

public class DefaultActivity extends Activity {
 
    @Override
    protected voidonCreate(Bundle icicle) {
       super.onCreate(icicle);
 
        // Add apersistent setting to allow other apps to know the device has been provisioned.
       Settings.Global.putInt(getContentResolver(),Settings.Global.DEVICE_PROVISIONED, 1);
       Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE,1);
 
        // remove thisactivity from the package manager.
        PackageManagerpm = getPackageManager();
        ComponentNamename = new ComponentName(this, DefaultActivity.class);
       pm.setComponentEnabledSetting(name,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
               PackageManager.DONT_KILL_APP);
        // terminatethe activity.
        finish();
    }
}

Otherwise, just override this application directly, don’t want it

Guess you like

Origin blog.csdn.net/youthking1314/article/details/128913764