On Fairphone 4 LineageOS 23.2 how to get with ADB the *Mic access* state?
Sep 11, 9:11pm

To check the Microphone access state (whether an app has permission to use the microphone) on a Fairphone 4 running LineageOS 23.2 (Android 13-based), you can use ADB (Android Debug Bridge) to query the permission status. Here's how:


Steps to Check Mic Access State via ADB

1. Enable USB Debugging

  • On your Fairphone 4, go to Settings > About phone > Tap "Build number" 7 times to enable Developer options.
  • Go to Developer options and enable USB debugging.
  • Connect your phone to your computer via USB and authorize the debugging connection.

2. Use ADB to Check Mic Permission

  • Open a terminal/command prompt on your computer and run:

    bash
    adb shell dumpsys package | grep -A 10 "PERMISSION_MICROPHONE"

    This will list all apps and their microphone permission status.

  • Alternatively, to check for a specific app (replace com.example.app with the app's package name):

    bash
    adb shell dumpsys package com.example.app | grep -i "MICROPHONE"

    Look for lines like:

    text
    grantedPermissions={... android.permission.RECORD_AUDIO ...}

    If RECORD_AUDIO is listed under grantedPermissions, the app has mic access.


3. Check Runtime Permissions (Android 6+)

  • For runtime permissions (user-granted), use:

    bash
    adb shell dumpsys permission | grep -i "RECORD_AUDIO"

    This will show which apps have been granted the RECORD_AUDIO permission at runtime.

  • For a specific app:

    bash
    adb shell dumpsys package com.example.app | grep -i "RECORD_AUDIO"

4. Check if Mic is Being Used

  • To see if the microphone is actively in use (e.g., by an app):
    bash
    adb shell dumpsys media.audio_flinger | grep -i "recording"
    This will show if any app is currently recording audio.

5. Check App Ops (Fine-Grained Control)

  • LineageOS may use App Ops to manage permissions. To check:
    bash
    adb shell appops query OP_RECORD_AUDIO
    This lists all apps and their microphone access state (e.g., allow, deny, default).

Example Outputs

  • If an app has mic access:
    text
    Package com.example.app:
      Permission android.permission.RECORD_AUDIO: granted
  • If denied:
    text
    Package com.example.app:
      Permission android.permission.RECORD_AUDIO: denied

Notes

  • LineageOS 23.2 is based on Android 13, so these commands should work as expected.
  • If you need to revoke mic access for an app, use:
    bash
    adb shell pm revoke com.example.app android.permission.RECORD_AUDIO
  • To grant it again:
    bash
    adb shell pm grant com.example.app android.permission.RECORD_AUDIO

Sep 11, 9:11pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more