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

我们看到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

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值