Java Code Examples for android.app.Instrumentation#getUiAutomation()

The following examples show how to use android.app.Instrumentation#getUiAutomation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UiDevice.java    From za-Farmer with MIT License 5 votes vote down vote up
/** Private constructor. Clients should use {@link UiDevice#getInstance(Instrumentation)}. */
private UiDevice(Instrumentation instrumentation) {
    mInstrumentation = instrumentation;
    UiAutomation uiAutomation = instrumentation.getUiAutomation();
    mUiAutomationBridge = new InstrumentationUiAutomatorBridge(
            instrumentation.getContext(), uiAutomation);

    // Enable multi-window support for API level 21 and up
    if (UiDevice.API_LEVEL_ACTUAL >= Build.VERSION_CODES.LOLLIPOP) {
        // Subscribe to window information
        AccessibilityServiceInfo info = uiAutomation.getServiceInfo();
        info.flags |= AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS;
        uiAutomation.setServiceInfo(info);
    }
}
 
Example 2
Source File: AtraceLogger.java    From android-test with Apache License 2.0 4 votes vote down vote up
private AtraceLogger(Instrumentation instrumentation) {
  uiAutomation = instrumentation.getUiAutomation();
}