utonlenggu90 / a2dpvolume

Automatically exported from code.google.com/p/a2dpvolume
0 stars 0 forks source link

ICS force closes when connecting BT device #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Device (phone) brand:  Samsung
Device (phone) model: Droid Nexus
Android OS version: 4.0

When I say it crashes, I mean it puts a message box to the screen that says 
"unfortunately, A2DP Volume has stopped", and there is an ok button underneath 
the message.  I don't get a force close error.  About 5 seconds after I touch 
ok, I get a message that fades onto the screen saying "A2DP volume service 
started".  So it appears that the service gets stopped and then automatically 
starts again.  Upon starting the second time, it doesn't crash again, but it 
doesn't connect to my A2DP device either.  The way for me to get it to crash is 
to turn off my car so that all Bluetooth devices power down and disconnect, and 
then power on the car again.  It's on the initial power on that I get the error.

Original issue reported on code.google.com by JimR...@gmail.com on 5 Jan 2012 at 1:08

GoogleCodeExporter commented 9 years ago
Device (phone) brand: Motorola
Device (phone) model: Droid X
Android OS version: 4.0.1

I am also seeing this on my Droid X with a 4.0.1 ROM.
I have attached a log file filtered for A2DP in alogcat.  It seems to indicate 
that the Activity Manager process is killing the process and then scheduling a 
crashed process to start.

I am running EncounterICS with the Android Version 4.0.1.

Original comment by ikesterh...@gmail.com on 6 Jan 2012 at 5:37

Attachments:

GoogleCodeExporter commented 9 years ago
Here is the stack trace for the Nexus crash:

v2.3.10
Jan 4, 2012 9:19:15 AM
1 reports/week
1 reports
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:278)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.NoSuchMethodError: 
android.bluetooth.IBluetoothA2dp.getSinkPriority
at a2dp.Vol.service$ConnectBt.doInBackground(service.java:848)
at a2dp.Vol.service$ConnectBt.doInBackground(service.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 4 more

Exception class
java.lang.NoSuchMethodError
Source method
service$ConnectBt.doInBackground()

Original comment by JimR...@gmail.com on 8 Jan 2012 at 6:15

GoogleCodeExporter commented 9 years ago
The error happens the first time the app tries to use the AIDL interface.  
Something changed between Gingerbread and ICS that makes the AIDL not work.  I 
have not tested with Honeycomb since I don't have 2 devices to set up like that 
but it may have the issue as well, not sure.  I tried to comment out the first 
AIDL call in service.java and then it just crashes on the next use.  Problem 
happens here:

IBluetoothA2dp ibta = getIBluetoothA2dp();
                        try {
                                Log.d(LOG_TAG, "Here: " + ibta.getSinkPriority(device));
                                if (ibta != null && ibta.connectSink(device))
                                        try2 = false;
                        } catch (Exception e) {
                                Log.e(LOG_TAG, "Error " + e.getMessage());
                                try2 = true;
                        }

Original comment by JimR...@gmail.com on 8 Jan 2012 at 6:24

GoogleCodeExporter commented 9 years ago
Some more info.  I used a slight modification of this solution:
http://stackoverflow.com/questions/6161870/android-connect-to-a-paired-bluetooth
-headset

Original comment by JimR...@gmail.com on 8 Jan 2012 at 6:39

GoogleCodeExporter commented 9 years ago
I just tested on Honeycomb and it does it too.  My Xoom has Android 3.2.  The 
Xoom normally automatically connects to the A2DP Receiver when you turn 
Bluetooth ON, unlike Gingerbread and prior. However, I set up the headset jack 
to force connect the A2DP receiver in A2DP Volume.  Sure enough, force close.  
I was looking at this: 
http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html and 
noticed "since API 11" which in Honeycomb.  I also looked at an older version 
of Android 
http://hi-android.info/src/android/bluetooth/BluetoothA2dp.java.htmlhttp://hi-an
droid.info/src/android/bluetooth/BluetoothA2dp.java.html and sure enough the 
function calls are different.  One has connectSink (older) and ICS just has 
connect.

Original comment by JimR...@gmail.com on 10 Jan 2012 at 1:32

GoogleCodeExporter commented 9 years ago
That source link is here: http://hi-android.info/src/  then 
android.bluetooth.BluetoothA2DP.java

Original comment by JimR...@gmail.com on 10 Jan 2012 at 1:33

GoogleCodeExporter commented 9 years ago
Here is a source difference: 
http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/an
droid/4.0.1_r1/android/bluetooth/BluetoothA2dp.java/?v=diff&id2=2.0_r1

Original comment by JimR...@gmail.com on 10 Jan 2012 at 2:07

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fixed in 2.3.11.  Had to modify AIDL interface to support both Gingerbread and 
older as well as Honeycomb and newer.  Added SDK version check to service to 
call correct interfaces.  Please test and report any bugs.

Original comment by JimR...@gmail.com on 11 Jan 2012 at 3:42

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 73dfd9eaa62d.

Original comment by JimR...@gmail.com on 11 Jan 2012 at 3:52