Receiving broadcast null in application shutdown

by Semeria Stefano » Tue, 13 May 2008 10:27:50 GMT


Sponsored Links
 ello,

My application is using a mocked location provider and an intent receiver to
receive updates.
During shutdown I first stop the location updates with
LocationManager.removeUpdates(), then I deregister the intent receiver.

I randomly receive the following error:

I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1 -> Intent receiver has called
I/jade.util.Logger( 1101): com.tilab.msn.ContactListActivity: onStop called ...
I/jade.util.Logger( 1101): com.tilab.msn.GeoNavigator: Stopping location
updates.... -> Here updates should be stopped!
D/LocationManager( 1101): removeUpdates: intent = Intent {
action=com.tilab.msn.LOCATION_UPDATE }
D/LocationManagerService( 508): removeUpdate: intent = Intent {
action=com.tilab.msn.LOCATION_UPDATE }
D/LocationManagerService( 508): loadProviders
D/LocationManagerService( 508): loadProviders: already loaded
I/jade.util.Logger( 1101): com.tilab.msn.ContactListActivity: onDestroy called
...
I/jade.util.Logger( 1101): com.tilab.msn.GeoNavigator: Unregistering the intent
receiver.... -> Here I deregister the intent receiver
I/jade.util.Logger( 1101): jade.android.MicroRuntimeService: Initiating
Stopping JADE...
I/jade.util.Logger( 1101): jade.core.FrontEndContainer: Container shut down
activated
I/jade.util.Logger( 1101): com.tilab.msn.MsnAgent: Starting agent takeDown()
I/jade.util.Logger( 1101): com.tilab.msn.MsnAgent: DS Subscription Canceling
message was sent!
I/jade.util.Logger( 1101): com.tilab.msn.MsnAgent: Deregistering from DF!
D/jade.util.Logger( 1101): jade.core.FrontEndContainer: Local agents terminated
I/jade.util.Logger( 1101): jade.imtp.leap.JICP.BIFEDispatcher: Sending
termination notification
D/jade.util.Logger( 1101): jade.core.FrontEndContainer: Connection manager
closed
I/jade.util.Logger( 1101): jade.android.MicroRuntimeService: JADE should be
stopped now! Microruntime.shutdownJADE() ends!
D/jade.util.Logger( 1101): jade.android.JadeGateway: disconnect():
disconnecting from service
W/ActivityManager( 508): Unbind failed: could not find connection for [EMAIL
PROTECTED]
I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1 -> Intent receiver has called again!!!
I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1
I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1
W/ActivityManager( 508): finishReceiver called but no pending broadcasts
D/dalvikvm( 1101): Exception Ljava/lang/RuntimeException; from
ActivityThread.java:492 not caught locally
D/dalvikvm( 1101): Exception Ljava/lang/RuntimeException; from
ZygoteInit.java:1553 not caught locally
D/AndroidRuntime( 1101): Shutting down VM
W/dalvikvm( 1101): threadid=3: thread exiting with uncaught exception
(group=0x4000fdf8)
E/AndroidRuntime( 1101): Uncaught handler: thread Main exiting due to uncaught
exception
E/AndroidRuntime( 1101): java.lang.RuntimeException: Error receiving broadcast
null in [EMAIL PROTECTED]
...

It seems that the service that stops the updates is not doing it synchronously,
so updates continues for a while after the LocationManager.removeUpdates() call
returns. If this is the right behavior, I guess that I should wait before
deregistering the intent receiv



Receiving broadcast null in application shutdown

by Megha Joshi » Wed, 14 May 2008 18:26:59 GMT


 i Stefano,

This seems like a bug. Could you please log this with enough details in the
android issue tracker?

This has been discussed earlier in the thread below:
http://groups.google.com/group/android-developers/browse_thread/thread/d03f0db6004345a1/35346fa13547133f

Thanks,
Megha

On Tue, May 13, 2008 at 3:27 AM, Semeria Stefano <
[EMAIL PROTECTED]> wrote:


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Receiving broadcast null in application shutdown

by geekchique » Wed, 14 May 2008 20:15:53 GMT


  would love to hear any work arounds for this I have been struggling
with this for an age without realising its a bug!


On May 13, 10:27am, Semeria Stefano
<[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~



Receiving broadcast null in application shutdown

by Mark Murphy » Wed, 14 May 2008 20:36:01 GMT


 > I would love to hear any work arounds for this I have been struggling

With M5, I haven't run into this bug, but it may be that my usage of
location updates differs from the ones that are getting the bug.

I get the updates in an activity (vs. a service). I turn off updates in
onPause() and resume them in onResume(), since in my case I don't need the
updates if the activity isn't visible.

I turn off updates using:

myLocationManager.removeUpdates(myIntent);
unregisterReceiver(intentReceiver);

where intentReceiver and myIntent are instance variables in the activity
itself.

It may be that I'm "immune" to the bug in that the time gap between
onPause() and my activity being destroyed is too long to trigger the bug.
Near as I can tell from the referenced thread, the issue is that the
IntentReceiver is no longer around when the last update or two get sent;
in my case, my IntentReceiver probably is around long enough to get those
last updates.

So, as far as a workaround, try to keep your IntentReceiver around after
disabling updates. This may mean disabling updates earlier than you are
doing now, or it may be your IntentReceiver is somehow going out of scope
and is getting garbage collected earlier than is necessary.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
The Busy Coder's Guide to Android Development -- coming in June 2008!


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. ALSA on x86 - No sound

Hi... I'm writing to you my porting status about audio.

Kernel
ALSA and Intel HD enabled as built-in (no module).
It correctly creates device nodes at bootup. Also sysfs seems right
(different cat display right outputs).

BoardConfig.mk
[...]
HAVE_HTC_AUDIO_DRIVER := false
BOARD_USES_ALSA_AUDIO := true
BUILD_WITH_ALSA_UTILS := true
[...]

asound.conf and asound.state
I placed them into /etc/ folder.

===asound.conf===
ctl.AndroidPlayback {
        type hw
        card 0
}

ctl.AndroidRecord {
        type hw
        card 0
}

pcm.AndroidPlayback {
        type hooks
        slave.pcm {
                type hw
                card 0
                device 16
        }
        hooks.0 {
                type ctl_elems
                hook_args [
                        { name 'Speaker Playback Switch'        value [ true 
true ]     }
                        { name 'Line-Out Playback Volume'       value [ 64 64 ] 
}
                        { name 'Line-Out Playback Switch'       value [ true 
true ]     }
                        { name 'e-Mic Boost'                    value [ 0 0 ]   
        }
                        { name 'e-Mic Playback Volume'          value [ 10 10 ] 
}
                        { name 'e-Mic Playback Switch'          value [ false 
false ] }
                        { name 'i-Mic Boost'                    value [ 0 0 ]   
        }
                        { name 'i-Mic Playback Volume'          value [ 10 10 ] 
}
                        { name 'i-Mic Playback Switch'          value [ false 
false ] }
                        { name 'Capture Volume'                 value [ 0 0 ]   
        }
                        { name 'Capture Switch'                 value [ false 
false ]   }
                        { name 'Input Source'                   value i-Mic     
        }
                        { name 'Master Playback Volume'         value 64        
        }
                        { name 'Master Playback Switch'         value true      
        }
                ]
        }
}
[... And so on ...]

===asound.state===
state.Intel {
        control.1 {
                comment.access 'read write'
                comment.type BOOLEAN
                comment.count 2
                iface MIXER
                name 'Speaker Playback Switch'
                value.0 true
                value.1 true
        }
        control.2 {
                comment.access 'read write'
                comment.type INTEGER
                comment.count 2
                comment.range '0 - 64'
                comment.dbmin -6400
                comment.dbmax 0
                iface MIXER
                name 'Line-Out Playback Volume'
                value.0 64
                value.1 64
        }
        control.3 {
                comment.access 'read write'
                comment.type BOOLEAN
                comment.count 2
                iface MIXER
                name 'Line-Out Playback Switch'
                value.0 true
                value.1 true
        }
        control.4 {
                comment.access 'read write'
                comment.type INTEGER
                comment.count 2
                comment.range '0 - 3'
                comment.dbmin 0
                comment.dbmax 3000
                iface MIXER
                name 'e-Mic Boost'
                value.0 0
                value.1 0
        }
        control.5 {
                comment.access 'read write'
                comment.type INTEGER
                comment.count 2
                comment.range '0 - 31'
                comment.dbmin -3450
                comment.dbmax 1200
                iface MIXER
                name 'e-Mic Playback Volume'
                value.0 0
                value.1 0
        }
        control.6 {
                comment.access 'read write'
                comment.type BOOLEAN
                comment.count 2
                iface MIXER
                name 'e-Mic Playback Switch'
                value.0 false
                value.1 false
        }
        control.7 {
                comment.access 'read write'
                comment.type INTEGER
                comment.count 2
                comment.range '0 - 3'
                comment.dbmin 0
                comment.dbmax 3000
                iface MIXER
                name 'i-Mic Boost'
                value.0 0
                value.1 0
        }
        control.8 {
                comment.access 'read write'
                comment.type INTEGER
                comment.count 2
                comment.range '0 - 31'
                comment.dbmin -3450
                comment.dbmax 1200
                iface MIXER
                name 'i-Mic Playback Volume'
                value.0 0
                value.1 0
        }
        control.9 {
                comment.access 'read write'
                comment.type BOOLEAN
                comment.count 2
                iface MIXER
                name 'i-Mic Playback Switch'
                value.0 false
                value.1 false
        }
        control.10 {
                comment.access 'read write'
                comment.type INTEGER
                comment.count 2
                comment.range '0 - 31'
                comment.dbmin -1350
                comment.dbmax 3300
                iface MIXER
                name 'Capture Volume'
                value.0 0
                value.1 0
        }
        control.11 {
                comment.access 'read write'
                comment.type BOOLEAN
                comment.count 2
                iface MIXER
                name 'Capture Switch'
                value.0 false
                value.1 false
        }
        control.12 {
                comment.access 'read write'
                comment.type ENUMERATED
                comment.count 1
                comment.item.0 i-Mic
                comment.item.1 e-Mic
                iface MIXER
                name 'Input Source'
                value i-Mic
        }
        control.13 {
                comment.access 'read write'
                comment.type INTEGER
                comment.count 1
                comment.range '0 - 64'
                comment.dbmin -6400
                comment.dbmax 0
                iface MIXER
                name 'Master Playback Volume'
                value 64
        }
        control.14 {
                comment.access 'read write'
                comment.type BOOLEAN
                comment.count 1
                iface MIXER
                name 'Master Playback Switch'
                value true
        }
}

alsa-lib alsa_sound and alsa-utilis
Added to the tree. I did not modified them ( I have some doubt about
LOCAL_ARM_MODE := arm definition ... )

All is built correctly.

I can launch alsa_ctr store / restore and it is ok.
I can launch alsa_aplay -l and audio card is listed.
Launching alsa_aplay file.wav it tells me "unable to install hw
params".
Launching alsa_amixer -c 0 it goes on segfault when parsing the first
control 'Master', after it prints Limits: Playback 0 - 64.
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Revised: Android V2 Keystor

You may have heard debates concerning the virtues of "soft certificates" versus 
"smart cards".

I have come to the conclusion that this distinction is mostly based on the fact
that current smart cards cannot be provisioned in a secure way over the Internet
to an end-user because there is nothing in the card that can vouch for the 
origin of
generated key-pairs (and a lot of other related stuff as well).

Is there a need for a such a facility?  Yes, unless you think this is cool:
http://www.trustdigital.com/downloads/TD_EMM_CAC_Pack_101008.pdf
http://na.blackberry.com/eng/ataglance/security/products/smartcardreader
IMO these solutions represent $200+ of total c**p.

A better solution would of course be that you used your PIV/CAC/eID card
to "enroll2 your mobile device which then should be on par with the original
credential security-wise!  This can be done by the end-user itself.

Rather than "only" making a phone solution, I have revised the Android V2
Keystore project to also work with firmware-enhanced smart cards that should
be able to use the same provisioning protocol.

The details are yet to be described publicly but I see no problems achieving
what is claimed in:

"Air-tight" provisioning, the basics:
http://webpki.org/papers/keygen2/secure-key-store.pdf
"Air-tight" provisioning", core facility:
http://webpki.org/papers/keygen2/session-key-establishment--security-element-2-server.pdf

Anders

3. I found the minus key on the android emulator

4. Problem with createBitmap method

5. fast removing SurfaceView

6. HelloAndroid not working...

7. Who can explain on 'pv2way'?