您的位置:首页 > 移动开发 > Android开发

android通过设置ctl.start=bootanim无法启动开机画面的问题

2016-08-24 18:32 751 查看
我们看到log出现了:

init: sys_prop: permission denied uid:1003 name:service.bootanim.exit

然后网上就有人说了

1、修改service.bootanim.exit访问权限

2、修改bootanim服务的用户组ID

#define EXIT_PROP_NAME "service.bootanim.exit"
...
...
bool BootAnimation::threadLoop()
{
bool r;
// wait for hardware init complete, then start boot animation
char property[PROPERTY_VALUE_MAX];
int hwInit;

property_get("xxx.hw.init", property, "0");
hwInit = atoi(property);
if (hwInit == 0) {
int exitnow;

property_get(EXIT_PROP_NAME, property, "0");
exitnow = atoi(property);
if (exitnow) {
r = false;
goto exit;
}
return true;
}

if (mVideoAdvert) {
r = videoAdvert();
} else if (mAndroidAnimation) {
r = android();
} else {
r = movie();
}

// wait for hardware init complete, then start boot animation
exit:
// No need to force exit anymore
property_set(EXIT_PROP_NAME, "0");

eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(mDisplay, mContext);
eglDestroySurface(mDisplay, mSurface);
mFlingerSurface.clear();
mFlingerSurfaceControl.clear();
eglTerminate(mDisplay);
IPCThreadState::self()->stopProcess();
return r;
}


第1种改法就是歪打正着。本来已经定义了service. 属性组属于AID_SYSTEM了,你把一个特例service.bootanim.改成了AID_GRAPHICS,然后导致了开机完成后无法设置service.bootanim.exit属性,从而每次判断该属性的值都为0,所以可以播放开机动画。

第2种改法太过于暴力,明明属于graphics id,强制改成system id,总之不好。

另一种解决办法就是在设置clt.start=bootanim之前,把service.bootanim.exit标志设为0,然后再ctl.stop=bootanim的时候把service.bootanim.exit恢复为1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  bootanim android