AudioManager returns wrong RingerMode

Open
#67 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
android, java

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.

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?

Dominant language
Kotlin
Stars
1.4k
Forks
777
Avg merge
1m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/media-samples

All issues in android/media-samples

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.