diff options
| author | Jaikumar Ganesh <jaikumar@google.com> | 2011-04-06 11:09:30 -0700 |
|---|---|---|
| committer | Jaikumar Ganesh <jaikumar@google.com> | 2011-04-06 11:11:13 -0700 |
| commit | 6f7a9736602ba1f1dc5a16542aa947861a520ec5 (patch) | |
| tree | 4ff760ae0675f0bf7581716e1cf056f1daeedc60 /core/java/android/bluetooth | |
| parent | 14faa3bd8bd6d1deab63a40ad2f8b6e451a16208 (diff) | |
| download | frameworks_base-6f7a9736602ba1f1dc5a16542aa947861a520ec5.zip frameworks_base-6f7a9736602ba1f1dc5a16542aa947861a520ec5.tar.gz frameworks_base-6f7a9736602ba1f1dc5a16542aa947861a520ec5.tar.bz2 | |
Check if BT is disabled or not when sending audio state.
When BT is turning off we need to send the audio state intent.
We were not doing this since the state was turning off.
The check was added to prevent misuse of public APIs, since
these functions are used internally, its not a problem.
Change-Id: I9834cbff741722bf99c2875fa65c0617b7b4807b
Diffstat (limited to 'core/java/android/bluetooth')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothHeadset.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index fa55520..8a9bef0 100644 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java @@ -603,7 +603,7 @@ public final class BluetoothHeadset implements BluetoothProfile { */ public boolean setAudioState(BluetoothDevice device, int state) { if (DBG) log("setAudioState"); - if (mService != null && isEnabled()) { + if (mService != null && !isDisabled()) { try { return mService.setAudioState(device, state); } catch (RemoteException e) {Log.e(TAG, e.toString());} @@ -622,7 +622,7 @@ public final class BluetoothHeadset implements BluetoothProfile { */ public int getAudioState(BluetoothDevice device) { if (DBG) log("getAudioState"); - if (mService != null && isEnabled()) { + if (mService != null && !isDisabled()) { try { return mService.getAudioState(device); } catch (RemoteException e) {Log.e(TAG, e.toString());} @@ -705,6 +705,11 @@ public final class BluetoothHeadset implements BluetoothProfile { return false; } + private boolean isDisabled() { + if (mAdapter.getState() == BluetoothAdapter.STATE_OFF) return true; + return false; + } + private boolean isValidDevice(BluetoothDevice device) { if (device == null) return false; |
