summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamakant Singh <ramaka@codeaurora.org>2015-07-30 18:39:07 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:27:08 -0600
commitb08a47e50ca6e3c81ea84846464fcde8ed7e794b (patch)
tree78fad7501122e95fced3aa89104cab825c16bfbb
parent70918513a2594d2c315e3addbc287eb9e378e49f (diff)
downloadframeworks_base-b08a47e50ca6e3c81ea84846464fcde8ed7e794b.zip
frameworks_base-b08a47e50ca6e3c81ea84846464fcde8ed7e794b.tar.gz
frameworks_base-b08a47e50ca6e3c81ea84846464fcde8ed7e794b.tar.bz2
PhoneWindowManager: Changes for WFD and UIBC
This change includes the below gerrits: # This is a combination of 3 commits # The first commit's message is: PhoneWindowManager: Changes for WFD. - WFD now sends WIFI_DISPLAY_VIDEO intent to set UI orientation. - PhoneWindowManager to listen for WFD intents. - Display on WFD should be same as seen on the HDMI, so set the orientation to HDMI orientation Change-Id: I446ab768200f9b9f59759e52071bcaca7d6f836c # This is the 2nd commit message: framework: update WFD session orientation based on UIBC rotation User Input Back Channel (UIBC) support in Wifi Display stack allows the sink to send control/commands/preferences to the source e.g. touch, keyboard/mouse entry, or orientation/rotation. PhoneWindowManager needs to listen for UIBC rotation intents and update the preferred rotation when WFD is active. Note: HDMI rotation lock overrides WiFi Display UIBC rotation. Change-Id: I1869b21c3c03b5b36c5381933b50dfbfeca88db6 # This is the 3rd commit message: PhoneWindowManager: Changes for WiFi Display to comply with Android CDD Remove definition of Intent action for ACTION_WIFI_DISPLAY_VIDEO from Intent.java and make it local to PhoneWindowManager. Change-Id: I91a6d302e19705080ccc109ee6532c6d43f58165 Change-Id: I03e2ca995c520519b29eb30a1a52959c0992f77e
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 489bcdb..899c176 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -216,6 +216,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
.build();
+ /**
+ * Broadcast Action: WiFi Display video is enabled or disabled
+ *
+ * <p>The intent will have the following extra values:</p>
+ * <ul>
+ * <li><em>state</em> - 0 for disabled, 1 for enabled. </li>
+ * </ul>
+ */
+
+ private static final String ACTION_WIFI_DISPLAY_VIDEO =
+ "org.codeaurora.intent.action.WIFI_DISPLAY_VIDEO";
+
+
// The panic gesture may become active only after the keyguard is dismissed and the immersive
// app shows again. If that doesn't happen for 30s we drop the gesture.
private static final long PANIC_GESTURE_EXPIRATION = 30000;
@@ -635,6 +648,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private static final int MSG_POWER_DELAYED_PRESS = 13;
private static final int MSG_POWER_LONG_PRESS = 14;
private static final int MSG_UPDATE_DREAMING_SLEEP_TOKEN = 15;
+ boolean mWifiDisplayConnected = false;
+ int mWifiDisplayCustomRotation = -1;
private class PolicyHandler extends Handler {
@Override
@@ -1508,6 +1523,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mWindowManagerFuncs.registerPointerEventListener(mSystemGestures);
mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
+
+ /* Register for WIFI Display Intents */
+ IntentFilter wifiDisplayFilter = new IntentFilter(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(),
@@ -5452,6 +5472,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
+
+ BroadcastReceiver mWifiDisplayReceiver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (action.equals(ACTION_WIFI_DISPLAY_VIDEO)) {
+ int state = intent.getIntExtra("state", 0);
+ if(state == 1) {
+ mWifiDisplayConnected = true;
+ } else {
+ mWifiDisplayConnected = false;
+ }
+ mWifiDisplayCustomRotation =
+ intent.getIntExtra("wfd_UIBC_rot", -1);
+ updateRotation(true);
+ }
+ }
+ };
+
// Called on the PowerManager's Notifier thread.
@Override
public void startedGoingToSleep(int why) {
@@ -5823,10 +5861,13 @@ 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;
+ } else if (mWifiDisplayConnected && (mWifiDisplayCustomRotation > -1)) {
+ // Ignore sensor when WFD is active and UIBC rotation is enabled
+ preferredRotation = mWifiDisplayCustomRotation;
} else if (mHdmiPlugged && mDockMode == Intent.EXTRA_DOCK_STATE_UNDOCKED
&& mUndockedHdmiRotation >= 0) {
// Ignore sensor when plugged into HDMI and an undocked orientation has