[Power] Send change events only if there's someone listening
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 4 Oct 2013 15:36:46 +0000 (12:36 -0300)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 7 Oct 2013 12:21:40 +0000 (09:21 -0300)
commite95ee7913d899a2c0a681b69672041d938e7f126
treec0a6ffcf2e4d45c2a5110c863702b93a97ec396c
parent68b5a488f3710d89f2d7e638c7075388ab04a91c
[Power] Send change events only if there's someone listening

Add a new message SetListenToScreenStateChange, from JS to native, that
will be used to tell native that we have a listener. This patch also
ensures that we have a proper value to be used as "old state", by
getting the value at time of listener registration.

One consequence is that after this patch, tizen.power code is not called
at all unless the page uses tizen.power features.

This patch should reduce a lot the errors related to invalid sync
messages, they were caused mostly by those setup messages when running
tests that loaded pages repeatedly.
power/power_api.js
power/power_instance_mobile.cc
power/power_instance_mobile.h