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

Commit d747dc81 authored by Mike Lockwood's avatar Mike Lockwood Committed by Mike Lockwood
Browse files

Fix problems dispatching media button events on headless devices



Signed-off-by: default avatarMike Lockwood <lockwood@android.com>

Conflicts:

	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
parent 3a74bd36
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -287,6 +287,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    /** If true, hitting shift & menu will broadcast Intent.ACTION_BUG_REPORT */
    boolean mEnableShiftMenuBugReports = false;

    boolean mHeadless;
    boolean mSafeMode;
    WindowState mStatusBar = null;
    boolean mStatusBarCanHide;
@@ -783,7 +784,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mWindowManager = windowManager;
        mWindowManagerFuncs = windowManagerFuncs;
        mPowerManager = powerManager;
        if ("0".equals(SystemProperties.get("ro.config.headless", "0"))) {
        mHeadless = "1".equals(SystemProperties.get("ro.config.headless", "0"));
        if (!mHeadless) {
            // don't create KeyguardViewMediator if headless
            mKeyguardMediator = new KeyguardViewMediator(context, this, powerManager);
        }
@@ -2584,7 +2586,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    /** {@inheritDoc} */
    public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
        // do nothing if headless
        if (mKeyguardMediator == null) return;
        if (mHeadless) return;

        // lid changed state
        mLidOpen = lidOpen ? LID_OPEN : LID_CLOSED;
@@ -2817,7 +2819,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        //        the device some other way (which is why we have an exemption here for injected
        //        events).
        int result;
        if (isScreenOn || (isInjected && !isWakeKey)) {
        if ((isScreenOn && !mHeadless) || (isInjected && !isWakeKey)) {
            // When the screen is on or if the key is injected pass the key to the application.
            result = ACTION_PASS_TO_USER;
        } else {
+1 −1
Original line number Diff line number Diff line
@@ -4930,7 +4930,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        synchronized (this) {
            booting = mBooting;
            mBooting = false;
            enableScreen = !mBooted && !mHeadless;
            enableScreen = !mBooted;
            mBooted = true;
        }
        
+1 −1
Original line number Diff line number Diff line
@@ -4893,7 +4893,7 @@ public class WindowManagerService extends IWindowManager.Stub

    public void performBootTimeout() {
        synchronized(mWindowMap) {
            if (mDisplayEnabled) {
            if (mDisplayEnabled || mHeadless) {
                return;
            }
            Slog.w(TAG, "***** BOOT TIMEOUT: forcing display enabled");