Hi,

In general, I've understood that the device can go to sleep at any
time when the screen is off and no application is holding a wakelock.
But based on the behaviour I've seen, I believe there are a few cases
when the platform will hold a wakelock for the application:

* When running Activity.onCreate()
* When running BroadcastReceiver.onReceive()

Are my assumptions correct? Are there other places where the platform
holds a wakelock for the app? Maybe when executing UI callbacks
originating from user interaction?


The second thing I'd like to clear up is related to network I/O. I
understand that incoming data can wake up the CPU from sleep. In
practice, I've seen that a method doing a blocking read will return
when incoming data is detected even if wakelock wasn't held when the
method was called. And if you don't acquire a wakelock soon after
reading the received data, the CPU may go to sleep before your code
has processed the data. But it seems it does not do this immediately
after the read, but only after some "grace period". This leads to a
few more questions:

Is the platform holding a wakelock when it reads data from network? If
yes, when will it release this wakelock? Is there a grace period after
data has been received, or how does the platform guarantee the
application receiving the data has gotten the chance to acquire it's
own wakelock?


Thanks in advance for any answers,
Heikki

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to