开机动画只显示一半
现象:
横向某半边屏幕不显示或纵向某半边不显示
可能的原因:
system.prop 中添加 “ro.sf.hwrotation=90”属性,造成开机动画只显示一半。
由于属性 build.prop 中设置 ro.sf.hwrotation = 90,造成开机动画翻转,
解决方案:
需在播放动画时手动翻转回来。session()在本文件中,获得SurfaceComposerClient对象,
调用其setDisplayProjection()方法设置显示宽高和翻转角度
修改文件 frameworks/base/cmds/bootanimation/BootAnimation.cpp
status_t BootAnimation::readyToRun() {
...
// create the native surface
sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"),
dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
// 此处添加
// 新增的
char property[PROPERTY_VALUE_MAX];
if (property_get("ro.sf.hwrotation",property,NULL) > 0) {
if (atoi(property) == 90) {
session()->setDisplayProjection(dtoken,0,
Rect(dinfo.w,dinfo.h),Rect(dinfo.w,dinfo.h)); // 其中参数0表示旋转角度为0度。(0度:854x480; 90度:480x854)
}
}