android------bootAnimation
来源:互联网 发布:android源码 编辑:程序博客网 时间:2024/05/22 00:30
首先,从BootAnimation开始分析,BootAnimation在启动脚本init。
- 1.service bootanim /system/bin/bootanimation
- 2. class main
- 3. user graphics
- 4. group system audio graphics cw_access
- 5. disabled
- 6. oneshot
由于这个是disabled的,所以这个会在surfaceFlinger中其中启动他。
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");
int noBootAnimation = atoi(value);
ALOGI_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;
}
- void BootAnimation::onFirstRef() {
- status_t err = mSession->linkToComposerDeath(this);//注册surfaceflinger死亡消息的通知书
- ALOGE_IF(err, "linkToComposerDeath failed (%s) ", strerror(-err));
- if (err == NO_ERROR) {
- run("BootAnimation", PRIORITY_DISPLAY);//开跑
- }
- }
另一个函数run()在BootAnimation的父类Thead里,用来创建一个线程并跑起来
BootAnimation类继承了Threadl类和IBinder::DeathRecipinet类,而DeathRecipinet虚拟继承RefBase,所以会执行onFirstRef
[BootAnimation.h]
class BootAnimation : public Thread, public IBinder::DeathRecipient
{
……
private:
virtual bool threadLoop();
virtual status_t readyToRun();
virtual void onFirstRef();
virtual void binderDied(const wp& who);
……
status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
status_t initTexture(void* buffer, size_t len);
bool android();
bool movie();
void checkExit();
……
}
从代码可以看出,bootanimation的启动是通过new一个BootAnimation。
BootAnimation类继承了Thread类和IBinder::DeathRecipient类,几个override函数的作用如下:
onFirstRef()属于其父类RefBase,该函数在强引用sp新增引用计数時调用,就是当 有sp包装的类初始化的时候调用。
binderDied(),当对象死掉时或者其他情况导致该Binder发生结束了,就会回调binderDied()方法;
readyToRun()定义Thread执行前的初始化工作;
threadLoop()是每个线程类都要实现的,在这里定义thread的执行内容,这个函数如果返回true,则函数会不停地执行threadloop中的内容,如果这个函数返回false,则threadloop中的内容仅仅执行一次线程就会退出;
- 【android】【Bootanimation】Bootanimation---综述
- android------bootAnimation
- 【android】【Bootanimation】Bootanimation---启动和退出
- Android bootanimation 制作过程
- android bootanimation 学习总结
- Android bootanimation制作过程
- android bootanimation.zip
- Android bootanimation 制作过程
- Android bootanimation 制作过程
- android开机动画bootanimation
- Android 开机动画bootanimation
- android开机动画bootanimation
- bootanimation
- bootanimation
- bootanimation
- bootanimation
- Android开机动画bootanimation.zip
- Android开机动画bootanimation.zip
- Unity3D的一些操作技巧
- Javascript grid汇总值
- .NET2.0程序 在.net 4.0 中运行的解决方案
- FZU 1759 Super A^B mod C(数论)
- 腾讯云安装wordpress
- android------bootAnimation
- HDOJ 1232畅通工程
- java时间处理
- android 实现发送短信功能
- Linux 密码验证
- ArrayList之三种迭代方法
- HTML滚动文字代码 marquee标签
- Java包装类(Wrapper)、基本数据类型、String类之间的转换
- 树(理论篇)