当前位置:网站首页>AOSP ~ modify default volume
AOSP ~ modify default volume
2022-06-11 02:40:00 【Nanke is cute】
frameworks/base/media/java/android/media/AudioSystem.java
/** @hide */
public static int[] DEFAULT_STREAM_VOLUME = new int[] {
4, // STREAM_VOICE_CALL
7, // STREAM_SYSTEM
5, // STREAM_RING
5, // STREAM_MUSIC
6, // STREAM_ALARM
5, // STREAM_NOTIFICATION
7, // STREAM_BLUETOOTH_SCO
7, // STREAM_SYSTEM_ENFORCED
5, // STREAM_DTMF
5, // STREAM_TTS
5, // STREAM_ACCESSIBILITY
5, // STREAM_ASSISTANT
};
frameworks/base/services/core/java/com/android/server/audio/AudioService.java
/** Maximum volume index values for audio streams */
protected static int[] MAX_STREAM_VOLUME = new int[] {
5, // STREAM_VOICE_CALL
7, // STREAM_SYSTEM
7, // STREAM_RING
15, // STREAM_MUSIC
7, // STREAM_ALARM
7, // STREAM_NOTIFICATION
15, // STREAM_BLUETOOTH_SCO
7, // STREAM_SYSTEM_ENFORCED
15, // STREAM_DTMF
15, // STREAM_TTS
15, // STREAM_ACCESSIBILITY
15 // STREAM_ASSISTANT
};
DEFAULT_STREAM_VOLUME
Default volume , The value does not represent the specific volume , It's how much
MAX_STREAM_VOLUME
Maximum volume
ro.config.media_vol_default
If this value is defined , The default volume value will be set to the size of the attribute value . If the attribute value is not defined , The default volume value is forced to be set to the maximum volume value 1/4( Mobile phone mode ) perhaps 1/3( Other modes ).
therefore , Want to change the default media Volume size , There are two ways to modify
- One way is to define ro.config.media_vol_default System property values for , This method does not need to modify the source file , Just add a sentence to the configuration file
- The other way is , take AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] Forcibly assign the value to the volume you want to set
int maxMusicVolume = SystemProperties.getInt("ro.config.media_vol_steps", -1);
if (maxMusicVolume != -1) {
MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxMusicVolume;
}
if(isBox()){
mFixedVolumeDevices.clear();
}
int defaultMusicVolume = SystemProperties.getInt("ro.config.media_vol_default", -1);
if (defaultMusicVolume != -1 &&
defaultMusicVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] &&
defaultMusicVolume >= MIN_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) {
AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = defaultMusicVolume;
} else {
if (isPlatformTelevision()) {
AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] =
MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 4;
} else {
AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] =
MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 3;
}
}
边栏推荐
- SQL | calculate sum
- To view the data in redis, in addition to the command line and client, you have a third option
- Unity HTC and Pico are the same
- Explanation of spark common parameters
- AOSP ~ 默认开启开发者模式
- WordPress upgrade error: briefly unavailable for scheduled maintenance [resolved]
- How to read PMBOK guide in 3 steps (experience + data sharing)
- 421. maximum XOR value of two numbers in the array
- 基于互联网架构演进, 构建秒杀系统
- When a logical deletion encounters a unique index, what are the problems and solutions?
猜你喜欢

基于互联网架构演进, 构建秒杀系统
![Fundamentals of deep learning [4] build easyocr and carry out simple character recognition from 0](/img/e5/31ad2023def9e1a4a5fccb19b31d02.png)
Fundamentals of deep learning [4] build easyocr and carry out simple character recognition from 0

WordPress article directory plug-in luckywp table of contents setup tutorial

Three special data types, day3 and redis (geographic location, cardinality statistics and bitmap scene usage)

mysql重装时写my.ini配置文件出错

CPT 102_LEC 16

Jetpack Compose Box控件

When a logical deletion encounters a unique index, what are the problems and solutions?

Link list of high frequency written interview question brushing summary (distribution explanation & code annotation)

6 best WordPress Image optimizer plug-ins to improve WordPress website performance
随机推荐
年金保險理財產品可以複利嗎?利率是多少?
Databinding escaping with presentation symbols
动态给对象添加属性
helm 部署traefik ingress
jdbc工具类的问题
What can the enterprise exhibition hall design bring to the enterprise?
Jetpack Compose Scaffold和BottomAppBar(底部导航)
MySQL backup and recovery
Technology sharing | quick intercom, global intercom
CPT 102_LEC 15
MySQL备份与恢复
Li Kou brushing questions - hash table
CPT 102_LEC 16
SQL | 返回顾客名称和相关订单号以及每个订单的总价
Kotlin let方法
Baidu submits sitemap to prompt the solution of "index type is not handled"
Use of CIN and cout
[MySQL 45 lecture -12] lecture 12 the reason why MySQL has a wind attack from time to time
Istio installation and use
One line of code solves the problem that the time to fetch datetime from MySQL database is less than eight hours