0

I don't know if anyone else has run into this problem, but when I try to use AndroidViewClient/Monkeyrunner to click on the checkboxes for the "Stay Awake" and "Allow mock locations" options, they do not persist after navigating away from the Developer options settings or leaving the Settings app. Here's the code I'm using to access them:

def enable_developer_setting(vc, name):
    setting = vc.findViewWithTextOrRaise(name).getParent().getParent()    
    if not setting.children[len(setting.children) - 1].children[0].isChecked():
        print(name + " not enabled...enabling")
        setting.touch()

enable_developer_setting(vc, "Stay awake")
enable_developer_setting(vc, "USB debugging")
enable_developer_setting(vc, "Allow mock locations")
Android Noob
  • 3,271
  • 4
  • 34
  • 60
  • Tested this on a Nexus 7 and Nexus 10. Got the same results. I also tried calling the views directly without going through this whole getParent().getParent() indirection, but I still was not able to get the Developer setting to stay. Funny thing is, for other settings screens that have checkboxes, there's no problem. Its just the Developer Settings that seem to be giving me issues. Worst case, I'm going to have to pre-install an APK that will do Settings.Global.putInt(...) in a BroadcastReceiver to configure this on boot automatically. – Android Noob Jun 25 '13 at 18:21
  • The interesting point is that when you enable "USB debugging" via `enable_developer_setting` the confirmation dialog is not presented. It needs some investigation. – Diego Torres Milano Jun 26 '13 at 16:31
  • Sorry, forgot to mention. That setting is enabled by default in the default.prop file found in boot.img so I never get the confirmation dialog. – Android Noob Jun 26 '13 at 17:57

0 Answers0