Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38ab71c0 authored by Dmitry Shmidt's avatar Dmitry Shmidt
Browse files

InputManagerService: Add Mic Mute switch support



Bug: 141192769
Test: Manual

Change-Id: If90680250c38c019a2a3b3c106b6a53306e3400a
Signed-off-by: default avatarDmitry Shmidt <dimitrysh@google.com>
parent 3d233931
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.hardware.input.InputManager;
import android.hardware.input.InputManagerInternal;
import android.hardware.input.KeyboardLayout;
import android.hardware.input.TouchCalibration;
import android.media.AudioManager;
import android.os.Binder;
import android.os.Bundle;
import android.os.Environment;
@@ -1788,6 +1789,12 @@ public class InputManagerService extends IInputManager.Stub
            mHandler.obtainMessage(MSG_DELIVER_TABLET_MODE_CHANGED,
                    args).sendToTarget();
        }

        if ((switchMask & SW_MUTE_DEVICE_BIT) != 0) {
            final boolean micMute = ((switchValues & SW_MUTE_DEVICE_BIT) != 0);
            AudioManager audioManager = mContext.getSystemService(AudioManager.class);
            audioManager.setMicrophoneMuteFromSwitch(micMute);
        }
    }

    // Native callback.