上一篇文章描述了在app开发中怎么调节系统不同音频流的音量大小。这次我们看下在android10中系统调节音量的实现和系统默认音量的修改。(本次源码以Android10为主梳理系统音量修改的实现) 一 按实体音量键修改音量 // frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java //以下按键事件中 if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) { if (mUseTvRouting || mHandleVolumeKeysInWM) { // On TVs or when the configuration is enabled, volume keys never // go to the foreground app.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile