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

Commit 61344e29 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "PhoneWindowManager: Changes for WFD."

parents 0823a725 fabe47d2
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2182,6 +2182,19 @@ public class Intent implements Parcelable, Cloneable {
    public static final String ACTION_HEADSET_PLUG =
            "android.intent.action.HEADSET_PLUG";

    /**
     * Broadcast Action: WiFi Display video is enabled or disabled
     *
     * <p>The intent will have the following extra values:
     * <ul>
     *   <li><em>state</em> - 0 for disabled, 1 for enabled. </li>
     * </ul>
     * @hide
     */

    public static final String ACTION_WIFI_DISPLAY_VIDEO =
            "org.codeaurora.intent.action.WIFI_DISPLAY_VIDEO";

    /**
     * Broadcast Action: An analog audio speaker/headset plugged in or unplugged.
     *
+24 −1
Original line number Diff line number Diff line
@@ -475,6 +475,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private static final int MSG_DISABLE_POINTER_LOCATION = 2;
    private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
    private static final int MSG_DISPATCH_MEDIA_KEY_REPEAT_WITH_WAKE_LOCK = 4;
    boolean mWifiDisplayConnected;

    private class PolicyHandler extends Handler {
        @Override
@@ -960,6 +961,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mWindowManagerFuncs.registerPointerEventListener(mSystemGestures);

        mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);

        // register for WIFI Display intents
        IntentFilter wifiDisplayFilter = new IntentFilter(
                                                Intent.ACTION_WIFI_DISPLAY_VIDEO);
        Intent wifidisplayIntent = context.registerReceiver(
                                      mWifiDisplayReceiver, wifiDisplayFilter);

        mLongPressVibePattern = getLongIntArray(mContext.getResources(),
                com.android.internal.R.array.config_longPressVibePattern);
        mVirtualKeyVibePattern = getLongIntArray(mContext.getResources(),
@@ -4238,6 +4246,21 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    BroadcastReceiver mWifiDisplayReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
            if (action.equals(Intent.ACTION_WIFI_DISPLAY_VIDEO)) {
                int state = intent.getIntExtra("state", 0);
                if(state == 1) {
                    mWifiDisplayConnected = true;
                } else {
                    mWifiDisplayConnected = false;
                }
                updateRotation(true);
            }
        }
    };

    @Override
    public void screenTurnedOff(int why) {
        EventLog.writeEvent(70000, 0);
@@ -4452,7 +4475,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // enable 180 degree rotation while docked.
                preferredRotation = mDeskDockEnablesAccelerometer
                        ? sensorRotation : mDeskDockRotation;
            } else if (mHdmiPlugged && mDemoHdmiRotationLock) {
            } else if ((mHdmiPlugged || mWifiDisplayConnected) && mDemoHdmiRotationLock) {
                // Ignore sensor when plugged into HDMI when demo HDMI rotation lock enabled.
                // Note that the dock orientation overrides the HDMI orientation.
                preferredRotation = mDemoHdmiRotation;