android / android/media-samples
AudioManager returns wrong RingerMode
- Dominant language
- Kotlin
- Stars
- 1.4k
- Forks
- 781
- PR merge metrics
- No merged PRs in 30d
Description
Android OS : 6.0
Device : Moto-G 2nd Gen
While using the AudioManager API to get the Phone ringer mode, the value return only for the mute/sleep is wrong, it returns the RINGER_MODE_VIBRATE instead of RINGER_MODE_SILENT on Android 6, where as the values returned correctly on Android 9 and 10.
Code is:
`AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);`
switch (am.getRingerMode()) {
case AudioManager.RINGER_MODE_SILENT:
Log.i("MyApp","Silent mode");
break;
case AudioManager.RINGER_MODE_VIBRATE:
Log.i("MyApp","Vibrate mode");
break;
case AudioManager.RINGER_MODE_NORMAL:
Log.i("MyApp","Normal mode");
break;}
Ringer mode are set through phone sound/mute/vibrate profiles.
How to get correct value for silent mode?
Contributor guide
Research direction
Start with the AudioManager API entry points shown in the report: getSystemService(Context.AUDIO_SERVICE) and getRingerMode(). Reproduce the sound-profile behavior on Android 6 and compare it with Android 9 and 10; done requires establishing whether the differing silent/vibrate value is an app issue or an Android platform behavior, since no repository file or test is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- audio-video-rtc, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100