summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-06-18 21:36:23 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-18 21:36:23 -0700
commit5bb835a95942b0b313b2fa4e3f05941e630f9be7 (patch)
tree9b359be2f6fb25cc10f43588eef2c4fe579e425a
parentbadf5a9442e639dc6ae2c4794c202143f6d2f16d (diff)
parentdd0a19266d5c837069da1ea188744d54c8d723a8 (diff)
downloadframeworks_base-5bb835a95942b0b313b2fa4e3f05941e630f9be7.zip
frameworks_base-5bb835a95942b0b313b2fa4e3f05941e630f9be7.tar.gz
frameworks_base-5bb835a95942b0b313b2fa4e3f05941e630f9be7.tar.bz2
Merge "MediaRouter bluetooth a2dp selection" into jb-dev
-rw-r--r--media/java/android/media/AudioService.java3
-rw-r--r--media/java/android/media/MediaRouter.java22
2 files changed, 19 insertions, 6 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index ddb7e6b..27dc6e3 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1660,9 +1660,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
/** @see AudioManager#setBluetoothA2dpOn() */
public void setBluetoothA2dpOn(boolean on) {
- if (!checkAudioSettingsPermission("setBluetoothA2dpOn()")) {
- return;
- }
setBluetoothA2dpOnInt(on);
}
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index 6f9cc62..a9e6e3d 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -81,9 +81,8 @@ public class MediaRouter {
IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
mAudioService = IAudioService.Stub.asInterface(b);
- // XXX this doesn't deal with locale changes!
- mSystemCategory = new RouteCategory(mResources.getText(
- com.android.internal.R.string.default_audio_route_category_name),
+ mSystemCategory = new RouteCategory(
+ com.android.internal.R.string.default_audio_route_category_name,
ROUTE_TYPE_LIVE_AUDIO, false);
}
@@ -130,6 +129,13 @@ public class MediaRouter {
info.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO;
sStatic.mBluetoothA2dpRoute = info;
addRoute(sStatic.mBluetoothA2dpRoute);
+ try {
+ if (mAudioService.isBluetoothA2dpOn()) {
+ selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mBluetoothA2dpRoute);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error selecting Bluetooth A2DP route", e);
+ }
} else {
sStatic.mBluetoothA2dpRoute.mName = mCurRoutesInfo.mBluetoothName;
dispatchRouteChanged(sStatic.mBluetoothA2dpRoute);
@@ -279,6 +285,16 @@ public class MediaRouter {
return;
}
+ final RouteInfo btRoute = sStatic.mBluetoothA2dpRoute;
+ if (btRoute != null && (types & ROUTE_TYPE_LIVE_AUDIO) != 0 &&
+ (route == btRoute || route == sStatic.mDefaultAudio)) {
+ try {
+ sStatic.mAudioService.setBluetoothA2dpOn(route == btRoute);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error changing Bluetooth A2DP state", e);
+ }
+ }
+
if (sStatic.mSelectedRoute != null) {
// TODO filter types properly
dispatchRouteUnselected(types & sStatic.mSelectedRoute.getSupportedTypes(),