View Single Post
Old 09-12-2012, 08:41 AM   #1
altruizine
Senior Altruist
altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.
 
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
/system/bin/switcher: Battery drain, USB misbehavior

I have seen /system/bin/switcher and its wake lock causing battery drain. Maybe switcher also plays a role in an USB issue where sometimes an USB plug / unplug event is not correctly handled (device thinks USB is still connected / disconnected when it's not, ADB connection cannot be established, freezes / crashes after USB unplug).

I'd like to understand what Switcher actually does and why it misbehaves. Maybe we can collect some observations about it and perhaps even come up with a fix?

Here's what I know so far:

Switcher is a system service run from /init.rc. When it's killed, init immediately restarts it.

Switcher seems to play a role in driving the USB port. I have experimented replacing /system/bin/switcher with a shell script that does nothing but sleep forever. This certainly solved the battery-drain issue, but also rendered the USB port unusable: The Reader couldn't detect host connections or chargers anymore.

From looking at the strings embedded within the binary, Switcher also seems to play a role in Adobe DRM activation over USB.

An strace reveals that Switcher listens on all input events: It registers all touch events and button presses. No idea why. Scary.

My workaround for the ADB and hang-after-USB-disconnect issues: After connecting the USB cable to the host PC, enter the application debugging settings screen, disable USB debugging, then re-enable it. Now ADB works. Before removing the USB cable, enter the settings screen again and disable USB debugging. Optionally, re-enable it after removing the cable (I usually do this because otherwise Titanium Backup sometimes complains and hangs.)
altruizine is offline   Reply With Quote