当前位置: 首页 > news >正文

安阳网站建设公司加强服务保障满足群众急需i

安阳网站建设公司,加强服务保障满足群众急需i,成都网站推广营销微信,WordPress侧边栏跟随需求:在11.0在定制化系统中,默认是没有开机铃声的,有客户提出需要要添加开机铃声,所以为了完成需求,就来实现这一个功能关于开机铃声 都是在bootanimation_main.cpp 这里面负责管理。添加添加开机铃声的核心类framewor…

需求:在11.0在定制化系统中,默认是没有开机铃声的,有客户提出需要要添加开机铃声,所以为了完成需求,就来实现这一个功能关于开机铃声 都是在bootanimation_main.cpp 这里面负责管理。

  1. 添加添加开机铃声的核心类

frameworks\base\cmds\bootanimation\bootanimation_main.cpp
frameworks\base\cmds\bootanimation\BootAnimation.cpp
  1. 添加开机铃声的核心功能分析和实现

2.1 bootanimation_main.cpp开机动画处理分析

frameworks\base\cmds\bootanimation\bootanimation_main.cpp
int main()
{
setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
bool noBootAnimation = bootAnimationDisabled();
ALOGI_IF(noBootAnimation,  "boot animation disabled");
if (!noBootAnimation) {sp<ProcessState> proc(ProcessState::self());ProcessState::self()->startThreadPool();// create the boot animation object (may take up to 200ms for 2MB zip)#ifdef BOOTANIMATION_EXT
sp<BootAnimation> boot = new BootAnimation(audioplay::createAnimationCallbacks(),true);
#else
sp<BootAnimation> boot = new BootAnimation(audioplay::createAnimationCallbacks());
#endif
waitForSurfaceFlinger();boot->run("BootAnimation", PRIORITY_DISPLAY);ALOGV("Boot animation set up. Joining pool.");IPCThreadState::self()->joinThreadPool();
}
return 0;}

从代码中可以看到 是由BootAnimation来处理 开机铃声

frameworks\base\cmds\bootanimation\BootAnimation.cpp

static const char OEM_BOOTSOUND_FILE[] = "/oem/media/bootsound.mp3";
static const char PRODUCT_BOOTSOUND_FILE[] = "/product/media/bootsound.mp3";
static const char SYSTEM_BOOTSOUND_FILE[] = "/system/media/bootsound.mp3";
static const char OEM_SHUTDOWNSOUND_FILE[] = "/oem/media/shutdownsound.mp3";
static const char PRODUCT_SHUTDOWNSOUND_FILE[] = "/product/media/shutdownsound.mp3";
static const char SYSTEM_SHUTDOWNSOUND_FILE[] = "/system/media/shutdownsound.mp3";
void BootAnimation::findBootAnimationFile() {
// If the device has encryption turned on or is in process
// of being encrypted we show the encrypted boot animation.
char decrypt[PROPERTY_VALUE_MAX];
property_get("vold.decrypt", decrypt, "");
bool encryptedAnimation = atoi(decrypt) != 0 ||!strcmp("trigger_restart_min_framework", decrypt);if (!mShuttingDown && encryptedAnimation) {static const char* encryptedBootFiles[] ={PRODUCT_ENCRYPTED_BOOTANIMATION_FILE, SYSTEM_ENCRYPTED_BOOTANIMATION_FILE};for (const char* f : encryptedBootFiles) {if (access(f, R_OK) == 0) {mZipFileName = f;return;}}
}const bool playDarkAnim = android::base::GetIntProperty("ro.boot.theme", 0) == 1;
static const char* bootFiles[] ={APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE,OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE};
static const char* shutdownFiles[] ={PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE, ""};for (const char* f : (!mShuttingDown ? bootFiles : shutdownFiles)) {if (access(f, R_OK) == 0) {mZipFileName = f;#ifdef BOOTANIMATION_EXT
break;
#else
return;
#endif
}
}
#ifdef BOOTANIMATION_EXT
static const char* bootSoundFiles[] =
{PRODUCT_BOOTSOUND_FILE, OEM_BOOTSOUND_FILE, SYSTEM_BOOTSOUND_FILE};
static const char* shutdownSoundFiles[] =
{PRODUCT_SHUTDOWNSOUND_FILE, OEM_SHUTDOWNSOUND_FILE, SYSTEM_SHUTDOWNSOUND_FILE};
for (const char* f : (!mShuttingDown ? bootSoundFiles : shutdownSoundFiles)) {
if (access(f, R_OK) == 0) {
mSoundFileName = f;
SLOGD("mSoundFileName string is %s,length is %zu",mSoundFileName.string(),mSoundFileName.length());
return;
}
}
SLOGD("set mSoundFileName null");
mSoundFileName = "";
#endif
return;}

获取播放开机音乐路径:PRODUCT_BOOTSOUND_FILE, OEM_BOOTSOUND_FILE, SYSTEM_BOOTSOUND_FILE 中的一个

所以系统默认的路径为SYSTEM_BOOTSOUND_FILE 即为 /system/media/bootsound.mp3

也就是说和开机动画放在同一个目录就可

persist.sys.bootanim.play_sound 属性的设置

static const char PLAY_SOUND_PROP_NAME[] = "persist.sys.bootanim.play_sound";
bool BootAnimation::playSoundsAllowed() {
// Compatible with Android Things
// only system called will play sounds in system/media/
if (!mSystemCalled) {
return false;
}
// Read the system property to see if we should play the sound.
// If it's not present, default to allowed.
if (!property_get_bool(PLAY_SOUND_PROP_NAME, 1)) {return false;
}// Don't play sounds if this is a reboot due to an error.
char bootreason[PROPERTY_VALUE_MAX];
if (property_get(BOOTREASON_PROP_NAME, bootreason, nullptr) > 0) {for (const auto& str : PLAY_SOUND_BOOTREASON_BLACKLIST) {if (strcasecmp(str.c_str(), bootreason) == 0) {return false;}}
}
return true;}

是否允许播放中 会判断persist.sys.bootanim.play_sound 是否为1 如果不能播放 请查看这个值是否为1

开机铃声添加路径为:

路径:device/sprd/common/customer/system/media/bootsound.mp3

和开机动画放在同一个目录下就可以了

http://www.mnyf.cn/news/53682.html

相关文章:

  • 个网站做淘宝客推广可以吗怎么做关键词排名靠前
  • 网站开发兼容极速字体颜色推荐360推广和百度推广哪个好
  • 网站做优化有用吗如何做营销推广
  • 大作设计网站官网登录入口临沂百度代理公司有几个
  • 网站正在建设中是什么意思找小网站的关键词
  • 做兼职什么网站比较好百度发布信息的免费平台
  • 做网站登录网络营销型网站
  • 建设厅网站的投诉可以哪里查网络优化有前途吗
  • 网络设计方案的重要性seo推广方式是什么呢
  • 工业软件开发技术搜索引擎的优化方法
  • 美国做调研的网站恶意点击广告软件
  • 松江做网站需要多少钱百度在线客服
  • 网站编程培训班seo搜索优化 指数
  • 厦门高端模板建站北京正规seo搜索引擎优化价格
  • 宜昌营销网站建设安徽网站设计
  • 东莞营销商城网站建设百度官网平台
  • css3效果网站网站seo优化总结
  • 彩妆做推广的网站网络广告设计
  • 百度开户做网站2400上海百度推广方案
  • 大兴网站开发网站建设价格市场营销策划书范文5篇精选
  • 程序员做情侣网站全球新闻最新消息
  • 重庆博达建设集团股份有限公司网站2024年2月疫情又开始了吗
  • 做网站必须有云虚拟主机优化营商环境发言材料
  • 赣州网站制作培训太原高级seo主管
  • 网站开发沟通长春网络推广公司哪个好
  • 天津网站建设公司推荐今日网站收录查询
  • 德惠网站建设苏州网站建设书生商友
  • 青岛seo推广公司seo对各类网站的作用
  • 菲律宾菠菜网站建设做一个个人网站
  • 网站的方案东莞搜索seo网站关键词优化