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

android11为开机动画添加铃声(语音)

一、碰到的问题

1、第一次开机无铃声

2、开机时铃声和动画不同步,开头的铃声会丢失

3、开机时铃声/动画不能完全播放完

二、解决

以下为添加的patch

/开机铃声不同步,语音第一段无声
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index b816042b75..2605df5afb 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -2811,7 +2811,7 @@ MediaPlayerService::BatteryTracker::BatteryTracker() {// reset battery stats// if the mediaserver has crashed, battery stats could be left// in bad state, reset the state upon service start.
-    BatteryNotifier::getInstance().noteResetVideo();
+//    BatteryNotifier::getInstance().noteResetVideo();}void MediaPlayerService::BatteryTracker::addBatteryData(uint32_t params)
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 764fdc33c0..66729b88f6 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -186,7 +186,8 @@ AudioFlinger::AudioFlinger()mGlobalEffectEnableTime(0),mPatchPanel(this),mDeviceEffectManager(this),
-      mSystemReady(false)
+//      mSystemReady(false)
+      mSystemReady(true){// unsigned instead of audio_unique_id_use_t, because ++ operator is unavailable for enumfor (unsigned use = AUDIO_UNIQUE_ID_USE_UNSPECIFIED; use < AUDIO_UNIQUE_ID_USE_MAX; use++) {
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 10404285a9..6ab56e0fd5 100755
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -580,11 +580,11 @@ status_t AudioFlinger::ThreadBase::sendConfigEvent_l(sp<ConfigEvent>& event){status_t status = NO_ERROR;-    if (event->mRequiresSystemReady && !mSystemReady) {
+/*    if (event->mRequiresSystemReady && !mSystemReady) {event->mWaitStatus = false;mPendingConfigEvents.add(event);return status;
-    }
+    }	*/mConfigEvents.add(event);ALOGV("sendConfigEvent_l() num events %zu event %d", mConfigEvents.size(), event->mType);mWaitWorkCV.signal();
@@ -1021,7 +1021,8 @@ void AudioFlinger::ThreadBase::releaseWakeLock_l()}void AudioFlinger::ThreadBase::getPowerManager_l() {
-    if (mSystemReady && mPowerManager == 0) {
+//    if (mSystemReady && mPowerManager == 0) {
+    if (mSystemReady == 0) {// use checkService() to avoid blocking if power service is not up yetsp<IBinder> binder =defaultServiceManager()->checkService(String16("power"));
@@ -3090,6 +3091,9 @@ ssize_t AudioFlinger::PlaybackThread::threadLoop_write()ssize_t bytesWritten;const size_t offset = mCurrentWriteLength - mBytesRemaining;+    if (mPowerManager == 0)
+	    acquireWakeLock();
+// If an NBAIO sink is present, use it to write the normal mixer's submixif (mNormalSink != 0) {
//初次开机无铃声
@@ -5241,6 +5245,15 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTractrack->mHasVolumeController = false;}+	    /*wmc modify start */
+            char mvalue[PROPERTY_VALUE_MAX] = { 1 };
+            property_get("service.bootanim.exit", mvalue, "");
+            if (strcmp(mvalue,"0") == 0){
+                vlf = 0.25f;
+                vrf = 0.25f;
+            }
+            /*wmc modify end */
+// XXX: these things DON'T need to be done each timemAudioMixer->setBufferProvider(trackId, track);mAudioMixer->enable(trackId);
//加了开机铃声,开机动画不能播放完
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 6ee60273264c..1aac6251061d 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -3455,8 +3455,10 @@ public class WindowManagerService extends IWindowManager.Stub// stop boot animation// formerly we would just kill the process, but we now ask it to exit so it// can choose where to stop the animation.
-                SystemProperties.set("service.bootanim.exit", "1");
-                mBootAnimationStopped = true;
+//                SystemProperties.set("service.bootanim.exit", "1");
+//                mBootAnimationStopped = true;
+                SystemProperties.set("service.bootanim.exit", "0");
+                mBootAnimationStopped = false;}if (!mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) {

还有,我将bootanimation.zip文件的desc.txt进行了修改,这里添加了延时100ms,如下:

1280 800 20        //宽          高          帧数
p 1 0 part0        //标志性符  循环次数(0表示无限循环)  阶段切换间隔时间  对应目录名
p 0 100 part1

注意,这里的铃声/语音的格式需要为wav,这个音频文件需要和part0的文件一起打包,或者单独建一个part文件,和所需要的图片打包成bootanimation.zip,格式为存储。

http://www.lryc.cn/news/399030.html

相关文章:

  • 使用 Akshare 下载国内的期货(主力连续)、股票和指数的历史行情数据
  • 【React】Google 账号之个性化一键登录按钮功能
  • MySQL已经连接对应数据库,但mapper中表名仍报错
  • CentOS 7:停止更新后如何下载软件?
  • MySQL GROUP_CONCAT 函数详解与实战应用
  • MATLAB Gazebo联合仿真
  • Vue3 pdf.js将二进制文件流转成pdf预览
  • 【机器学习】逻辑回归的原理、应用与扩展
  • Ubuntu22.04系统装好后左上角下划线闪烁不开机(N卡)
  • Leetcode刷题4--- 寻找两个正序数组的中位数 Python
  • springBoot(若依)集成camunda
  • 【微信小程序知识点】自定义构建npm
  • JCR一区 | Matlab实现GAF-PCNN-MATT、GASF-CNN、GADF-CNN的多特征输入数据分类预测/故障诊断
  • 新手教学系列——高效管理MongoDB数据:批量插入与更新的实战技巧
  • C# Winform 自定义事件实战
  • Python通过继承实现多线程
  • 记一次项目经历
  • Elasticsearch 8 支持别名查询
  • 【Spring Cloud】 使用Eureka实现服务注册与服务发现
  • JDK安装详细教程(以JDK17为例)
  • 安装nodejs | npm报错
  • 聊点基础---Java和.NET开发技术异同全方位分析
  • 【C++】C++中SDKDDKVer.h和WinSDKVer.h函数库详解
  • uni-app 蓝牙传输
  • MBR10200CT-ASEMI智能AI应用MBR10200CT
  • 力扣 爬楼梯
  • java设计模式之:策略模式+工厂模式整合案例实战(一)
  • 国内Ubuntu安装 stable-diffusion教程,换成国内镜像
  • JAVA final详细介绍
  • 45、tomcat+课后实验