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

Commit 997fe2e6 authored by martincz's avatar martincz Committed by Bruno Martins
Browse files

PhoneWindowManager: Tap volume buttons to answer call

Change-Id: I5ebe1ad88950ba56ce1445b77b7f8cdf030463da
parent 02b0bd77
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -525,6 +525,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mVolumeUpWakeTriggered;
    boolean mVolumeMuteWakeTriggered;

    boolean mVolumeAnswerCall;

    private boolean mPendingKeyguardOccluded;
    private boolean mKeyguardOccludedChanged;

@@ -875,6 +877,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(LineageSettings.System.getUriFor(
                    LineageSettings.System.VOLUME_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(LineageSettings.System.getUriFor(
                    LineageSettings.System.VOLUME_ANSWER_CALL), false, this,
                    UserHandle.USER_ALL);

            updateSettings();
        }
@@ -2308,6 +2313,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            mWakeOnVolumeKeyPress = (LineageSettings.System.getIntForUser(resolver,
                    LineageSettings.System.VOLUME_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1)
                    && ((mDeviceHardwareWakeKeys & KEY_MASK_VOLUME) != 0);
            mVolumeAnswerCall = (LineageSettings.System.getIntForUser(resolver,
                    LineageSettings.System.VOLUME_ANSWER_CALL, 0, UserHandle.USER_CURRENT) == 1)
                    && ((mDeviceHardwareWakeKeys & KEY_MASK_VOLUME) != 0);

            // Configure wake gesture.
            boolean wakeGestureEnabledSetting = Settings.Secure.getIntForUser(resolver,
@@ -4165,6 +4173,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        // When {@link #mHandleVolumeKeysInWM} is set, volume key events
                        // should be dispatched to WM.
                        if (telecomManager.isRinging()) {
                            if (mVolumeAnswerCall) {
                                telecomManager.acceptRingingCall();
                            }

                            // If an incoming call is ringing, either VOLUME key means
                            // "silence ringer".  We handle these keys here, rather than
                            // in the InCallScreen, to make sure we'll respond to them