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

Commit 47d01b14 authored by Simon Shields's avatar Simon Shields Committed by Bruno Martins
Browse files

PhoneWindowManager: add LineageButtons volumekey hook

We can't use a generic DeviceKeyHandler here, because we don't want to
override some of the AOSP logic (silencing incoming calls, screenshots)
and we need to know if the device is interactive or not (for screen-off
music controls)

Change-Id: I485c2f6006c5bbd358ba0cbd32917689826c5c6d
parent 4e56c93b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -301,6 +301,8 @@ import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;

import org.lineageos.internal.buttons.LineageButtons;

import dalvik.system.PathClassLoader;

/**
@@ -831,6 +833,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private boolean mAodShowing;

    private final List<DeviceKeyHandler> mDeviceKeyHandlers = new ArrayList<>();
    private LineageButtons mLineageButtons;

    private static final int MSG_ENABLE_POINTER_LOCATION = 1;
    private static final int MSG_DISABLE_POINTER_LOCATION = 2;
@@ -6298,6 +6301,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    // {@link interceptKeyBeforeDispatching()}.
                    result |= ACTION_PASS_TO_USER;
                } else if ((result & ACTION_PASS_TO_USER) == 0) {
                    if (mLineageButtons.handleVolumeKey(event, interactive))
                        break;

                    // If we aren't passing to the user and no one else
                    // handled it send it to the session manager to
                    // figure out.
@@ -7735,6 +7741,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
        }

        mLineageButtons = new LineageButtons(mContext);
        mSystemGestures.systemReady();
        mImmersiveModeConfirmation.systemReady();