1

Discord talk channel stays broadcasting indefinitely in background even if the screen is locked.

Note that I write "background" from the user's point of view. The app has a persistent notification so that makes it technically non-background on Android.

I would like to know if there is a setting or app that could be used to prevent this privacy issue.

For example to stop apps on screen lock, or to auto-disable microphone after some time.

2
  • 1
    Since Android 9 apps running in background (without a foreground service / persistent notification) cannot access microphone: developer.android.com/about/versions/pie/…. Also you may set RECORD_AUDIO to foreground using appops. Commented Jun 1, 2020 at 15:45
  • I see. Technically it is not background since there is a persistent notification and it is recording and playing audio. My question is about existing means to stop some apps or the mic while on screen lock.
    – gatopeich
    Commented Jun 2, 2020 at 22:18

2 Answers 2

2

There is no definite solution to your problem AFAIK, but I can share my thoughts on it.

From documentation:

If your app is running in the background on a device running Android 9... it cannot access the microphone

Furthermore since Android 9 you can force an app to use microphone (and other operations) only in foreground:

~$ appops set com.discord RECORD_AUDIO foreground

Both of the above are applicable only if the app is not running a foreground service i.e. not showing a persistent notification.

In case of older Android version or if the app is running a foreground service you can try to make use of some automation apps to revoke RECORD_AUDIO permission and/or operation as soon as screen is locked:

~$ pm revoke org.lineageos.recorder android.permission.RECORD_AUDIO
~$ appops set com.discord RECORD_AUDIO ignore

And do the inverse when screen is unlocked.

However Android framework mostly kills/restarts the app/service when a permission is revoked. Or the app may continue using the previous state of permission unless it's manually restarted. So the approach is not reliable but may work for some apps under certain circumstances.

For example to stop apps on screen lock, or to auto-disable microphone after some time.

Stock Android doesn't provide any such feature to auto-disable or disable mic from lock screen, though a custom ROM developer or OEM may provide e.g. a "Turn Mic Off" tile. Some ROMs add "Kill app" button to notification (on long press). But that may require unlocking the screen. Again you can automate to kill the app on screen lock. But some apps may also start a service on broadcast events.

1
  • I am not allowed to downvote but I'd have done it. Normal users are not meant to know how to insert those command lines and where. You should have elaborated at least.
    – elena
    Commented Sep 20 at 11:05
1

Navigate to Settings/Apps/Advanced/Default Apps/Digital Assistant, then change from Voice to Google speech recognition. That should replace the mic symbol with the phone symbol.

-or-

You could try denying the Google app's mic permission or both.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .