PhoneWindowManager: Hardware key handling fixes and cleanup