I have a very tough problem I can't solve. I have an app which I can put into airplane mode remotely to save power. I have a thread running which gets the power-save message, removes callbacks for all other threads, puts the phone into airplane mode, and waits a specified number of minutes before waking the phone back up.
When the phone is plugged into my laptop (USB debugging enabled, etc) then this functionality is fine. The phone goes into airplane mode, the screen locks, and then after a specific number of minutes the app "wakes up" and continues as normal.
When the phone is plugged into a car charger, the phone phone goes into airplane mode, but the thread never wakes up the phone. This problem only occurs when the screen is also set to timeout...when I set the screen to "never timeout" and have the phone plugged into a car charger, the app wakes up just fine.
It appears that some combination of power source and the screen timing out kills my power-save thread at a system level. I know this post is very specific to my application, but has anyone encountered a problem similar to this before?