Hi all,
I am trying to implement Serial and Hid profile API in android framwork.
Getting IBinder value Null while init to Serial profile or Hid profile using
settings menu-->
/***************** crash log msg ************************/
D/BluetoothSerial( 1159): BluetoothSerial start
(com.android.settings.bluetooth.bluetoothsetti...@436844e8)
D/BluetoothSerial( 1159): BluetoothSerial name (bluetooth_serial)
D/BluetoothSerial( 1159): deepak BluetoothSerial IBinder value
return ... (null)
D/AndroidRuntime( 1159): Shutting down VM
W/dalvikvm( 1159): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime( 1159): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 1159): java.lang.RuntimeException: Unable to start
activity ComponentInfo{com.android.settings/com.android!
E/AndroidRuntime( 1159): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
E/AndroidRuntime( 1159): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
E/AndroidRuntime( 1159): at android.app.ActivityThread.access
$1800(ActivityThread.java:112)
E/AndroidRuntime( 1159): at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime( 1159): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1159): at
android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1159): at
android.app.ActivityThread.main(ActivityThread.java:3948)
E/AndroidRuntime( 1159): at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1159): at
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1159): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 1159): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime( 1159): at dalvik.system.NativeStart.main(Native
Method)
E/AndroidRuntime( 1159): Caused by: java.lang.RuntimeException:
Bluetooth SERIAL service not available!
E/AndroidRuntime( 1159): at
android.bluetooth.BluetoothSerial.<init>(BluetoothSerial.java:92)
/**********************************************************************************/
Code causing this exception (serial profile):
/mydroid/frameworks/base/core/java/android/bluetooth/BluetoothSerial.java
public BluetoothSerial(Context c) {
mContext = c;
log("BluetoothSerial start (" + c + ")");
IBinder b =
ServiceManager.getService(BluetoothSerialService.BLUETOOTH_SERIAL_SERVICE);
log("BluetoothSerial name (" +
BluetoothSerialService.BLUETOOTH_SERIAL_SERVICE + ")");
log("deepak BluetoothSerial IBinder value return ... (" + b +
")");
if (b == null) {
throw new RuntimeException("Bluetooth SERIAL service not
available!");
}
mService = IBluetoothSerial.Stub.asInterface(b);
}
Same Code present
in /mydroid/frameworks/base/core/java/android/bluetooth/BluetoothA2dp.java
file return correct IBinder value.
public BluetoothA2dp(Context c) {
mContext = c;
IBinder b =
ServiceManager.getService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE);
log("deepak IBinder connectSink(" + b + ")");
if (b == null) {
throw new RuntimeException("Bluetooth A2DP service not
available!");
}
mService = IBluetoothA2dp.Stub.asInterface(b);
}
/******************** logcat msg *********************/
I/ActivityManager( 983): Displayed activity
com.android.settings/.Settings: 790 ms
I/ActivityManager( 983): Starting activity: Intent
{ action=android.intent.action.MAIN
comp={com.android.settings/com.andro}
D/BluetoothA2dp( 1165): deepak IBinder
connectSink(android.os.binderpr...@43675110)
/*******************************************************/
public BluetoothHid(Context c) {
mContext = c;
IBinder b =
ServiceManager.getService(BluetoothHidService.BLUETOOTH_HID_SERVICE);
log("BluetoothHid BluetoothHidService.BLUETOOTH_HID_SERVICE value :
(" + BluetoothHidService.BLUETOOTH_HID_SERVICE + ")");
log("BluetoothHid IBinder value : (" + b + ")");
if (b == null) {
throw new RuntimeException("Bluetooth HID service not
available!");
}
mService = IBluetoothHid.Stub.asInterface(b);
}
IBluetoothHid.aidl ------------------->
/**
* System private API for Bluetooth HID service
*/
interface IBluetoothHid {
int connectDevice(in String address);
int disconnectDevice(in String address);
List<String> listConnectedDevices();
int getDeviceState(in String address);
int setPriority(in String address, int priority);
int getPriority(in String address);
}
Anybody has idea for this IBinder return value differ in A2DP and Serial or
HID profile ?
Any help will be highly appreciated.
Thanks & Regards,
Deepak
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---