在Android8.1 RK3399 方案中,同时使用了电池和DC 12V供电方式。当插着12V时,开机会有叮咚的提示音,但不插DC12V的时候,开机没有叮咚的提示音,去看提示音资源发现“叮咚”的提示音其实是电池充电的提示音,而且这个提示音的资源文件和无线重点的提示音以一个资源文件:/system/media/audio/ui/WirelessChargingStarted.ogg。
其他的提示音ogg文件资源都放在这个路径中:/system/media/audio/
现在想要做成:不管是否插着DC 12V,系统启动的时候都要有个启动提示音。
diff --git a/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java b/frameworks/base/services/core/
index 69a35fa..35a472e 100644
--- a/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
@@ -243,6 +243,7 @@ public final class PowerManagerService extends SystemService
private SettingsObserver mSettingsObserver;
private DreamManagerInternal mDreamManager;
private Light mAttentionLight;
+ private boolean firstNotifierSound = false;
private final Object mLock = LockGuard.installNewLock(LockGuard.INDEX_POWER);
@@ -1700,6 +1701,14 @@ public final class PowerManagerService extends SystemService
// Because we might release the last suspend blocker here, we need to make sure
// we finished everything else first!
updateSuspendBlockerLocked();
+ if(firstNotifierSound == false){// hongdakang add if(){}
+ firstNotifierSound = true;
+ if(SystemProperties.get("sys.hdk.boot.NotifierSound","off").equals("on")){
+ if(mIsPowered == false){
+ mNotifier.onWirelessChargingStarted();
+ }
+ }
+ }
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
1.添加一个SystemProperties "sys.inno.boot.NotifierSound"用来设置是否需要启动提示音
2.if(mIsPowered == false) :用来判断当前是否插着DC 12V。
如果插着DC 12v就走电池充电提示音流程;如果没有插DC 12V 就主动播一下电池充电提示音做开启声音。