frameworks/base/services/core/java/com/android/server/audio/AudioService.java
public void mute(boolean state) {
boolean changed = false;
synchronized (VolumeStreamState.class) {
if (state != mIsMuted) {
changed = true;
mIsMuted = state;
// Set the new mute volume. This propagates the values to
// the audio system, otherwise the volume won't be changed
// at the lower level.
sendMsg(mAudioHandler,
MSG_SET_ALL_VOLUMES,
SENDMSG_QUEUE,
0,
0,
this, 0);
}
}
if (changed) {
// Stream mute changed, fire the intent.
Intent intent = new Intent(AudioManager.STREAM_MUTE_CHANGED_ACTION);
intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType);
intent.putExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, state);
sendBroadcastToAll(intent);
//UNISOC bug1169215 use property to tell the bootanimation
if (mStreamType == AudioSystem.STREAM_SYSTEM) {
if (state) {
SystemProperties.set(PROPERTY_BOOT_SOUNDS, "0");
} else {
SystemProperties.set(PROPERTY_BOOT_SOUNDS, "1"); //在这里把 persist.sys.bootanim.play_sound 设置为了1
}
}
}
}
查看代码之后发现把系统音量设置为静音之后会把 persist.sys.bootanim.play_sound
重新设置为 1,从而导致会出现开机铃声
把系统声音设置为静音之后复现,修改方法:去掉 bootanimation.mk 中的 bootsound.mp3 和 shutdownsound.mp3 即可