[DESCRIPTION]
现象:L版本开机时,kernel logo与开机动画之间闪一帧黑屏。
[SOLUTION]
1. 这个现象是因为,在BootAnimation开始绘图之前,会先做一次clear screen的动作,避免出现
前面的图干扰到BootAnimation的显示。这是Google default design,虽然不可避免,但是可以优
化。
优化方法:
通过check main_log先确认播放开机动画是哪个function,在对应function删除clear screen的动
作的对应代码。
/php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/base/cmds/bootanimation/BootAnimation.cpp
450bool BootAnimation::android()
451{
452 initTexture(&mAndroid[0], mAssets, "images/android-logo-mask.png");
453 initTexture(&mAndroid[1], mAssets, "images/android-logo-shine.png");
454
/*----------------------------删除clear screen对应code--------------------
-----*/
455 // clear screen
456 glShadeModel(GL_FLAT);
457 glDisable(GL_DITHER);
458 glDisable(GL_SCISSOR_TEST);
459 glClearColor(0,0,0,1);
460 glClear(GL_COLOR_BUFFER_BIT);
461 eglSwapBuffers(mDisplay, mSurface);
/*----------------------------删除clear screen对应code--------------------
-----*/
462
463 glEnable(GL_TEXTURE_2D);
464 gLTExEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
594bool BootAnimation::movie()
/*----------------------------删除clear screen对应code--------------------
-----*/
700 // clear screen
701 glShadeModel(GL_FLAT);
702 glDisable(GL_DITHER);
703 glDisable(GL_SCISSOR_TEST);
704 glDisable(GL_BLEND);
705 glClearColor(0,0,0,1);
706 glClear(GL_COLOR_BUFFER_BIT);
707
708 eglSwapBuffers(mDisplay, mSurface);
709
/*----------------------------删除clear screen对应code--------------------
-----*/
1128bool BootAnimation::mtkmovie()
/*----------------------------删除clear screen对应code--------------------
-----*/
1222 // clear screen
1223 glDisable(GL_DITHER);
1224 glDisable(GL_SCISSOR_TEST);
1225 glDisable(GL_BLEND);
1226 glClear(GL_COLOR_BUFFER_BIT);
1227
1228 eglSwapBuffers(mDisplay, mSurface);
/*----------------------------删除clear screen对应code--------------------
-----*/
2.还有,在initAudioPath() function中,两个while循环可能耗时导致黑屏。
820char* BootAnimation::initAudioPath() {
835 while (strcmp(type, "-1") == 0 &&
836 strcmp(crypto_state, "unencrypted") != 0 &&
837 deal_with_encryption == true){
838 usleep(100000);
839 property_get("ro.crypto.state", crypto_state, "-1");
840 property_get("vold.encryption.type", type, "-1");
841 }
842
843 while (strcmp(type, "default") == 0 && deal_with_encryption == true){
844 property_get("vold.decrypt", status, "-1");
845 if (strcmp(status, "trigger_restart_framework") != 0){
846 usleep(100000);
847 XLOGD("[BootAnimation %s %d]Decrypt
status=%s",__FUNCTION__,__LINE__,status);
848 continue;
849 }
850 property_get("persist.sys.mute.state", volume, "-1");
851 int nVolume = -1;
852 nVolume = atoi(volume);
853 XLOGD("[BootAnimation %s
%d]nVolume=%d",__FUNCTION__,__LINE__,nVolume);
854 if(nVolume == 0 || nVolume == 1){
855 XLOGD("initAudioPath: DON'T PLAY AUDIO!");
856 return NULL;
857 }
858 break;
859 }
来源:一牛网论坛