当前位置:操作系统 > 安卓/Android >>

Android培训班(37)

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->

在init.rc文件里,可以看到加载下面的服务:

service bootanim /system/bin/bootanimation

user graphics

group graphics

disabled

oneshot

bootanimation 服务的代码在目录:

Android-2.0/frameworks/base/cmds/bootanimation

 

bootanimation 服务是开机动画,主要用来加载动画资源。

它的主要入口函数代码如下:

int main(int argc, char** argv)

{

#if defined(HAVE_PTHREADS)

setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);

#endif

这段代码设置进程的优先级。

 

char value[PROPERTY_VALUE_MAX];

property_get("debug.sf.nobootanimation", value, "0");

这行代码从属性里获取是否显示开机动画,如果为1就不显示。

 

int noBootAnimation = atoi(value);

LOGI_IF(noBootAnimation, "boot animation disabled");

if (!noBootAnimation) {

这段代码判断是否显示开机动画。

 

sp<ProcessState> proc(ProcessState::self());

ProcessState::self()->startThreadPool();

启动开机动画的线程。

 

// create the boot animation object

sp<BootAnimation> boot = new BootAnimation();

创建开机动画对象。

 

 

IPCThreadState::self()->joinThreadPool();

运行开机动画线程。

 

 

}

return 0;

}

补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,