android5.1 修改音量键绑定多媒体声音

修改此文件frameworks/base/media/java/android/media/AudioService.java中函数

 
   
private int getActiveStreamType(int suggestedStreamType) {         

  ...............
  ...............
   else if (suggestedStreamType == AudioManager.USE_DEFAULT_STREAM_TYPE) { /* carroll 修改音量键默认调节多媒体音量 start */ /* if (isAfMusicActiveRecently(StreamOverride.sDelayMs)) { if (DEBUG_VOL) Log.v(TAG, "getActiveStreamType: forcing STREAM_MUSIC");*/ return AudioSystem.STREAM_MUSIC; /* } else { if (DEBUG_VOL) Log.v(TAG, "getActiveStreamType: using STREAM_NOTIFICATION as default"); return AudioSystem.STREAM_NOTIFICATION; }*/ /* carroll 修改音量键默认调节多媒体音量 end */ } break; } if (DEBUG_VOL) Log.v(TAG, "getActiveStreamType: Returning suggested type " + suggestedStreamType); return suggestedStreamType; }
 
   

 重新编译后,按音量键提示栏为多媒体音量

 
   

 参考:https://blog.csdn.net/deng0zhaotai/article/details/45058935

转载于:https://www.cnblogs.com/CZM-/p/9551331.html

你可能感兴趣的:(android5.1 修改音量键绑定多媒体声音)