[HOW TO] Bypassing slider to change ringer volume

Search This thread

RussianBear

Recognized Contributor
Nov 10, 2008
2,021
333
1-2-21 update: confirmed to work on my now-rooted 8T.
1-4-21 update: I've initially counted the ringermodeinternal at line 35 in Android 11 release, but it really should be 32. Let me know if 35 works for you instead.
3-25-22 update: Looks like the new code will be on line 33 for Android 12. It was on line 32 for Android 11. In addition to three_key_mode, you'd also want to add alert_slider_mode to your script (same identifiers as three key mode 1-3). I don't get the haptic feedback anymore when executing these, but everything else appears to work. There is some "AlertSliderAudioPolicy" function that gets triggered with the slider (setUp/Middle/Down) that I saw in the logcat, but not sure if that's what's responsible for the haptic feedback. If anyone figures this out, let me know.


Hi, all.

This guide is a repost from the one I did for 6T. I was never a fan of the slider and came up with some scripts to toggle the ring modes via Smanager, but this should work with any other scipting app. Smanager allows to set scripts as widgets, so that's how I've had it on 6T.

Original ideas came from this post:

https://gist.github.com/tniessen/ea3d68e7d572ed7c607b81d715798800

Android 11 release interface declaration for the ringer mode (void setRingerModeInternal(int ringerMode, String caller) ; ) ) which is the 32nd line (function index) here:


What you will need:

1. Root, since we're modifying system parameters
2. Smanager or another script tool
3. Slider has to be in the ring mode for these to work properly (I'm sure somebody more proficient than me can figure out if the slider can be bypassed in other modes)

Create a new script and call it Vibrate (or something else you want to call that mode). Enable su (root privilege) on it. Inside type:

settings put global three_Key_mode 2
service call audio 32 i32 1 s16 text
############
(do not copy below ^ the above)

three_key_mode 2 - display vibrate icon
i32 1 - enable vibrate mode
s16 text - just random string caller


For Ring (or something else you want to call that mode). Enable su (root privilege) on it. Inside type:

settings put global three_Key_mode 3
service call audio 32 i32 2 s16 text
############
(do not copy below ^ the above)

three_key_mode 2 - display ring icon
i32 2 - enable ring mode
s16 text - just random string caller

For Silent(or something else you want to call that mode). Enable su (root privilege) on it. Inside type:

settings put global three_Key_mode 1
service call audio 32 i32 0 s16 text
############
(do not copy below ^ the above)

three_key_mode 1 - display silent icon
i32 0 - enable silent mode
s16 text - just random string caller

Now you can add these scripts as toggles onto your home screen. Hopefully, some people can find this useful.
 
Last edited:
  • Like
Reactions: drieg

drieg

Member
Aug 23, 2013
29
2
Just found this post via search.
That is awesome, thank you!
I have managed to do it via tasker shell commands, no need for smanager
I wish there was a way to fully repurpose the slider..
 
  • Like
Reactions: RussianBear

RussianBear

Recognized Contributor
Nov 10, 2008
2,021
333
3-25-22 update: Looks like the new code will be on line 33 for Android 12. It was on line 32 for Android 11.

in addition to three_key_mode, you'd also want to add alert_slider_mode to your script (same identifiers as three key mode 1-3).

I don't get the haptic feedback anymore when executing these, but everything else appears to work. There is some "AlertSliderAudioPolicy" function that gets triggered with the slider (setUp/Middle/Down) that I saw in the logcat, but not sure if that's what's responsible for the haptic feedback. If anyone figures this out, let me know.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    1-2-21 update: confirmed to work on my now-rooted 8T.
    1-4-21 update: I've initially counted the ringermodeinternal at line 35 in Android 11 release, but it really should be 32. Let me know if 35 works for you instead.
    3-25-22 update: Looks like the new code will be on line 33 for Android 12. It was on line 32 for Android 11. In addition to three_key_mode, you'd also want to add alert_slider_mode to your script (same identifiers as three key mode 1-3). I don't get the haptic feedback anymore when executing these, but everything else appears to work. There is some "AlertSliderAudioPolicy" function that gets triggered with the slider (setUp/Middle/Down) that I saw in the logcat, but not sure if that's what's responsible for the haptic feedback. If anyone figures this out, let me know.


    Hi, all.

    This guide is a repost from the one I did for 6T. I was never a fan of the slider and came up with some scripts to toggle the ring modes via Smanager, but this should work with any other scipting app. Smanager allows to set scripts as widgets, so that's how I've had it on 6T.

    Original ideas came from this post:

    https://gist.github.com/tniessen/ea3d68e7d572ed7c607b81d715798800

    Android 11 release interface declaration for the ringer mode (void setRingerModeInternal(int ringerMode, String caller) ; ) ) which is the 32nd line (function index) here:


    What you will need:

    1. Root, since we're modifying system parameters
    2. Smanager or another script tool
    3. Slider has to be in the ring mode for these to work properly (I'm sure somebody more proficient than me can figure out if the slider can be bypassed in other modes)

    Create a new script and call it Vibrate (or something else you want to call that mode). Enable su (root privilege) on it. Inside type:

    settings put global three_Key_mode 2
    service call audio 32 i32 1 s16 text
    ############
    (do not copy below ^ the above)

    three_key_mode 2 - display vibrate icon
    i32 1 - enable vibrate mode
    s16 text - just random string caller


    For Ring (or something else you want to call that mode). Enable su (root privilege) on it. Inside type:

    settings put global three_Key_mode 3
    service call audio 32 i32 2 s16 text
    ############
    (do not copy below ^ the above)

    three_key_mode 2 - display ring icon
    i32 2 - enable ring mode
    s16 text - just random string caller

    For Silent(or something else you want to call that mode). Enable su (root privilege) on it. Inside type:

    settings put global three_Key_mode 1
    service call audio 32 i32 0 s16 text
    ############
    (do not copy below ^ the above)

    three_key_mode 1 - display silent icon
    i32 0 - enable silent mode
    s16 text - just random string caller

    Now you can add these scripts as toggles onto your home screen. Hopefully, some people can find this useful.
    1
    Just found this post via search.
    That is awesome, thank you!
    I have managed to do it via tasker shell commands, no need for smanager
    I wish there was a way to fully repurpose the slider..