Sample Android code from The Auto Screen Turn On & Off app