diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-09-07 20:36:36 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-09-08 14:53:34 -0700 |
commit | e08ae388d63c4db8f9d9a7ecd634f9a51f6e91b9 (patch) | |
tree | ca429e688d16f11dc82410cee03c9d53da96626a /core/java/android/hardware/display/DisplayManager.java | |
parent | 0cfebf28b15e85a42981a8f9e6a09556bef36ea3 (diff) | |
download | frameworks_base-e08ae388d63c4db8f9d9a7ecd634f9a51f6e91b9.zip frameworks_base-e08ae388d63c4db8f9d9a7ecd634f9a51f6e91b9.tar.gz frameworks_base-e08ae388d63c4db8f9d9a7ecd634f9a51f6e91b9.tar.bz2 |
Add new wifi display discovery API.
The API is quite simple. There are a few extra functions
on DisplayManager to scan, connect and disconnect from
wifi displays and get status, and a single protected
broadcast sent when the status changes.
Change-Id: Ic91dbab5ee818e790b27fa32e1a1e93788793be0
Diffstat (limited to 'core/java/android/hardware/display/DisplayManager.java')
-rw-r--r-- | core/java/android/hardware/display/DisplayManager.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java index 2814301..4347e75 100644 --- a/core/java/android/hardware/display/DisplayManager.java +++ b/core/java/android/hardware/display/DisplayManager.java @@ -40,6 +40,28 @@ public final class DisplayManager { private final Object mLock = new Object(); private final SparseArray<Display> mDisplays = new SparseArray<Display>(); + /** + * Broadcast receiver that indicates when the Wifi display status changes. + * <p> + * The status is provided as a {@link WifiDisplayStatus} object in the + * {@link #EXTRA_WIFI_DISPLAY_STATUS} extra. + * </p><p> + * This broadcast is only sent to registered receivers with the + * {@link android.Manifest.permission#CONFIGURE_WIFI_DISPLAY} permission and can + * only be sent by the system. + * </p> + * @hide + */ + public static final String ACTION_WIFI_DISPLAY_STATUS_CHANGED = + "android.hardware.display.action.WIFI_DISPLAY_STATUS_CHANGED"; + + /** + * Contains a {@link WifiDisplayStatus} object. + * @hide + */ + public static final String EXTRA_WIFI_DISPLAY_STATUS = + "android.hardware.display.extra.WIFI_DISPLAY_STATUS"; + /** @hide */ public DisplayManager(Context context) { mContext = context; @@ -127,6 +149,47 @@ public final class DisplayManager { } /** + * Initiates a fresh scan of availble Wifi displays. + * The results are sent as a {@link #ACTION_WIFI_DISPLAY_STATUS_CHANGED} broadcast. + * @hide + */ + public void scanWifiDisplays() { + mGlobal.scanWifiDisplays(); + } + + /** + * Connects to a Wifi display. + * The results are sent as a {@link #ACTION_WIFI_DISPLAY_STATUS_CHANGED} broadcast. + * + * @param deviceAddress The MAC address of the device to which we should connect. + * @hide + */ + public void connectWifiDisplay(String deviceAddress) { + mGlobal.connectWifiDisplay(deviceAddress); + } + + /** + * Disconnects from the current Wifi display. + * The results are sent as a {@link #ACTION_WIFI_DISPLAY_STATUS_CHANGED} broadcast. + * @hide + */ + public void disconnectWifiDisplay() { + mGlobal.disconnectWifiDisplay(); + } + + /** + * Gets the current Wifi display status. + * Watch for changes in the status by registering a broadcast receiver for + * {@link #ACTION_WIFI_DISPLAY_STATUS_CHANGED}. + * + * @return The current Wifi display status. + * @hide + */ + public WifiDisplayStatus getWifiDisplayStatus() { + return mGlobal.getWifiDisplayStatus(); + } + + /** * Listens for changes in available display devices. */ public interface DisplayListener { |