use of android.app.UiAutomation in project android_frameworks_base by DirtyUnicorns.
the class UiAutomationShellWrapper method connect.
public void connect() {
if (mHandlerThread.isAlive()) {
throw new IllegalStateException("Already connected!");
}
mHandlerThread.start();
mUiAutomation = new UiAutomation(mHandlerThread.getLooper(), new UiAutomationConnection());
mUiAutomation.connect();
}
use of android.app.UiAutomation in project android_frameworks_base by ResurrectionRemix.
the class UiAutomationShellWrapper method connect.
public void connect() {
if (mHandlerThread.isAlive()) {
throw new IllegalStateException("Already connected!");
}
mHandlerThread.start();
mUiAutomation = new UiAutomation(mHandlerThread.getLooper(), new UiAutomationConnection());
mUiAutomation.connect();
}
use of android.app.UiAutomation in project android_frameworks_base by ResurrectionRemix.
the class DumpCommand method run.
@Override
public void run(String[] args) {
File dumpFile = DEFAULT_DUMP_FILE;
boolean verboseMode = true;
for (String arg : args) {
if (arg.equals("--compressed"))
verboseMode = false;
else if (!arg.startsWith("-")) {
dumpFile = new File(arg);
}
}
UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
automationWrapper.connect();
if (verboseMode) {
// default
automationWrapper.setCompressedLayoutHierarchy(false);
} else {
automationWrapper.setCompressedLayoutHierarchy(true);
}
// do a wait for idle in case the app is busy.
try {
UiAutomation uiAutomation = automationWrapper.getUiAutomation();
uiAutomation.waitForIdle(1000, 1000 * 10);
AccessibilityNodeInfo info = uiAutomation.getRootInActiveWindow();
if (info == null) {
System.err.println("ERROR: null root node returned by UiTestAutomationBridge.");
return;
}
Display display = DisplayManagerGlobal.getInstance().getRealDisplay(Display.DEFAULT_DISPLAY);
int rotation = display.getRotation();
Point size = new Point();
display.getSize(size);
AccessibilityNodeInfoDumper.dumpWindowToFile(info, dumpFile, rotation, size.x, size.y);
} catch (TimeoutException re) {
System.err.println("ERROR: could not get idle state.");
return;
} finally {
automationWrapper.disconnect();
}
System.out.println(String.format("UI hierchary dumped to: %s", dumpFile.getAbsolutePath()));
}
use of android.app.UiAutomation in project android_frameworks_base by crdroidandroid.
the class DumpCommand method run.
@Override
public void run(String[] args) {
File dumpFile = DEFAULT_DUMP_FILE;
boolean verboseMode = true;
for (String arg : args) {
if (arg.equals("--compressed"))
verboseMode = false;
else if (!arg.startsWith("-")) {
dumpFile = new File(arg);
}
}
UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
automationWrapper.connect();
if (verboseMode) {
// default
automationWrapper.setCompressedLayoutHierarchy(false);
} else {
automationWrapper.setCompressedLayoutHierarchy(true);
}
// do a wait for idle in case the app is busy.
try {
UiAutomation uiAutomation = automationWrapper.getUiAutomation();
uiAutomation.waitForIdle(1000, 1000 * 10);
AccessibilityNodeInfo info = uiAutomation.getRootInActiveWindow();
if (info == null) {
System.err.println("ERROR: null root node returned by UiTestAutomationBridge.");
return;
}
Display display = DisplayManagerGlobal.getInstance().getRealDisplay(Display.DEFAULT_DISPLAY);
int rotation = display.getRotation();
Point size = new Point();
display.getSize(size);
AccessibilityNodeInfoDumper.dumpWindowToFile(info, dumpFile, rotation, size.x, size.y);
} catch (TimeoutException re) {
System.err.println("ERROR: could not get idle state.");
return;
} finally {
automationWrapper.disconnect();
}
System.out.println(String.format("UI hierchary dumped to: %s", dumpFile.getAbsolutePath()));
}
use of android.app.UiAutomation in project android_frameworks_base by crdroidandroid.
the class UiAutomationShellWrapper method connect.
public void connect() {
if (mHandlerThread.isAlive()) {
throw new IllegalStateException("Already connected!");
}
mHandlerThread.start();
mUiAutomation = new UiAutomation(mHandlerThread.getLooper(), new UiAutomationConnection());
mUiAutomation.connect();
}
Aggregations