Depending on which driver you're using it could be just the app or not. The Resurrected version will set it to mains if it receives a power management notification event 1 (power applied) or event 3 (AC mains reconnected); it will set it to battery if it receives a power management notification event of 2 (AC mains disconnected) or if it receives a battery report.