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

Unverified Commit af7d8cf9 authored by martincz's avatar martincz Committed by Michael Bestas
Browse files

PhoneWindowManager: Tap volume buttons to answer call

Change-Id: I5ebe1ad88950ba56ce1445b77b7f8cdf030463da
parent 348ad610
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -852,6 +852,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private boolean mClearedBecauseOfForceShow;
    private boolean mTopWindowIsKeyguard;

    private boolean mVolumeAnswerCall;

    private class PolicyHandler extends Handler {
        @Override
        public void handleMessage(Message msg) {
@@ -1043,6 +1045,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(CMSettings.System.getUriFor(
                    CMSettings.System.VOLUME_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(CMSettings.System.getUriFor(
                    CMSettings.System.VOLUME_ANSWER_CALL), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.ACCELEROMETER_ROTATION_ANGLES), false, this,
                    UserHandle.USER_ALL);
@@ -2293,6 +2298,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    ((mDeviceHardwareWakeKeys & KEY_MASK_VOLUME) != 0);
            mVolBtnMusicControls = (CMSettings.System.getIntForUser(resolver,
                    CMSettings.System.VOLBTN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) == 1);
            mVolumeAnswerCall = CMSettings.System.getIntForUser(resolver,
                    CMSettings.System.VOLUME_ANSWER_CALL, 0, UserHandle.USER_CURRENT) == 1;

            // Configure wake gesture.
            boolean wakeGestureEnabledSetting = Settings.Secure.getIntForUser(resolver,
@@ -6369,6 +6376,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    TelecomManager telecomManager = getTelecommService();
                    if (telecomManager != null) {
                        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