How to disable volume adjustment to mute in Android

Source: Internet
Author: User

When the volume button in Android is turned down, if you keep holding down the down button, the system will jump to a minimum and then automatically adjust to mute. This mechanism and iphone is different, the iphone no matter how you press the volume-button, can only be adjusted to the smallest, or a little voice, is not automatically mute.

Android If you want to disable the automatic mute function, there is a way to find the down button processing events, make a judgment on the line, the code in:

Frameworks/base/media/java/android/media/audiomanager.java

 Public voidHandlekeydown (KeyEvent event,intstream) {        intKeyCode =Event.getkeycode (); Switch(keycode) { Casekeyevent.keycode_volume_up: CaseKeyevent.keycode_volume_down:/** Adjust the volume in on key down since it's more * responsive to the user. */                intFlags = FLAG_SHOW_UI |flag_vibrate; /*Avoid auto mute when adjust lower*/                intCurrentvolume =Getstreamvolume (Stream_music); LOG.E (TAG, String.Format ("Currentvolume=%d", Currentvolume)); if(KeyCode = = Keyevent.keycode_volume_down && currentvolume <= 1) {                     Break; }                if(Musemastervolume) {Adjustmastervolume (KeyCode==keyevent.keycode_volume_up?adjust_raise:adjust_lower, flags); } Else{

How to disable volume adjustment to mute in Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.