[sprd]Android Q默认没有开机铃声的项目(persist.sys.bootanim.play_sound=0),会概率性出现开机铃声

8 篇文章 1 订阅

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 即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值