question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for OnePlus' "Alert Slider"

See original GitHub issue

Is your feature request related to a problem? Please describe.

When I toggle the do not disturb switch on my OnePlus (7T) phone, it is not being registered by the DnD sensor (because it uses a different ~API~ settings key).

Describe the solution you’d like

DnD should indicate the state of the alert slider on OnePlus devices (with maybe a setting to opt-out of the alert slider, if present)

Describe alternatives you’ve considered, if any

  • You could toggle the Android DnD via Assistant, but that defeats the whole purpose of the hardware switch

Additional context

The global setting for the slider is three_Key_mode with it’s values being: 3 -> Ring == off 2 -> Vibrate == vibrate (~= priority_only?) 1 -> Silence == alarms_only

Basic sample:

contentResolver.query(Settings.Global.CONTENT_URI, null, null, null, null).use {
    it!!.moveToFirst()
    val res = try {
        Settings.Global.getInt(
            applicationContext.contentResolver,
            "three_Key_mode"
        )
    } catch (e: Settings.SettingNotFoundException) {
        findViewById<TextView>(R.id.txt).text = "No alert slider"
        return@use
    }
    findViewById<TextView>(R.id.txt).text = when (res) {
        1 -> "alarms_only"
        2 -> "vibrate"
        3 -> "off"
        else -> "unknown"
    }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jpelgromcommented, Feb 4, 2022

I also don’t have a OnePlus device, but this does sound very similar to the AudioManager.getRingerMode() which is already available as the “Ringer Mode” sensor.

@cromefire Did you check this sensor to see if it responds to the alert slider?

0reactions
cromefirecommented, Feb 4, 2022

Yes this works indeed, thank you very much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

More Alert Slider Customization? - OnePlus Community
Just got this phone yesterday and loving it so far. My biggest problem with it though is that I can't modify the alert...
Read more >
OnePlus Alert Slider Customization now possible with an ...
A new Xposed module for the OnePlus 5 and OnePlus 5T makes customizing the phones' alert sliders a cinch. Here's everything you need...
Read more >
The OnePlus 10T won't have a mute switch — here's why
The alert slider has been a staple of OnePlus' flagship phones for years, offering a quick and easy way to put its phones...
Read more >
Alert Slider On The Oneplus 6t - YouTube
Check This case out for The OnePlus 6thttps://amzn.to/2uLmzOIn this oneplus 6t user guide, we cover How To Use The Alert Slider On The ......
Read more >
OnePlus 10T will ditch the alert slider and Hasselblad tuning ...
Additionally, it will use 15 separate antennas to help improve network reception while holding the phone horizontally. The company would have ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found