diff options
Diffstat (limited to 'core/java/android/bluetooth/BluetoothPbap.java')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothPbap.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java index b5280e533778..c42251f4367b 100644 --- a/core/java/android/bluetooth/BluetoothPbap.java +++ b/core/java/android/bluetooth/BluetoothPbap.java @@ -129,11 +129,7 @@ public class BluetoothPbap { try { if (mService == null) { if (VDBG) Log.d(TAG,"Binding service..."); - if (!mContext.bindService( - new Intent(IBluetoothPbap.class.getName()), - mConnection, 0)) { - Log.e(TAG, "Could not bind to Bluetooth PBAP Service"); - } + doBind(); } } catch (Exception re) { Log.e(TAG,"",re); @@ -158,9 +154,18 @@ public class BluetoothPbap { Log.e(TAG,"",e); } } - if (!context.bindService(new Intent(IBluetoothPbap.class.getName()), mConnection, 0)) { - Log.e(TAG, "Could not bind to Bluetooth Pbap Service"); + doBind(); + } + + boolean doBind() { + Intent intent = new Intent(IBluetoothPbap.class.getName()); + ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0); + intent.setComponent(comp); + if (comp == null || !mContext.bindService(intent, mConnection, 0)) { + Log.e(TAG, "Could not bind to Bluetooth Pbap Service with " + intent); + return false; } + return true; } protected void finalize() throws Throwable { |
