Android-获取最大安全流音量

时间:2019-10-08 19:57:04

标签: android android-audiomanager

我有一个用例,可以通过编程方式更改流的音量,但是在较新的android音量上,将音量提高到某个限制(根据我的观察,该音量为60%,与大多数手机上的第9步相对应)会导致出现警告对话框:< / p>

Listening at high volume for a long time may damage your hearing. Tap OK to allow the volume 
to be increased above safe levels
Cancel OK

我在android开发人员门户中找不到与此有关的任何文档,我只能找到一些随机文章,引用诸如one这样的欧洲法规:

According to regulations set by the European Committee for Electrotechnical Standarisation (CENELEC), all electronic devices capable of media playback sold after February 2013 must have a default output volume level of a maximum 85 dB. Users can choose to override the warning to increase the volume to a maximum of 100 dB, but in doing so the warning must re-appear after 20 hours of music playback.

所以我需要可靠地弄清楚那个数字是多少,所以我永远不会导致显示此对话框的音量变化,但是我也不想仅将第9步用作最大音量,并且然后发现这不是另一部手机的正确价格。 android API是否在任何地方公开最大安全流量?如果不是,那么他们是否至少记录了与其他电话对应的步骤号?

谢谢!

1 个答案:

答案 0 :(得分:0)

有一个资源可以控制安全音量步长:public class AllocationProcessByProjectExt : PXGraphExtension<AllocationProcessByProject> { public PXCancel<AllocationFilter> Cancel; public PXFilter<AllocationFilter> Filter; public PXFilteredProcessingJoin<PMProject, AllocationFilter, LeftJoin<Customer, On<Customer.bAccountID, Equal<PMProject.customerID>>>, Where2<Where<Current<AllocationFilter.allocationID>, IsNull, Or<PMProject.allocationID, Equal<Current<AllocationFilter.allocationID>>>>, And2<Where<Current<AllocationFilter.projectID>, IsNull, Or<PMProject.contractID, Equal<Current<AllocationFilter.projectID>>>>, And2<Where<Current<AllocationFilter.customerID>, IsNull, Or<PMProject.customerID, Equal<Current<AllocationFilter.customerID>>>>, **And2<Where<Current<AllocationFilterExt.usrStatus>, IsNull, Or<PMProject.status, Equal<Current<AllocationFilterExt.usrStatus>>>>,** And2<Where<Current<AllocationFilter.customerClassID>, IsNull, Or<Customer.customerClassID, Equal<Current<AllocationFilter.customerClassID>>>>, And2<Where<Current<AllocationFilter.customerClassID>, IsNull, Or<Customer.customerClassID, Equal<Current<AllocationFilter.customerClassID>>>>, And2<Match<Current<AccessInfo.userName>>, And<PMProject.nonProject, Equal<False>, And<PMProject.isTemplate, Equal<False>, And<PMProject.baseType, Equal<PMProject.ProjectBaseType>>>>>> >>>>>> Items;

config_safe_media_volume_index

已定义HERE

它用于HERE

您可以通过以下方式获得它:

// .../overlay/frameworks/base/core/res/res/values/config.xml
<integer name="config_safe_media_volume_index">7</integer>

我在Galaxy S10上进行了测试,得到9分。