correctly handling BACK_KEY with Fragments in mind, fixed NPE in Fragments sincegetActivity() may be null in Fragments.
improved code for handling press of media button during a phone call.