Rename the Bluetooth profile classes for HID Device role.
am: 0afe190af5
Change-Id: Ib5c9b904da57048d719df504142edd3dab0e6ec3
This commit is contained in:
@@ -124,7 +124,7 @@ LOCAL_SRC_FILES += \
|
|||||||
core/java/android/bluetooth/IBluetoothSap.aidl \
|
core/java/android/bluetooth/IBluetoothSap.aidl \
|
||||||
core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \
|
core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \
|
||||||
core/java/android/bluetooth/IBluetoothHeadsetClient.aidl \
|
core/java/android/bluetooth/IBluetoothHeadsetClient.aidl \
|
||||||
core/java/android/bluetooth/IBluetoothHidDevice.aidl \
|
core/java/android/bluetooth/IBluetoothInputHost.aidl \
|
||||||
core/java/android/bluetooth/IBluetoothHidDeviceCallback.aidl \
|
core/java/android/bluetooth/IBluetoothHidDeviceCallback.aidl \
|
||||||
core/java/android/bluetooth/IBluetoothGatt.aidl \
|
core/java/android/bluetooth/IBluetoothGatt.aidl \
|
||||||
core/java/android/bluetooth/IBluetoothGattCallback.aidl \
|
core/java/android/bluetooth/IBluetoothGattCallback.aidl \
|
||||||
|
|||||||
@@ -1916,8 +1916,8 @@ public final class BluetoothAdapter {
|
|||||||
} else if (profile == BluetoothProfile.MAP_CLIENT) {
|
} else if (profile == BluetoothProfile.MAP_CLIENT) {
|
||||||
BluetoothMapClient mapClient = new BluetoothMapClient(context, listener);
|
BluetoothMapClient mapClient = new BluetoothMapClient(context, listener);
|
||||||
return true;
|
return true;
|
||||||
} else if (profile == BluetoothProfile.HID_DEVICE) {
|
} else if (profile == BluetoothProfile.INPUT_HOST) {
|
||||||
BluetoothHidDevice hidd = new BluetoothHidDevice(context, listener);
|
BluetoothInputHost iHost = new BluetoothInputHost(context, listener);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -1995,9 +1995,9 @@ public final class BluetoothAdapter {
|
|||||||
BluetoothMapClient mapClient = (BluetoothMapClient)proxy;
|
BluetoothMapClient mapClient = (BluetoothMapClient)proxy;
|
||||||
mapClient.close();
|
mapClient.close();
|
||||||
break;
|
break;
|
||||||
case BluetoothProfile.HID_DEVICE:
|
case BluetoothProfile.INPUT_HOST:
|
||||||
BluetoothHidDevice hidd = (BluetoothHidDevice) proxy;
|
BluetoothInputHost iHost = (BluetoothInputHost) proxy;
|
||||||
hidd.close();
|
iHost.close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.bluetooth;
|
package android.bluetooth;
|
||||||
|
|
||||||
|
import android.annotation.SdkConstant;
|
||||||
|
import android.annotation.SdkConstant.SdkConstantType;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -30,12 +32,31 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class BluetoothHidDevice implements BluetoothProfile {
|
public final class BluetoothInputHost implements BluetoothProfile {
|
||||||
|
|
||||||
private static final String TAG = BluetoothHidDevice.class.getSimpleName();
|
private static final String TAG = BluetoothInputHost.class.getSimpleName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intent used to broadcast the change in connection state of the Input
|
||||||
|
* Host profile.
|
||||||
|
*
|
||||||
|
* <p>This intent will have 3 extras:
|
||||||
|
* <ul>
|
||||||
|
* <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
|
||||||
|
* <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.</li>
|
||||||
|
* <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of
|
||||||
|
* {@link #STATE_DISCONNECTED}, {@link #STATE_CONNECTING},
|
||||||
|
* {@link #STATE_CONNECTED}, {@link #STATE_DISCONNECTING}.
|
||||||
|
*
|
||||||
|
* <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission to
|
||||||
|
* receive.
|
||||||
|
*/
|
||||||
|
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
|
||||||
public static final String ACTION_CONNECTION_STATE_CHANGED =
|
public static final String ACTION_CONNECTION_STATE_CHANGED =
|
||||||
"android.bluetooth.hid.profile.action.CONNECTION_STATE_CHANGED";
|
"android.bluetooth.inputhost.profile.action.CONNECTION_STATE_CHANGED";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants representing device subclass.
|
* Constants representing device subclass.
|
||||||
@@ -92,7 +113,7 @@ public final class BluetoothHidDevice implements BluetoothProfile {
|
|||||||
|
|
||||||
private ServiceListener mServiceListener;
|
private ServiceListener mServiceListener;
|
||||||
|
|
||||||
private IBluetoothHidDevice mService;
|
private IBluetoothInputHost mService;
|
||||||
|
|
||||||
private BluetoothAdapter mAdapter;
|
private BluetoothAdapter mAdapter;
|
||||||
|
|
||||||
@@ -178,11 +199,11 @@ public final class BluetoothHidDevice implements BluetoothProfile {
|
|||||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||||
Log.d(TAG, "onServiceConnected()");
|
Log.d(TAG, "onServiceConnected()");
|
||||||
|
|
||||||
mService = IBluetoothHidDevice.Stub.asInterface(service);
|
mService = IBluetoothInputHost.Stub.asInterface(service);
|
||||||
|
|
||||||
if (mServiceListener != null) {
|
if (mServiceListener != null) {
|
||||||
mServiceListener.onServiceConnected(BluetoothProfile.HID_DEVICE,
|
mServiceListener.onServiceConnected(BluetoothProfile.INPUT_HOST,
|
||||||
BluetoothHidDevice.this);
|
BluetoothInputHost.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,13 +213,13 @@ public final class BluetoothHidDevice implements BluetoothProfile {
|
|||||||
mService = null;
|
mService = null;
|
||||||
|
|
||||||
if (mServiceListener != null) {
|
if (mServiceListener != null) {
|
||||||
mServiceListener.onServiceDisconnected(BluetoothProfile.HID_DEVICE);
|
mServiceListener.onServiceDisconnected(BluetoothProfile.INPUT_HOST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BluetoothHidDevice(Context context, ServiceListener listener) {
|
BluetoothInputHost(Context context, ServiceListener listener) {
|
||||||
Log.v(TAG, "BluetoothHidDevice");
|
Log.v(TAG, "BluetoothInputHost");
|
||||||
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mServiceListener = listener;
|
mServiceListener = listener;
|
||||||
@@ -217,7 +238,7 @@ public final class BluetoothHidDevice implements BluetoothProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean doBind() {
|
boolean doBind() {
|
||||||
Intent intent = new Intent(IBluetoothHidDevice.class.getName());
|
Intent intent = new Intent(IBluetoothInputHost.class.getName());
|
||||||
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
|
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
|
||||||
intent.setComponent(comp);
|
intent.setComponent(comp);
|
||||||
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
|
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
|
||||||
@@ -143,10 +143,10 @@ public interface BluetoothProfile {
|
|||||||
public static final int MAP_CLIENT = 18;
|
public static final int MAP_CLIENT = 18;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HID device
|
* Input Host
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
static public final int HID_DEVICE = 19;
|
static public final int INPUT_HOST = 19;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max profile ID. This value should be updated whenever a new profile is added to match
|
* Max profile ID. This value should be updated whenever a new profile is added to match
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import android.bluetooth.BluetoothHidDeviceAppSdpSettings;
|
|||||||
import android.bluetooth.BluetoothHidDeviceAppQosSettings;
|
import android.bluetooth.BluetoothHidDeviceAppQosSettings;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
interface IBluetoothHidDevice {
|
interface IBluetoothInputHost {
|
||||||
boolean registerApp(in BluetoothHidDeviceAppConfiguration config,
|
boolean registerApp(in BluetoothHidDeviceAppConfiguration config,
|
||||||
in BluetoothHidDeviceAppSdpSettings sdp, in BluetoothHidDeviceAppQosSettings inQos,
|
in BluetoothHidDeviceAppSdpSettings sdp, in BluetoothHidDeviceAppQosSettings inQos,
|
||||||
in BluetoothHidDeviceAppQosSettings outQos, in IBluetoothHidDeviceCallback callback);
|
in BluetoothHidDeviceAppQosSettings outQos, in IBluetoothHidDeviceCallback callback);
|
||||||
@@ -180,6 +180,8 @@
|
|||||||
android:name="android.bluetooth.input.profile.action.PROTOCOL_MODE_CHANGED" />
|
android:name="android.bluetooth.input.profile.action.PROTOCOL_MODE_CHANGED" />
|
||||||
<protected-broadcast
|
<protected-broadcast
|
||||||
android:name="android.bluetooth.input.profile.action.VIRTUAL_UNPLUG_STATUS" />
|
android:name="android.bluetooth.input.profile.action.VIRTUAL_UNPLUG_STATUS" />
|
||||||
|
<protected-broadcast
|
||||||
|
android:name="android.bluetooth.inputhost.profile.action.CONNECTION_STATE_CHANGED" />
|
||||||
<protected-broadcast
|
<protected-broadcast
|
||||||
android:name="android.bluetooth.map.profile.action.CONNECTION_STATE_CHANGED" />
|
android:name="android.bluetooth.map.profile.action.CONNECTION_STATE_CHANGED" />
|
||||||
<protected-broadcast android:name="android.bluetooth.mapmce.profile.action.CONNECTION_STATE_CHANGED" />
|
<protected-broadcast android:name="android.bluetooth.mapmce.profile.action.CONNECTION_STATE_CHANGED" />
|
||||||
|
|||||||
Reference in New Issue
Block a user