The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.bluetooth; |
| 18 | |
Tor Norbye | 2d49752 | 2015-04-23 17:10:21 -0700 | [diff] [blame] | 19 | import android.Manifest; |
| 20 | import android.annotation.RequiresPermission; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import android.annotation.SdkConstant; |
| 22 | import android.annotation.SdkConstant.SdkConstantType; |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 23 | import android.content.ComponentName; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | import android.content.Context; |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 25 | import android.content.Intent; |
| 26 | import android.content.ServiceConnection; |
RoboErik | 4197cb6 | 2015-01-21 15:45:32 -0800 | [diff] [blame] | 27 | import android.media.AudioManager; |
Jeff Sharkey | 0a17db1 | 2016-11-04 11:23:46 -0600 | [diff] [blame^] | 28 | import android.os.Binder; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | import android.os.IBinder; |
Jaikumar Ganesh | 41d5c80 | 2010-10-13 19:11:28 -0700 | [diff] [blame] | 30 | import android.os.ParcelUuid; |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 31 | import android.os.RemoteException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | import android.util.Log; |
| 33 | |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 34 | import com.android.internal.annotations.GuardedBy; |
| 35 | |
Jaikumar Ganesh | 03cd78c | 2010-10-18 16:41:53 -0700 | [diff] [blame] | 36 | import java.util.ArrayList; |
| 37 | import java.util.List; |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 38 | import java.util.concurrent.locks.ReentrantReadWriteLock; |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 39 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | |
| 41 | /** |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 42 | * This class provides the public APIs to control the Bluetooth A2DP |
| 43 | * profile. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | * |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 45 | *<p>BluetoothA2dp is a proxy object for controlling the Bluetooth A2DP |
| 46 | * Service via IPC. Use {@link BluetoothAdapter#getProfileProxy} to get |
| 47 | * the BluetoothA2dp proxy object. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | * |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 49 | * <p> Android only supports one connected Bluetooth A2dp device at a time. |
| 50 | * Each method is protected with its appropriate permission. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | */ |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 52 | public final class BluetoothA2dp implements BluetoothProfile { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | private static final String TAG = "BluetoothA2dp"; |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 54 | private static final boolean DBG = true; |
Matthew Xie | 563e414 | 2012-10-09 22:10:37 -0700 | [diff] [blame] | 55 | private static final boolean VDBG = false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 57 | /** |
| 58 | * Intent used to broadcast the change in connection state of the A2DP |
| 59 | * profile. |
| 60 | * |
| 61 | * <p>This intent will have 3 extras: |
Jaikumar Ganesh | c8fa4ff | 2011-01-25 16:03:13 -0800 | [diff] [blame] | 62 | * <ul> |
| 63 | * <li> {@link #EXTRA_STATE} - The current state of the profile. </li> |
| 64 | * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.</li> |
| 65 | * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li> |
| 66 | * </ul> |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 67 | * |
Jaikumar Ganesh | 0706fed | 2011-01-26 11:46:56 -0800 | [diff] [blame] | 68 | * <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 69 | * {@link #STATE_DISCONNECTED}, {@link #STATE_CONNECTING}, |
| 70 | * {@link #STATE_CONNECTED}, {@link #STATE_DISCONNECTING}. |
| 71 | * |
Jaikumar Ganesh | c8fa4ff | 2011-01-25 16:03:13 -0800 | [diff] [blame] | 72 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission to |
| 73 | * receive. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | */ |
| 75 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 76 | public static final String ACTION_CONNECTION_STATE_CHANGED = |
| 77 | "android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 78 | |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 79 | /** |
| 80 | * Intent used to broadcast the change in the Playing state of the A2DP |
| 81 | * profile. |
| 82 | * |
| 83 | * <p>This intent will have 3 extras: |
Jaikumar Ganesh | c8fa4ff | 2011-01-25 16:03:13 -0800 | [diff] [blame] | 84 | * <ul> |
| 85 | * <li> {@link #EXTRA_STATE} - The current state of the profile. </li> |
| 86 | * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile. </li> |
Jaikumar Ganesh | 0706fed | 2011-01-26 11:46:56 -0800 | [diff] [blame] | 87 | * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li> |
Jaikumar Ganesh | c8fa4ff | 2011-01-25 16:03:13 -0800 | [diff] [blame] | 88 | * </ul> |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 89 | * |
Jaikumar Ganesh | 0706fed | 2011-01-26 11:46:56 -0800 | [diff] [blame] | 90 | * <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 91 | * {@link #STATE_PLAYING}, {@link #STATE_NOT_PLAYING}, |
| 92 | * |
Jaikumar Ganesh | c8fa4ff | 2011-01-25 16:03:13 -0800 | [diff] [blame] | 93 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission to |
| 94 | * receive. |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 95 | */ |
| 96 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 97 | public static final String ACTION_PLAYING_STATE_CHANGED = |
| 98 | "android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 99 | |
Hemant Gupta | 3b76a4b | 2014-02-14 19:53:31 +0530 | [diff] [blame] | 100 | /** @hide */ |
| 101 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 102 | public static final String ACTION_AVRCP_CONNECTION_STATE_CHANGED = |
| 103 | "android.bluetooth.a2dp.profile.action.AVRCP_CONNECTION_STATE_CHANGED"; |
| 104 | |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 105 | /** |
| 106 | * A2DP sink device is streaming music. This state can be one of |
| 107 | * {@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} of |
| 108 | * {@link #ACTION_PLAYING_STATE_CHANGED} intent. |
| 109 | */ |
| 110 | public static final int STATE_PLAYING = 10; |
Nick Pelly | bd022f4 | 2009-08-14 18:33:38 -0700 | [diff] [blame] | 111 | |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 112 | /** |
| 113 | * A2DP sink device is NOT streaming music. This state can be one of |
| 114 | * {@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} of |
| 115 | * {@link #ACTION_PLAYING_STATE_CHANGED} intent. |
| 116 | */ |
| 117 | public static final int STATE_NOT_PLAYING = 11; |
| 118 | |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 119 | private Context mContext; |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 120 | private ServiceListener mServiceListener; |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 121 | private final ReentrantReadWriteLock mServiceLock = new ReentrantReadWriteLock(); |
| 122 | @GuardedBy("mServiceLock") private IBluetoothA2dp mService; |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 123 | private BluetoothAdapter mAdapter; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 124 | |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 125 | final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback = |
| 126 | new IBluetoothStateChangeCallback.Stub() { |
| 127 | public void onBluetoothStateChange(boolean up) { |
| 128 | if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up); |
| 129 | if (!up) { |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 130 | if (VDBG) Log.d(TAG, "Unbinding service..."); |
| 131 | try { |
| 132 | mServiceLock.writeLock().lock(); |
| 133 | mService = null; |
| 134 | mContext.unbindService(mConnection); |
| 135 | } catch (Exception re) { |
| 136 | Log.e(TAG, "", re); |
| 137 | } finally { |
| 138 | mServiceLock.writeLock().unlock(); |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 139 | } |
| 140 | } else { |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 141 | try { |
| 142 | mServiceLock.readLock().lock(); |
| 143 | if (mService == null) { |
| 144 | if (VDBG) Log.d(TAG,"Binding service..."); |
| 145 | doBind(); |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 146 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 147 | } catch (Exception re) { |
| 148 | Log.e(TAG,"",re); |
| 149 | } finally { |
| 150 | mServiceLock.readLock().unlock(); |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 151 | } |
| 152 | } |
| 153 | } |
| 154 | }; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | /** |
| 156 | * Create a BluetoothA2dp proxy object for interacting with the local |
| 157 | * Bluetooth A2DP service. |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 158 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 159 | */ |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 160 | /*package*/ BluetoothA2dp(Context context, ServiceListener l) { |
| 161 | mContext = context; |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 162 | mServiceListener = l; |
| 163 | mAdapter = BluetoothAdapter.getDefaultAdapter(); |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 164 | IBluetoothManager mgr = mAdapter.getBluetoothManager(); |
| 165 | if (mgr != null) { |
| 166 | try { |
| 167 | mgr.registerStateChangeCallback(mBluetoothStateChangeCallback); |
| 168 | } catch (RemoteException e) { |
| 169 | Log.e(TAG,"",e); |
| 170 | } |
| 171 | } |
| 172 | |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 173 | doBind(); |
| 174 | } |
| 175 | |
| 176 | boolean doBind() { |
| 177 | Intent intent = new Intent(IBluetoothA2dp.class.getName()); |
| 178 | ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0); |
| 179 | intent.setComponent(comp); |
Dianne Hackborn | 466ce96 | 2014-03-19 18:06:58 -0700 | [diff] [blame] | 180 | if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0, |
| 181 | android.os.Process.myUserHandle())) { |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 182 | Log.e(TAG, "Could not bind to Bluetooth A2DP Service with " + intent); |
| 183 | return false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 184 | } |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 185 | return true; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 186 | } |
| 187 | |
Jaikumar Ganesh | 9bb2751 | 2011-11-28 09:59:08 -0800 | [diff] [blame] | 188 | /*package*/ void close() { |
| 189 | mServiceListener = null; |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 190 | IBluetoothManager mgr = mAdapter.getBluetoothManager(); |
| 191 | if (mgr != null) { |
| 192 | try { |
| 193 | mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback); |
| 194 | } catch (Exception e) { |
| 195 | Log.e(TAG,"",e); |
| 196 | } |
| 197 | } |
| 198 | |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 199 | try { |
| 200 | mServiceLock.writeLock().lock(); |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 201 | if (mService != null) { |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 202 | mService = null; |
| 203 | mContext.unbindService(mConnection); |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 204 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 205 | } catch (Exception re) { |
| 206 | Log.e(TAG, "", re); |
| 207 | } finally { |
| 208 | mServiceLock.writeLock().unlock(); |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 209 | } |
Jaikumar Ganesh | 9bb2751 | 2011-11-28 09:59:08 -0800 | [diff] [blame] | 210 | } |
| 211 | |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 212 | public void finalize() { |
Mathias Jeppsson | 2d2d8c2 | 2013-08-06 11:41:55 +0200 | [diff] [blame] | 213 | // The empty finalize needs to be kept or the |
| 214 | // cts signature tests would fail. |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 215 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 216 | /** |
Jaikumar Ganesh | f878916 | 2011-05-26 13:56:40 -0700 | [diff] [blame] | 217 | * Initiate connection to a profile of the remote bluetooth device. |
| 218 | * |
| 219 | * <p> Currently, the system supports only 1 connection to the |
| 220 | * A2DP profile. The API will automatically disconnect connected |
| 221 | * devices before connecting. |
| 222 | * |
| 223 | * <p> This API returns false in scenarios like the profile on the |
| 224 | * device is already connected or Bluetooth is not turned on. |
| 225 | * When this API returns true, it is guaranteed that |
| 226 | * connection state intent for the profile will be broadcasted with |
| 227 | * the state. Users can get the connection state of the profile |
| 228 | * from this intent. |
| 229 | * |
| 230 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} |
| 231 | * permission. |
| 232 | * |
| 233 | * @param device Remote Bluetooth Device |
| 234 | * @return false on immediate error, |
| 235 | * true otherwise |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 236 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 237 | */ |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 238 | public boolean connect(BluetoothDevice device) { |
| 239 | if (DBG) log("connect(" + device + ")"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 240 | try { |
| 241 | mServiceLock.readLock().lock(); |
| 242 | if (mService != null && isEnabled() && |
| 243 | isValidDevice(device)) { |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 244 | return mService.connect(device); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 245 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 246 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 247 | return false; |
| 248 | } catch (RemoteException e) { |
| 249 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 250 | return false; |
| 251 | } finally { |
| 252 | mServiceLock.readLock().unlock(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 256 | /** |
Jaikumar Ganesh | f878916 | 2011-05-26 13:56:40 -0700 | [diff] [blame] | 257 | * Initiate disconnection from a profile |
| 258 | * |
| 259 | * <p> This API will return false in scenarios like the profile on the |
| 260 | * Bluetooth device is not in connected state etc. When this API returns, |
| 261 | * true, it is guaranteed that the connection state change |
| 262 | * intent will be broadcasted with the state. Users can get the |
| 263 | * disconnection state of the profile from this intent. |
| 264 | * |
| 265 | * <p> If the disconnection is initiated by a remote device, the state |
| 266 | * will transition from {@link #STATE_CONNECTED} to |
| 267 | * {@link #STATE_DISCONNECTED}. If the disconnect is initiated by the |
| 268 | * host (local) device the state will transition from |
| 269 | * {@link #STATE_CONNECTED} to state {@link #STATE_DISCONNECTING} to |
| 270 | * state {@link #STATE_DISCONNECTED}. The transition to |
| 271 | * {@link #STATE_DISCONNECTING} can be used to distinguish between the |
| 272 | * two scenarios. |
| 273 | * |
| 274 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} |
| 275 | * permission. |
| 276 | * |
| 277 | * @param device Remote Bluetooth Device |
| 278 | * @return false on immediate error, |
| 279 | * true otherwise |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 280 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 281 | */ |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 282 | public boolean disconnect(BluetoothDevice device) { |
| 283 | if (DBG) log("disconnect(" + device + ")"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 284 | try { |
| 285 | mServiceLock.readLock().lock(); |
| 286 | if (mService != null && isEnabled() && |
| 287 | isValidDevice(device)) { |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 288 | return mService.disconnect(device); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 289 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 290 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 291 | return false; |
| 292 | } catch (RemoteException e) { |
| 293 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 294 | return false; |
| 295 | } finally { |
| 296 | mServiceLock.readLock().unlock(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 297 | } |
| 298 | } |
| 299 | |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 300 | /** |
| 301 | * {@inheritDoc} |
| 302 | */ |
Jaikumar Ganesh | 03cd78c | 2010-10-18 16:41:53 -0700 | [diff] [blame] | 303 | public List<BluetoothDevice> getConnectedDevices() { |
Matthew Xie | 563e414 | 2012-10-09 22:10:37 -0700 | [diff] [blame] | 304 | if (VDBG) log("getConnectedDevices()"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 305 | try { |
| 306 | mServiceLock.readLock().lock(); |
| 307 | if (mService != null && isEnabled()) { |
Jaikumar Ganesh | 03cd78c | 2010-10-18 16:41:53 -0700 | [diff] [blame] | 308 | return mService.getConnectedDevices(); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 309 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 310 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 311 | return new ArrayList<BluetoothDevice>(); |
| 312 | } catch (RemoteException e) { |
| 313 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 314 | return new ArrayList<BluetoothDevice>(); |
| 315 | } finally { |
| 316 | mServiceLock.readLock().unlock(); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 317 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | /** |
| 321 | * {@inheritDoc} |
| 322 | */ |
Jaikumar Ganesh | 03cd78c | 2010-10-18 16:41:53 -0700 | [diff] [blame] | 323 | public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { |
Matthew Xie | 563e414 | 2012-10-09 22:10:37 -0700 | [diff] [blame] | 324 | if (VDBG) log("getDevicesMatchingStates()"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 325 | try { |
| 326 | mServiceLock.readLock().lock(); |
| 327 | if (mService != null && isEnabled()) { |
Jaikumar Ganesh | 03cd78c | 2010-10-18 16:41:53 -0700 | [diff] [blame] | 328 | return mService.getDevicesMatchingConnectionStates(states); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 329 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 330 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 331 | return new ArrayList<BluetoothDevice>(); |
| 332 | } catch (RemoteException e) { |
| 333 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 334 | return new ArrayList<BluetoothDevice>(); |
| 335 | } finally { |
| 336 | mServiceLock.readLock().unlock(); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 337 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | /** |
| 341 | * {@inheritDoc} |
| 342 | */ |
| 343 | public int getConnectionState(BluetoothDevice device) { |
Matthew Xie | 563e414 | 2012-10-09 22:10:37 -0700 | [diff] [blame] | 344 | if (VDBG) log("getState(" + device + ")"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 345 | try { |
| 346 | mServiceLock.readLock().lock(); |
| 347 | if (mService != null && isEnabled() |
| 348 | && isValidDevice(device)) { |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 349 | return mService.getConnectionState(device); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 350 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 351 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 352 | return BluetoothProfile.STATE_DISCONNECTED; |
| 353 | } catch (RemoteException e) { |
| 354 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 355 | return BluetoothProfile.STATE_DISCONNECTED; |
| 356 | } finally { |
| 357 | mServiceLock.readLock().unlock(); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 358 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 359 | } |
| 360 | |
| 361 | /** |
Jaikumar Ganesh | f878916 | 2011-05-26 13:56:40 -0700 | [diff] [blame] | 362 | * Set priority of the profile |
| 363 | * |
| 364 | * <p> The device should already be paired. |
fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 365 | * Priority can be one of {@link #PRIORITY_ON} orgetBluetoothManager |
Jaikumar Ganesh | f878916 | 2011-05-26 13:56:40 -0700 | [diff] [blame] | 366 | * {@link #PRIORITY_OFF}, |
| 367 | * |
| 368 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} |
| 369 | * permission. |
| 370 | * |
| 371 | * @param device Paired bluetooth device |
| 372 | * @param priority |
| 373 | * @return true if priority is set, false on error |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 374 | * @hide |
| 375 | */ |
| 376 | public boolean setPriority(BluetoothDevice device, int priority) { |
| 377 | if (DBG) log("setPriority(" + device + ", " + priority + ")"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 378 | try { |
| 379 | mServiceLock.readLock().lock(); |
| 380 | if (mService != null && isEnabled() |
| 381 | && isValidDevice(device)) { |
| 382 | if (priority != BluetoothProfile.PRIORITY_OFF && |
| 383 | priority != BluetoothProfile.PRIORITY_ON) { |
| 384 | return false; |
| 385 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 386 | return mService.setPriority(device, priority); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 387 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 388 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 389 | return false; |
| 390 | } catch (RemoteException e) { |
| 391 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 392 | return false; |
| 393 | } finally { |
| 394 | mServiceLock.readLock().unlock(); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 395 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | /** |
Jaikumar Ganesh | f878916 | 2011-05-26 13:56:40 -0700 | [diff] [blame] | 399 | * Get the priority of the profile. |
| 400 | * |
| 401 | * <p> The priority can be any of: |
| 402 | * {@link #PRIORITY_AUTO_CONNECT}, {@link #PRIORITY_OFF}, |
| 403 | * {@link #PRIORITY_ON}, {@link #PRIORITY_UNDEFINED} |
| 404 | * |
| 405 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. |
| 406 | * |
| 407 | * @param device Bluetooth device |
| 408 | * @return priority of the device |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 409 | * @hide |
| 410 | */ |
Tor Norbye | 2d49752 | 2015-04-23 17:10:21 -0700 | [diff] [blame] | 411 | @RequiresPermission(Manifest.permission.BLUETOOTH) |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 412 | public int getPriority(BluetoothDevice device) { |
Matthew Xie | 563e414 | 2012-10-09 22:10:37 -0700 | [diff] [blame] | 413 | if (VDBG) log("getPriority(" + device + ")"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 414 | try { |
| 415 | mServiceLock.readLock().lock(); |
| 416 | if (mService != null && isEnabled() |
| 417 | && isValidDevice(device)) { |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 418 | return mService.getPriority(device); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 419 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 420 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 421 | return BluetoothProfile.PRIORITY_OFF; |
| 422 | } catch (RemoteException e) { |
| 423 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 424 | return BluetoothProfile.PRIORITY_OFF; |
| 425 | } finally { |
| 426 | mServiceLock.readLock().unlock(); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 427 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 428 | } |
| 429 | |
| 430 | /** |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 431 | * Checks if Avrcp device supports the absolute volume feature. |
| 432 | * |
| 433 | * @return true if device supports absolute volume |
| 434 | * @hide |
| 435 | */ |
| 436 | public boolean isAvrcpAbsoluteVolumeSupported() { |
| 437 | if (DBG) Log.d(TAG, "isAvrcpAbsoluteVolumeSupported"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 438 | try { |
| 439 | mServiceLock.readLock().lock(); |
| 440 | if (mService != null && isEnabled()) { |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 441 | return mService.isAvrcpAbsoluteVolumeSupported(); |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 442 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 443 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 444 | return false; |
| 445 | } catch (RemoteException e) { |
| 446 | Log.e(TAG, "Error talking to BT service in isAvrcpAbsoluteVolumeSupported()", e); |
| 447 | return false; |
| 448 | } finally { |
| 449 | mServiceLock.readLock().unlock(); |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 450 | } |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | /** |
RoboErik | 4197cb6 | 2015-01-21 15:45:32 -0800 | [diff] [blame] | 454 | * Tells remote device to adjust volume. Only if absolute volume is |
| 455 | * supported. Uses the following values: |
| 456 | * <ul> |
| 457 | * <li>{@link AudioManager#ADJUST_LOWER}</li> |
| 458 | * <li>{@link AudioManager#ADJUST_RAISE}</li> |
| 459 | * <li>{@link AudioManager#ADJUST_MUTE}</li> |
| 460 | * <li>{@link AudioManager#ADJUST_UNMUTE}</li> |
| 461 | * </ul> |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 462 | * |
RoboErik | 4197cb6 | 2015-01-21 15:45:32 -0800 | [diff] [blame] | 463 | * @param direction One of the supported adjust values. |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 464 | * @hide |
| 465 | */ |
| 466 | public void adjustAvrcpAbsoluteVolume(int direction) { |
| 467 | if (DBG) Log.d(TAG, "adjustAvrcpAbsoluteVolume"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 468 | try { |
| 469 | mServiceLock.readLock().lock(); |
| 470 | if (mService != null && isEnabled()) { |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 471 | mService.adjustAvrcpAbsoluteVolume(direction); |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 472 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 473 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 474 | } catch (RemoteException e) { |
| 475 | Log.e(TAG, "Error talking to BT service in adjustAvrcpAbsoluteVolume()", e); |
| 476 | } finally { |
| 477 | mServiceLock.readLock().unlock(); |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 478 | } |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 479 | } |
| 480 | |
| 481 | /** |
| 482 | * Tells remote device to set an absolute volume. Only if absolute volume is supported |
| 483 | * |
| 484 | * @param volume Absolute volume to be set on AVRCP side |
| 485 | * @hide |
| 486 | */ |
| 487 | public void setAvrcpAbsoluteVolume(int volume) { |
| 488 | if (DBG) Log.d(TAG, "setAvrcpAbsoluteVolume"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 489 | try { |
| 490 | mServiceLock.readLock().lock(); |
| 491 | if (mService != null && isEnabled()) { |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 492 | mService.setAvrcpAbsoluteVolume(volume); |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 493 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 494 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 495 | } catch (RemoteException e) { |
| 496 | Log.e(TAG, "Error talking to BT service in setAvrcpAbsoluteVolume()", e); |
| 497 | } finally { |
| 498 | mServiceLock.readLock().unlock(); |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 499 | } |
John Du | 5a0cf7a | 2013-07-19 11:30:34 -0700 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | /** |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 503 | * Check if A2DP profile is streaming music. |
| 504 | * |
Jaikumar Ganesh | c8fa4ff | 2011-01-25 16:03:13 -0800 | [diff] [blame] | 505 | * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 506 | * |
| 507 | * @param device BluetoothDevice device |
| 508 | */ |
| 509 | public boolean isA2dpPlaying(BluetoothDevice device) { |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 510 | try { |
| 511 | mServiceLock.readLock().lock(); |
| 512 | if (mService != null && isEnabled() |
| 513 | && isValidDevice(device)) { |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 514 | return mService.isA2dpPlaying(device); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 515 | } |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 516 | if (mService == null) Log.w(TAG, "Proxy not attached to service"); |
| 517 | return false; |
| 518 | } catch (RemoteException e) { |
| 519 | Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); |
| 520 | return false; |
| 521 | } finally { |
| 522 | mServiceLock.readLock().unlock(); |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 523 | } |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | /** |
Jaikumar Ganesh | 41d5c80 | 2010-10-13 19:11:28 -0700 | [diff] [blame] | 527 | * This function checks if the remote device is an AVCRP |
| 528 | * target and thus whether we should send volume keys |
| 529 | * changes or not. |
| 530 | * @hide |
| 531 | */ |
| 532 | public boolean shouldSendVolumeKeys(BluetoothDevice device) { |
| 533 | if (isEnabled() && isValidDevice(device)) { |
| 534 | ParcelUuid[] uuids = device.getUuids(); |
| 535 | if (uuids == null) return false; |
| 536 | |
| 537 | for (ParcelUuid uuid: uuids) { |
| 538 | if (BluetoothUuid.isAvrcpTarget(uuid)) { |
| 539 | return true; |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | return false; |
| 544 | } |
| 545 | |
Matthew Xie | a0c6803 | 2011-06-25 21:47:07 -0700 | [diff] [blame] | 546 | /** |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 547 | * Helper for converting a state to a string. |
| 548 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 549 | * For debug use only - strings are not internationalized. |
| 550 | * @hide |
| 551 | */ |
| 552 | public static String stateToString(int state) { |
| 553 | switch (state) { |
| 554 | case STATE_DISCONNECTED: |
| 555 | return "disconnected"; |
| 556 | case STATE_CONNECTING: |
| 557 | return "connecting"; |
| 558 | case STATE_CONNECTED: |
| 559 | return "connected"; |
| 560 | case STATE_DISCONNECTING: |
| 561 | return "disconnecting"; |
| 562 | case STATE_PLAYING: |
| 563 | return "playing"; |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 564 | case STATE_NOT_PLAYING: |
| 565 | return "not playing"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 566 | default: |
| 567 | return "<unknown state " + state + ">"; |
| 568 | } |
| 569 | } |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 570 | |
Matthew Xie | 9b69399 | 2013-10-10 11:21:40 -0700 | [diff] [blame] | 571 | private final ServiceConnection mConnection = new ServiceConnection() { |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 572 | public void onServiceConnected(ComponentName className, IBinder service) { |
| 573 | if (DBG) Log.d(TAG, "Proxy object connected"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 574 | try { |
| 575 | mServiceLock.writeLock().lock(); |
Jeff Sharkey | 0a17db1 | 2016-11-04 11:23:46 -0600 | [diff] [blame^] | 576 | mService = IBluetoothA2dp.Stub.asInterface(Binder.allowBlocking(service)); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 577 | } finally { |
| 578 | mServiceLock.writeLock().unlock(); |
| 579 | } |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 580 | |
| 581 | if (mServiceListener != null) { |
| 582 | mServiceListener.onServiceConnected(BluetoothProfile.A2DP, BluetoothA2dp.this); |
| 583 | } |
| 584 | } |
| 585 | public void onServiceDisconnected(ComponentName className) { |
| 586 | if (DBG) Log.d(TAG, "Proxy object disconnected"); |
Calvin On | d7d16b9 | 2016-06-20 15:59:48 -0700 | [diff] [blame] | 587 | try { |
| 588 | mServiceLock.writeLock().lock(); |
| 589 | mService = null; |
| 590 | } finally { |
| 591 | mServiceLock.writeLock().unlock(); |
| 592 | } |
Matthew Xie | 3e8c82e | 2012-02-16 16:57:18 -0800 | [diff] [blame] | 593 | if (mServiceListener != null) { |
| 594 | mServiceListener.onServiceDisconnected(BluetoothProfile.A2DP); |
| 595 | } |
| 596 | } |
| 597 | }; |
| 598 | |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 599 | private boolean isEnabled() { |
| 600 | if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; |
| 601 | return false; |
| 602 | } |
| 603 | |
| 604 | private boolean isValidDevice(BluetoothDevice device) { |
| 605 | if (device == null) return false; |
| 606 | |
| 607 | if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true; |
| 608 | return false; |
| 609 | } |
| 610 | |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 611 | private static void log(String msg) { |
Jaikumar Ganesh | 62c37ef | 2010-08-24 17:36:13 -0700 | [diff] [blame] | 612 | Log.d(TAG, msg); |
The Android Open Source Project | f5b4b98 | 2009-03-05 20:00:43 -0800 | [diff] [blame] | 613 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 614 | } |