1、services/core/java/com/android/server/policy/PhoneWindowManager.java
@Override
public boolean canDismissBootAnimation() {
/*synchronized (mLock) {
return mKeyguardDrawComplete;
}*/
return true;
}
2、services/core/java/com/android/server/wm/WindowManagerService.java
// Poll interval in milliseconds for watching boot animation finished.
private static final int BOOT_ANIMATION_POLL_INTERVAL = 200;
private static final int BOOT_ANIMATION_DELAY_INTERVAL = 2000;
if (!mBootAnimationStopped) {
Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0);
// stop boot animation
// formerly we would just kill the process, but we now ask it to exit so it
// can choose where to stop the animation.
SystemProperties.set("service.bootanim.exit", "1");
mBootAnimationStopped = true;
}
修改成:
if(mDelayBootAnimation) {
mDelayBootAnimation = false;
mDelayWaiting = true;
mH.sendEmptyMessageDelayed(H.DELAY_BOOT_ANIMATION_FINISHED,
BOOT_ANIMATION_DELAY_INTERVAL);
} else {
if(mDelayWaiting) return;
if (!mBootAnimationStopped) {
Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0);
// stop boot animation
// formerly we would just kill the process, but we now ask it to exit so it
// can choose where to stop the animation.
Log.d("BootAnimation", "WMS SET service.bootanim.exit to 1");
SystemProperties.set("service.bootanim.exit", "1");
mBootAnimationStopped = true;
}
handleMessage中增加逻辑:
public static final int DELAY_BOOT_ANIMATION_FINISHED = 62;
case DELAY_BOOT_ANIMATION_FINISHED: {
mDelayWaiting = false;
performEnableScreen();
}
break;
3、frameworks\base\cmds\bootanimation\bootanim.rc
service bootanim /system/bin/bootanimation
class core animation
user system
group system audio
disabled
oneshot
writepid /dev/stune/top-app/tasks
修改成:
service bootanim /system/bin/bootanimation
class core animation
user graphics
group graphics audio
oneshot
writepid /dev/stune/top-app/tasks
4、packages\apps\Settings\src/com/android/settings/FallbackHome.java
feat:reduce delay time
private void maybeFinish() {
if (getSystemService(UserManager.class).isUserUnlocked()) {
final Intent homeIntent = new Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME);
final ResolveInfo homeInfo = getPackageManager().resolveActivity(homeIntent, 0);
if (Objects.equals(getPackageName(), homeInfo.activityInfo.packageName)) {
if (UserManager.isSplitSystemUser()
&& UserHandle.myUserId() == UserHandle.USER_SYSTEM) {
// This avoids the situation where the system user has no home activity after
// SUW and this activity continues to throw out warnings. See b/28870689.
return;
}
Log.d(TAG, "User unlocked but no home; let's hope someone enables one soon?");
// mHandler.sendEmptyMessageDelayed(0, 500); modify 500ms to 100ms
mHandler.sendEmptyMessageDelayed(0, 100);
} else {
Log.d(TAG, "User unlocked and real home found; let's go!");
getSystemService(PowerManager.class).userActivity(
SystemClock.uptimeMillis(), false);
finish();
}
}
}
feat: remove fallbackhome anim
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set ourselves totally black before the device is provisioned so that
// we don't flash the wallpaper before SUW
/* mProvisioned = Settings.Global.getInt(getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0) != 0;
if (!mProvisioned) {
setTheme(R.style.FallbackHome_SetupWizard);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
} else {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}*/
registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED));
maybeFinish();
}
@Override
protected void onResume() {
super.onResume();
if (mProvisioned) {
//mHandler.postDelayed(mProgressTimeoutRunnable, PROGRESS_TIMEOUT);
}
}
@Override
protected void onPause() {
super.onPause();
// mHandler.removeCallbacks(mProgressTimeoutRunnable);
}
5、cmds/bootanimation/BootAnimation.cpp
更改开机动画加载的路径:
static const char* bootFiles[] =
{PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE};
static const char* shutdownFiles[] =
{PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE};
modify to:
static const char* bootFiles[] =
{SYSTEM_BOOTANIMATION_FILE, PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE};
static const char* shutdownFiles[] =
{PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE};
6、services/java/com/android/server/SystemServer.java
feat:optimize boot time
private boolean isAndroidAuto = false;
modify to:
private boolean isAndroidAuto = true;