I am creating an activity which seeks to change the state of LEDs on a device. The LED behavior is handled through an embedded controller with no APIs exposed, so I cannot directly change the state of the LEDs. The state changes based on the charging and battery percentage state of the device. Is there any way for me to simulate a different battery level/charging state via Android Studio to accomplish this?
Asked
Active
Viewed 62 times
2 Answers
1

Shermano
- 1,100
- 8
- 31
-
Thank you for the response, can I do this with a physical device I am debugging on? I seek to do it programatically to create test code with it. – jjo Jul 01 '19 at 16:52
-
I think you can't – Shermano Jul 01 '19 at 16:56
1

Garrett Manley
- 337
- 3
- 11
-
Thank you for the response, can I do this with a physical device I am debugging on? I seek to do it programatically to create test code with it – jjo Jul 01 '19 at 16:52
-
You're not going to be able to do this on a physical device short of hacking your own kernel together. If you're looking to write test code, you should mock the responses from sensors anyway. Just implement a mock service to serve up the battery status to your tests. – Garrett Manley Jul 02 '19 at 00:00