Now, my question that just popped up in my head is what's actualy happening when my service receive the SCREEN_OFF event ? I have a couple of things that are executed at this point (one of them is unregister the Listener for Orientation Sensor), but how the Android handle this ? I mean, always these actions will get the change to comple until the phone goes in standby ? because this will happens when the screen will go off, unless the are some PARTIAL_WAKE_LOCKs held by other applications. Si it is possible that the Unregister Listener will not finish properly (something is happening because my service's OnSensorChanged event is not fired up anymore between SCREEN OFF and SCREEN ON) because the system buts the phone in standby and the sensor usage will occurs on my app ? And this could explain why this occurs only sometimes, maybe sometimes it happens that there is a PARTIAL_WAKE_LOCK that allows all the actions to properly complete and sometimes there is not... Just a theory...
On Jan 28, 11:45 am, Alex Munteanu <alex.munte...@gmail.com> wrote: > The problem is that I see on the same phone (Samsung Galaxy S) the > situation when my application doesn't get listed in Batery Use with > high use (and it this case Sensor Usage of Spare Parts reports little > usage for my app) and the situation when it get's listed (and in this > case Sensor Usage of Spare Parts reports much higher usage). > So is on the same phone, but always after a reboot or USB unplug (so > if the Batery Use is reported low for my app then it will stay this as > long I don't reboot, recharge the phone, and vice-versa), I'm unable > to replicate this and reading the Logcat I have observed this events, > listed as Error (E), so it might or not be something related. > > I will do also an adb shell top once I get home, in my office I don't > have admin rigts on my computer.. :( > > On Jan 27, 7:23 pm, ip332 <iprile...@gmail.com> wrote: > > > > > D-le Alex, you should learn to read between the lines :) > > > Here is a snapshot from a phone I had once: > > PID CPU% S #THR VSS RSS PCY UID Name > > 2383 40% S 5 6340K 760K fg compass /system/bin/<some > > sensor server> > > 3004 18% S 15 240340K 31352K fg app_90 <gpsstatus app from the > > market> > > 2941 16% R 9 224140K 22656K bg app_87 <my_top_secret_app_:)> > > 2465 10% S 64 336464K 62780K fg system system_server > > 3033 1% R 1 844K 412K fg root top > > > As you can see the system process eats 40% of the CPU which is way too > > much for sensor reading task. > > Now, I'm not sure if it was a production phone or a development device > > with root access - this is why the phone name is not disclosed. > > But it is an example of how bad the low level sensors stuff could be > > implemented. Most likely they poll data from the port instead of > > waiting for an event. I did sensors porting once and pretty much sure > > this task should not take such large amount of CPU. > > > Now, back to your case. List the top 10 CPU-eating processes and see > > if you have similar picture to the one above. > > If yes, then accept this as a "feature" of the phone and check on > > another one ;) > > > On Jan 27, 8:38 am, Alex Munteanu <alex.munte...@gmail.com> wrote: > > > > Yes, is not there. > > > > On Jan 27, 6:23 pm, ip332 <iprile...@gmail.com> wrote: > > > > > Did you check CPU usage using "adb shell top" ? > > > > > On Jan 27, 2:42 am, Alex Munteanu <alex.munte...@gmail.com> wrote: > > > > > > Similar > > > > > to:http://groups.google.com/group/android-developers/browse_thread/threa...... > > > > > > Please help > > > > > > On Jan 27, 11:12 am, Alex Munteanu <alex.munte...@gmail.com> wrote: > > > > > > > I'm struggling to find the root cause of a problem that occurs > > > > > > apparently randomly in my application. I have a listener registered > > > > > > for SENSOR.TYPE_ORIENTATION in my service and on Screen OFF > > > > > > broadcast > > > > > > I unregister the listener, and on Screen ON a register it again. > > > > > > From > > > > > > time to time, after phone reboot, or maybe unplug, while the most of > > > > > > the time the phone is in stand by I get a high sensor usage in phone > > > > > > information (along with high battery use associated with my app...) > > > > > > In > > > > > > logcat I find lines like this just before Screen OFF : > > > > > > > 01-26 18:02:52.891 E/SensorManager(13487): unregisterListener: > > > > > > alex.munteanu.SimpleService$2@48790020 MS-3C Orientation Sensor > > > > > > > These are some kind of errors that shows that the Listener could not > > > > > > be unregistered ? If yes, why and what can I do ?- Hide quoted text > > > > > > - > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - -- 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