37-Android之耳机音量加大时警告提示框问题 MTK6739平台
平台: MTK6739 Android10
之前在 34-Android之耳机音量加大时警告提示框问题(展锐SC9820E平台)里说把MTK该问题的解决方法也发布出来. 结果一直偷懒到现在.
当时GCF测试, 反馈了两个问题:
- 设备重启之后, 设备音量没有恢复到安全音量
- 当连续播放20个小时候, 音量没有恢复到安全音量
类:
frameworks/base/services/core/java/com/android/server/audio/AudioService.java
// 问题1:
private void onConfigureSafeVolume(boolean force, String caller) {
synchronized (mSafeMediaVolumeStateLock) {
int mcc = mContext.getResources().getConfiguration().mcc;
if ((mMcc != mcc) || ((mMcc == 0) && force)) {
mSafeMediaVolumeIndex = mContext.getResources().getInteger(
com.android.internal.R.integer.config_safe_media_volume_index) * 10;
mSafeUsbMediaVolumeIndex = getSafeUsbMediaVolumeIndex();
boolean safeMediaVolumeEnabled =
SystemProperties.getBoolean("audio.safemedia.force", false)
|| mContext.getResources().getBoolean(
com.android.internal.R.bool.config_safe_media_volume_enabled);
boolean safeMediaVolumeBypass =
SystemProperties.getBoolean("audio.safemedia.bypass", false);
// The persisted state is either "disabled" or "active": this is the state applied
// next time we boot and cannot be "inactive"
int persistedState;