package com.mumux.androidtesting.actions.impl; import com.android.uiautomator.testrunner.UiAutomatorTestCase; import com.mumux.androidtesting.actions.OnOffAction; import java.io.IOException; public class DataAction extends OnOffAction { public DataAction() { super("DATA", true, "set Data on|off", Category.SYSTEM, "setting not changed"); } @Override public String run(UiAutomatorTestCase uiAutomatorTestCase, Runtime runtime) { String command = "su -c svc data " + (status ? "enable" : "disable"); try { runtime.exec(command); } catch (IOException e) { e.printStackTrace(); } // To be clarify - when action has been satisfied try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); return e.getMessage(); } return null; } }