RoosterRat / a2dpvolume

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

GPS stays on after BT disconnection #118

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Device (phone) brand:
Device (phone) model:
Android OS version:
App version: A2.1 or main

Device (phone) brand: ZTE
Device (phone) model: Blade
Android OS version: 2.3.7, CM-7.1.0-Blade
App version: 2.8.6

What steps will reproduce the problem?
1. Turn on BT device, A2DP does detection
2. Turn off BT device, but keep device covered so GPS does not receive
3. BT is disconnected, a2dpvolume did reset volumes but GPS still active

As far as I know a2dpvolume tries to detect the GPS location after 
disconnection for a while until timeout. I've seen that after that the GPS is 
disabled again. But most of the time when I keep the phone covered in the 
pocket I can see GPS still active after some while. I guess this only happens 
if a2dpvolume failed to read the position after BT disconnection.

Original issue reported on code.google.com by burcheri...@gmail.com on 31 May 2012 at 1:12

GoogleCodeExporter commented 9 years ago
I have already implemented several checks to prevent this.  The location 
listener times out and stops the listeners.  If the activity that looks for 
location is killed I stop the listeners.  If you stop the service I stop the 
listeners.  If anything kills the app, I stop the listeners.  Not sure when 
else I can do.  Also, there are many things that use location data and often 
this is caused by other programs.  One other thing I have seen is that the GPS 
indication sometimes can stay active even after the GPS stops actively looking 
for a location.  I had this issue with GPS Status.  

Original comment by JimR...@gmail.com on 1 Jun 2012 at 2:00

GoogleCodeExporter commented 9 years ago
I have GPS status installed too, but not running. Can you force the GPS to turn 
off by config option? Same as it forces the WiFi to turn off when BT is 
connecting (what I always must do for better connectivity)?
Actually the option "Turn GPS on DURING connection" means to turn off at 
disconnection and even force it. But I see you tried everything to turn it off.
Is it possible to force the GPS shutdown just like the user does when pressing 
the GPS icon in the status bar?

Original comment by burcheri...@gmail.com on 1 Jun 2012 at 7:44

GoogleCodeExporter commented 9 years ago
If you use the enable GPS option then it already disables when you disconnect.  
It will return the GPS enable state to what it was when it saw the connection.  
If it was not enabled then it will disable it again.  That is already there.  
There are 2 parts to this: enabling GPS and then actively looking for a GPS 
location (listening).  In the case where you just keep GPS enabled at all times 
(the recommended state for most conditions) and you connect to a device the GPS 
is not yet affected by A2DP Volume.  When you disconnect, and you have this 
device configured to capture location, then A2DP volume will launch listeners 
for GPS and network locations.  It will stop the listeners when one of the 
following happen: a suitable location is found, the timer expires, the service 
is stopped or killed, or the location activity is stopped or killed.  If you 
also have the "enable GPS' feature checked (Gingerbread and prior only) then 
the same is all true except GPS will be enabled when connected and will disable 
after the maximum location capture time you configured + 2s.  So all of what 
you were asking for is already there.

If you don't use the notify icon then the application can be killed by Android 
in the middle of a connection.  If this happens then all bets are off since 
A2DP Volume looses track of the last state.  Make sure you always use the 
notify in foreground option to drastically reduce the chance of this happening. 
 I have an issue on the list to make the notify icon always show when connected 
and leave the configuration there to have it just always show.  That would help 
this at least keep the states straight during a connection.

Original comment by JimR...@gmail.com on 1 Jun 2012 at 11:07

GoogleCodeExporter commented 9 years ago
Nice, ok I enabled that "notify in foreground" option. I already wondered why 
sometimes I switch the screen on I see ad2pvolume starting (with popup 
message). I thought it should be running always. Maybe this is caused because 
the service was killed as you say.

Let's see if that foreground option helps.
About that other issue I would also prefer to only see the icon when connected. 
Seeing the blue a2dpvolume icon always is a bit too much for my little space on 
the screen.

Original comment by burcheri...@gmail.com on 1 Jun 2012 at 11:24

GoogleCodeExporter commented 9 years ago
Yes, you are correct.  If you don't have the icon showing, Android considers it 
a "background" task meaning it is in the list to be killed if memory is needed. 
 You are also correct that if an app is killed, it may not restart 
automatically.  Even if it does restart, A2DP Volume would not see the 
transition from not connected to connected so it could not capture the previous 
states properly and it would not perform the connect actions.  Bottom line: if 
you want it to actually work, the icon must be showing.  

Original comment by JimR...@gmail.com on 1 Jun 2012 at 12:31

GoogleCodeExporter commented 9 years ago
Bad enough, that you cannot declare a service as required or let it restart if 
killed, even without the icon. There are lots of other service which are 
required but have not icon. But ok, this would in general only happen if there 
is a memory lack. And even then I think Android is killing procs in a specific 
order.

Original comment by burcheri...@gmail.com on 1 Jun 2012 at 12:51

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 16 Jun 2012 at 12:29

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 17 Jun 2012 at 4:41