Loading Android.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -91,6 +91,7 @@ LOCAL_SRC_FILES += \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl \ core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl \ core/java/android/bluetooth/IBluetoothHealthCallback.aidl \ core/java/android/bluetooth/IBluetoothHealthCallback.aidl \ core/java/android/bluetooth/IBluetoothInputDevice.aidl \ core/java/android/bluetooth/IBluetoothPbap.aidl \ core/java/android/bluetooth/IBluetoothPbap.aidl \ core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \ core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \ core/java/android/content/IClipboard.aidl \ core/java/android/content/IClipboard.aidl \ Loading core/java/android/bluetooth/BluetoothHeadset.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -219,7 +219,7 @@ public final class BluetoothHeadset implements BluetoothProfile { private Context mContext; private Context mContext; private ServiceListener mServiceListener; private ServiceListener mServiceListener; private IBluetoothHeadset mService; private IBluetoothHeadset mService; BluetoothAdapter mAdapter; private BluetoothAdapter mAdapter; /** /** * Create a BluetoothHeadset proxy object. * Create a BluetoothHeadset proxy object. Loading core/java/android/bluetooth/BluetoothInputDevice.java +52 −53 Original line number Original line Diff line number Diff line Loading @@ -18,10 +18,12 @@ package android.bluetooth; import android.annotation.SdkConstant; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SdkConstant.SdkConstantType; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.os.IBinder; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import android.util.Log; import java.util.ArrayList; import java.util.ArrayList; Loading Loading @@ -91,34 +93,32 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public static final int INPUT_OPERATION_SUCCESS = 5004; public static final int INPUT_OPERATION_SUCCESS = 5004; private Context mContext; private ServiceListener mServiceListener; private ServiceListener mServiceListener; private BluetoothAdapter mAdapter; private BluetoothAdapter mAdapter; private IBluetooth mService; private IBluetoothInputDevice mService; /** /** * Create a BluetoothInputDevice proxy object for interacting with the local * Create a BluetoothInputDevice proxy object for interacting with the local * Bluetooth Service which handles the InputDevice profile * Bluetooth Service which handles the InputDevice profile * * */ */ /*package*/ BluetoothInputDevice(Context mContext, ServiceListener l) { /*package*/ BluetoothInputDevice(Context context, ServiceListener l) { IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); mContext = context; mServiceListener = l; mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); mAdapter = BluetoothAdapter.getDefaultAdapter(); if (b != null) { if (!context.bindService(new Intent(IBluetoothInputDevice.class.getName()), mService = IBluetooth.Stub.asInterface(b); mConnection, 0)) { if (mServiceListener != null) { Log.e(TAG, "Could not bind to Bluetooth HID Service"); mServiceListener.onServiceConnected(BluetoothProfile.INPUT_DEVICE, this); } } else { Log.w(TAG, "Bluetooth Service not available!"); // Instead of throwing an exception which prevents people from going // into Wireless settings in the emulator. Let it crash later when it is actually used. mService = null; } } } } /*package*/ void close() { /*package*/ void close() { if (DBG) log("close()"); if (mConnection != null) { mContext.unbindService(mConnection); mConnection = null; } mServiceListener = null; mServiceListener = null; } } Loading @@ -144,16 +144,13 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public boolean connect(BluetoothDevice device) { public boolean connect(BluetoothDevice device) { if (DBG) log("connect(" + device + ")"); if (DBG) log("connect(" + device + ")"); if (mService != null && isEnabled() && if (mService != null && isEnabled() && isValidDevice(device)) { isValidDevice(device)) { //TODO(BT) /* try { try { return mService.connectInputDevice(device); return mService.connect(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; return false; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; return false; Loading Loading @@ -187,16 +184,13 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public boolean disconnect(BluetoothDevice device) { public boolean disconnect(BluetoothDevice device) { if (DBG) log("disconnect(" + device + ")"); if (DBG) log("disconnect(" + device + ")"); if (mService != null && isEnabled() && if (mService != null && isEnabled() && isValidDevice(device)) { isValidDevice(device)) { //TODO(BT) /* try { try { return mService.disconnectInputDevice(device); return mService.disconnect(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; return false; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; return false; Loading @@ -208,14 +202,12 @@ public final class BluetoothInputDevice implements BluetoothProfile { public List<BluetoothDevice> getConnectedDevices() { public List<BluetoothDevice> getConnectedDevices() { if (DBG) log("getConnectedDevices()"); if (DBG) log("getConnectedDevices()"); if (mService != null && isEnabled()) { if (mService != null && isEnabled()) { //TODO(BT) /* try { try { return mService.getConnectedInputDevices(); return mService.getConnectedDevices(); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); Loading @@ -227,14 +219,12 @@ public final class BluetoothInputDevice implements BluetoothProfile { public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { if (DBG) log("getDevicesMatchingStates()"); if (DBG) log("getDevicesMatchingStates()"); if (mService != null && isEnabled()) { if (mService != null && isEnabled()) { //TODO(BT) /* try { try { return mService.getInputDevicesMatchingConnectionStates(states); return mService.getDevicesMatchingConnectionStates(states); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); Loading @@ -245,16 +235,13 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public int getConnectionState(BluetoothDevice device) { public int getConnectionState(BluetoothDevice device) { if (DBG) log("getState(" + device + ")"); if (DBG) log("getState(" + device + ")"); if (mService != null && isEnabled() if (mService != null && isEnabled() && isValidDevice(device)) { && isValidDevice(device)) { //TODO(BT) /* try { try { return mService.getInputDeviceConnectionState(device); return mService.getConnectionState(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.STATE_DISCONNECTED; return BluetoothProfile.STATE_DISCONNECTED; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return BluetoothProfile.STATE_DISCONNECTED; return BluetoothProfile.STATE_DISCONNECTED; Loading @@ -277,20 +264,17 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public boolean setPriority(BluetoothDevice device, int priority) { public boolean setPriority(BluetoothDevice device, int priority) { if (DBG) log("setPriority(" + device + ", " + priority + ")"); if (DBG) log("setPriority(" + device + ", " + priority + ")"); if (mService != null && isEnabled() if (mService != null && isEnabled() && isValidDevice(device)) { && isValidDevice(device)) { if (priority != BluetoothProfile.PRIORITY_OFF && if (priority != BluetoothProfile.PRIORITY_OFF && priority != BluetoothProfile.PRIORITY_ON) { priority != BluetoothProfile.PRIORITY_ON) { return false; return false; } } //TODO(BT) /* try { try { return mService.setInputDevicePriority(device, priority); return mService.setPriority(device, priority); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; return false; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; return false; Loading @@ -311,21 +295,36 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public int getPriority(BluetoothDevice device) { public int getPriority(BluetoothDevice device) { if (DBG) log("getPriority(" + device + ")"); if (DBG) log("getPriority(" + device + ")"); if (mService != null && isEnabled() if (mService != null && isEnabled() && isValidDevice(device)) { && isValidDevice(device)) { //TODO(BT) /* try { try { return mService.getInputDevicePriority(device); return mService.getPriority(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.PRIORITY_OFF; return BluetoothProfile.PRIORITY_OFF; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return BluetoothProfile.PRIORITY_OFF; return BluetoothProfile.PRIORITY_OFF; } } private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) Log.d(TAG, "Proxy object connected"); mService = IBluetoothInputDevice.Stub.asInterface(service); if (mServiceListener != null) { mServiceListener.onServiceConnected(BluetoothProfile.INPUT_DEVICE, BluetoothInputDevice.this); } } public void onServiceDisconnected(ComponentName className) { if (DBG) Log.d(TAG, "Proxy object disconnected"); mService = null; if (mServiceListener != null) { mServiceListener.onServiceDisconnected(BluetoothProfile.INPUT_DEVICE); } } }; private boolean isEnabled() { private boolean isEnabled() { if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; return false; return false; Loading core/java/android/bluetooth/IBluetoothInputDevice.aidl 0 → 100644 +22 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2012 Google Inc. */ package android.bluetooth; import android.bluetooth.BluetoothDevice; /** * API for Bluetooth HID service * * {@hide} */ interface IBluetoothInputDevice { // Public API boolean connect(in BluetoothDevice device); boolean disconnect(in BluetoothDevice device); List<BluetoothDevice> getConnectedDevices(); List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states); int getConnectionState(in BluetoothDevice device); boolean setPriority(in BluetoothDevice device, int priority); int getPriority(in BluetoothDevice device); } Loading
Android.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -91,6 +91,7 @@ LOCAL_SRC_FILES += \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl \ core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl \ core/java/android/bluetooth/IBluetoothHealthCallback.aidl \ core/java/android/bluetooth/IBluetoothHealthCallback.aidl \ core/java/android/bluetooth/IBluetoothInputDevice.aidl \ core/java/android/bluetooth/IBluetoothPbap.aidl \ core/java/android/bluetooth/IBluetoothPbap.aidl \ core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \ core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \ core/java/android/content/IClipboard.aidl \ core/java/android/content/IClipboard.aidl \ Loading
core/java/android/bluetooth/BluetoothHeadset.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -219,7 +219,7 @@ public final class BluetoothHeadset implements BluetoothProfile { private Context mContext; private Context mContext; private ServiceListener mServiceListener; private ServiceListener mServiceListener; private IBluetoothHeadset mService; private IBluetoothHeadset mService; BluetoothAdapter mAdapter; private BluetoothAdapter mAdapter; /** /** * Create a BluetoothHeadset proxy object. * Create a BluetoothHeadset proxy object. Loading
core/java/android/bluetooth/BluetoothInputDevice.java +52 −53 Original line number Original line Diff line number Diff line Loading @@ -18,10 +18,12 @@ package android.bluetooth; import android.annotation.SdkConstant; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SdkConstant.SdkConstantType; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.os.IBinder; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import android.util.Log; import java.util.ArrayList; import java.util.ArrayList; Loading Loading @@ -91,34 +93,32 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public static final int INPUT_OPERATION_SUCCESS = 5004; public static final int INPUT_OPERATION_SUCCESS = 5004; private Context mContext; private ServiceListener mServiceListener; private ServiceListener mServiceListener; private BluetoothAdapter mAdapter; private BluetoothAdapter mAdapter; private IBluetooth mService; private IBluetoothInputDevice mService; /** /** * Create a BluetoothInputDevice proxy object for interacting with the local * Create a BluetoothInputDevice proxy object for interacting with the local * Bluetooth Service which handles the InputDevice profile * Bluetooth Service which handles the InputDevice profile * * */ */ /*package*/ BluetoothInputDevice(Context mContext, ServiceListener l) { /*package*/ BluetoothInputDevice(Context context, ServiceListener l) { IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); mContext = context; mServiceListener = l; mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); mAdapter = BluetoothAdapter.getDefaultAdapter(); if (b != null) { if (!context.bindService(new Intent(IBluetoothInputDevice.class.getName()), mService = IBluetooth.Stub.asInterface(b); mConnection, 0)) { if (mServiceListener != null) { Log.e(TAG, "Could not bind to Bluetooth HID Service"); mServiceListener.onServiceConnected(BluetoothProfile.INPUT_DEVICE, this); } } else { Log.w(TAG, "Bluetooth Service not available!"); // Instead of throwing an exception which prevents people from going // into Wireless settings in the emulator. Let it crash later when it is actually used. mService = null; } } } } /*package*/ void close() { /*package*/ void close() { if (DBG) log("close()"); if (mConnection != null) { mContext.unbindService(mConnection); mConnection = null; } mServiceListener = null; mServiceListener = null; } } Loading @@ -144,16 +144,13 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public boolean connect(BluetoothDevice device) { public boolean connect(BluetoothDevice device) { if (DBG) log("connect(" + device + ")"); if (DBG) log("connect(" + device + ")"); if (mService != null && isEnabled() && if (mService != null && isEnabled() && isValidDevice(device)) { isValidDevice(device)) { //TODO(BT) /* try { try { return mService.connectInputDevice(device); return mService.connect(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; return false; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; return false; Loading Loading @@ -187,16 +184,13 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public boolean disconnect(BluetoothDevice device) { public boolean disconnect(BluetoothDevice device) { if (DBG) log("disconnect(" + device + ")"); if (DBG) log("disconnect(" + device + ")"); if (mService != null && isEnabled() && if (mService != null && isEnabled() && isValidDevice(device)) { isValidDevice(device)) { //TODO(BT) /* try { try { return mService.disconnectInputDevice(device); return mService.disconnect(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; return false; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; return false; Loading @@ -208,14 +202,12 @@ public final class BluetoothInputDevice implements BluetoothProfile { public List<BluetoothDevice> getConnectedDevices() { public List<BluetoothDevice> getConnectedDevices() { if (DBG) log("getConnectedDevices()"); if (DBG) log("getConnectedDevices()"); if (mService != null && isEnabled()) { if (mService != null && isEnabled()) { //TODO(BT) /* try { try { return mService.getConnectedInputDevices(); return mService.getConnectedDevices(); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); Loading @@ -227,14 +219,12 @@ public final class BluetoothInputDevice implements BluetoothProfile { public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { if (DBG) log("getDevicesMatchingStates()"); if (DBG) log("getDevicesMatchingStates()"); if (mService != null && isEnabled()) { if (mService != null && isEnabled()) { //TODO(BT) /* try { try { return mService.getInputDevicesMatchingConnectionStates(states); return mService.getDevicesMatchingConnectionStates(states); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return new ArrayList<BluetoothDevice>(); return new ArrayList<BluetoothDevice>(); Loading @@ -245,16 +235,13 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public int getConnectionState(BluetoothDevice device) { public int getConnectionState(BluetoothDevice device) { if (DBG) log("getState(" + device + ")"); if (DBG) log("getState(" + device + ")"); if (mService != null && isEnabled() if (mService != null && isEnabled() && isValidDevice(device)) { && isValidDevice(device)) { //TODO(BT) /* try { try { return mService.getInputDeviceConnectionState(device); return mService.getConnectionState(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.STATE_DISCONNECTED; return BluetoothProfile.STATE_DISCONNECTED; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return BluetoothProfile.STATE_DISCONNECTED; return BluetoothProfile.STATE_DISCONNECTED; Loading @@ -277,20 +264,17 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public boolean setPriority(BluetoothDevice device, int priority) { public boolean setPriority(BluetoothDevice device, int priority) { if (DBG) log("setPriority(" + device + ", " + priority + ")"); if (DBG) log("setPriority(" + device + ", " + priority + ")"); if (mService != null && isEnabled() if (mService != null && isEnabled() && isValidDevice(device)) { && isValidDevice(device)) { if (priority != BluetoothProfile.PRIORITY_OFF && if (priority != BluetoothProfile.PRIORITY_OFF && priority != BluetoothProfile.PRIORITY_ON) { priority != BluetoothProfile.PRIORITY_ON) { return false; return false; } } //TODO(BT) /* try { try { return mService.setInputDevicePriority(device, priority); return mService.setPriority(device, priority); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; return false; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; return false; Loading @@ -311,21 +295,36 @@ public final class BluetoothInputDevice implements BluetoothProfile { */ */ public int getPriority(BluetoothDevice device) { public int getPriority(BluetoothDevice device) { if (DBG) log("getPriority(" + device + ")"); if (DBG) log("getPriority(" + device + ")"); if (mService != null && isEnabled() if (mService != null && isEnabled() && isValidDevice(device)) { && isValidDevice(device)) { //TODO(BT) /* try { try { return mService.getInputDevicePriority(device); return mService.getPriority(device); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.PRIORITY_OFF; return BluetoothProfile.PRIORITY_OFF; }*/ } } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); if (mService == null) Log.w(TAG, "Proxy not attached to service"); return BluetoothProfile.PRIORITY_OFF; return BluetoothProfile.PRIORITY_OFF; } } private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) Log.d(TAG, "Proxy object connected"); mService = IBluetoothInputDevice.Stub.asInterface(service); if (mServiceListener != null) { mServiceListener.onServiceConnected(BluetoothProfile.INPUT_DEVICE, BluetoothInputDevice.this); } } public void onServiceDisconnected(ComponentName className) { if (DBG) Log.d(TAG, "Proxy object disconnected"); mService = null; if (mServiceListener != null) { mServiceListener.onServiceDisconnected(BluetoothProfile.INPUT_DEVICE); } } }; private boolean isEnabled() { private boolean isEnabled() { if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true; return false; return false; Loading
core/java/android/bluetooth/IBluetoothInputDevice.aidl 0 → 100644 +22 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2012 Google Inc. */ package android.bluetooth; import android.bluetooth.BluetoothDevice; /** * API for Bluetooth HID service * * {@hide} */ interface IBluetoothInputDevice { // Public API boolean connect(in BluetoothDevice device); boolean disconnect(in BluetoothDevice device); List<BluetoothDevice> getConnectedDevices(); List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states); int getConnectionState(in BluetoothDevice device); boolean setPriority(in BluetoothDevice device, int priority); int getPriority(in BluetoothDevice device); }