Submitted as http://code.google.com/p/android/issues/detail?id=9663:

On the Incredible (and possibly other devices) the process is always
put in the background scheduling group when it doesn't have a visible
activity, even though the app's service has called startForeground().
This causes it to get a restricted amount of CPU time, which is
crippling for applications that need more CPU while running in the
background.

For example, in our application, MixZing Media Player, our service
plays music using AudioTrack and does signal processing such as
equalization.  This fairly CPU-intensive task works fine on other
devices such as the Droid, and on the Incredible when the activity is
in the foreground, but when the user backgrounds the app the audio
starts stuttering and is basically unusable.  As a result, our
thousands of users on the Incredible won't be able to use our
equalizer function.

The attached project demonstrates the problem.  It starts a service
which calls startForeground() with a Notification.  It then prints out
the value of its scheduling group, which is "/" when it's visible.  If
you then hit the Home button the app prints out the scheduling group
again, which on other devices is still "/" but on the Incredible is "/
bg_non_interactive".

Further, if you look at "dumpsys activity" while the app has no
visible activities you'll see "foregroundServices=false" and
"curSchedGroup=1".  On another device, e.g. a Droid, it shows
"foregroundServices=true" and "curSchedGroup=0".

I can trace the startForeground() call in the debugger all the way to
ActivityManagerNative.setServiceForeground() with the notification
parameter being non-null, so it looks like the problem is in the
ActivityManager or perhaps the scheduler itself; in any case it's not
in the Java code.

This is a very serious bug which will have a severe effect on any
application trying to do relatively CPU-intensive tasks in the
background.  If there is any workaround that we can implement please
let us know ASAP.

-- 
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