Fixed some warnings and added better usage of newer APIs when referring to the on/off state of the device's screen.