summaryrefslogtreecommitdiffstats
path: root/media/lib
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2013-11-11 17:55:08 -0800
committerJeff Brown <jeffbrown@google.com>2013-11-11 21:48:53 -0800
commit39ad0e559896b45185429ea17cd12f18f7ae842c (patch)
tree9e8d5d137a467f6ccd3ad6d453014d89f7ca21f7 /media/lib
parent596e409ec9703e5071bb9a0de08787cde7745f7a (diff)
downloadframeworks_base-39ad0e559896b45185429ea17cd12f18f7ae842c.zip
frameworks_base-39ad0e559896b45185429ea17cd12f18f7ae842c.tar.gz
frameworks_base-39ad0e559896b45185429ea17cd12f18f7ae842c.tar.bz2
UI tweaks.
Hide disabled routes from the chooser. Fix layout of chooser dialog when the settings button is visible and the list is very long to prevent truncation of the settings button. Fix an issue when we fake the route connecting status when a route is selected. The route changed notification needs to be propagated to apps. Fake it better. Immediately disconnect from a route when the connection is lost or a connection attempt fails. Added a few new test displays for this case. Bug: 11257292 Change-Id: I360ab5dc937ad60d97592eab54b19f034519645e
Diffstat (limited to 'media/lib')
-rw-r--r--media/lib/java/com/android/media/remotedisplay/RemoteDisplayProvider.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/media/lib/java/com/android/media/remotedisplay/RemoteDisplayProvider.java b/media/lib/java/com/android/media/remotedisplay/RemoteDisplayProvider.java
index 701c39c..e2df77c 100644
--- a/media/lib/java/com/android/media/remotedisplay/RemoteDisplayProvider.java
+++ b/media/lib/java/com/android/media/remotedisplay/RemoteDisplayProvider.java
@@ -16,6 +16,7 @@
package com.android.media.remotedisplay;
+import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
@@ -27,6 +28,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
+import android.provider.Settings;
import android.util.ArrayMap;
import java.util.Collection;
@@ -95,6 +97,7 @@ public abstract class RemoteDisplayProvider {
private static final int MSG_SET_VOLUME = 5;
private static final int MSG_ADJUST_VOLUME = 6;
+ private final Context mContext;
private final ProviderStub mStub;
private final ProviderHandler mHandler;
private final ArrayMap<String, RemoteDisplay> mDisplays =
@@ -102,6 +105,8 @@ public abstract class RemoteDisplayProvider {
private IRemoteDisplayCallback mCallback;
private int mDiscoveryMode = DISCOVERY_MODE_NONE;
+ private PendingIntent mSettingsPendingIntent;
+
/**
* The {@link Intent} that must be declared as handled by the service.
* Put this in your manifest.
@@ -140,11 +145,19 @@ public abstract class RemoteDisplayProvider {
* @param context The application context for the remote display provider.
*/
public RemoteDisplayProvider(Context context) {
+ mContext = context;
mStub = new ProviderStub();
mHandler = new ProviderHandler(context.getMainLooper());
}
/**
+ * Gets the context of the remote display provider.
+ */
+ public final Context getContext() {
+ return mContext;
+ }
+
+ /**
* Gets the Binder associated with the provider.
* <p>
* This is intended to be used for the onBind() method of a service that implements
@@ -261,11 +274,29 @@ public abstract class RemoteDisplayProvider {
* Finds the remote display with the specified id, returns null if not found.
*
* @param id Id of the remote display.
+ * @return The display, or null if none.
*/
public RemoteDisplay findRemoteDisplay(String id) {
return mDisplays.get(id);
}
+ /**
+ * Gets a pending intent to launch the remote display settings activity.
+ *
+ * @return A pending intent to launch the settings activity.
+ */
+ public PendingIntent getSettingsPendingIntent() {
+ if (mSettingsPendingIntent == null) {
+ Intent settingsIntent = new Intent(Settings.ACTION_WIFI_DISPLAY_SETTINGS);
+ settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
+ | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ mSettingsPendingIntent = PendingIntent.getActivity(
+ mContext, 0, settingsIntent, 0, null);
+ }
+ return mSettingsPendingIntent;
+ }
+
void setCallback(IRemoteDisplayCallback callback) {
mCallback = callback;
publishState();