I tried it, it works. But only until user switches to any other application. Then adjustments are recalculated in response to user activity and our adjustment is reset to default because service is not marked as foreground in internal ServiceRecord. We can try to access it via reflection, but it's private, can change at any time, it's an ugly hack and obviously not a hot fix solution.Wladimir Palant wrote:It looks like setting the adjustment to 0 would have the same effect as actually running a foreground application. Can we use it to prevent being killed despite not having an icon?
BTW, without High priority our service became "The B list of SERVICE_ADJ -- these are the old and decrepit services that aren't as shiny and interesting as the ones in the A list." only after 15 minutes of inactivity.