android.app.UiAutomation Java Examples

The following examples show how to use android.app.UiAutomation. 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 JsDroidCmd with Mozilla Public License 2.0 6 votes vote down vote up
public void initialize(ShellUiAutomatorBridge uiAutomatorBridge) {
	mUiAutomationBridge = uiAutomatorBridge;
	// 监听activity变化,用于getAct
	try {
		IActivityManager am = ActivityManagerNative.getDefault();
		am.setActivityController(new DummyActivityController());
	} catch (RemoteException e) {
	}
	UiAutomation uiAutomation = uiAutomatorBridge.getUiAutomation();
	uiAutomation
			.setOnAccessibilityEventListener(new OnAccessibilityEventListener() {
				public void onAccessibilityEvent(AccessibilityEvent event) {
					synchronized (onAccessibilityEventListeners) {
						for (OnAccessibilityEventListener listener : onAccessibilityEventListeners) {
							listener.onAccessibilityEvent(event);
						}
					}
				}
			});
}
 
Example #2
Source File: JsSystem.java    From JsDroidCmd with Mozilla Public License 2.0 6 votes vote down vote up
static void connectUiautomation() {
	try {
		// 配置空闲等待时间
		Configurator.getInstance().setWaitForIdleTimeout(0);
		// 配置空闲等待间隔
		Configurator.getInstance().setWaitForSelectorTimeout(0);
		// 连接uiautomation服务
		UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
		automationWrapper.connect();
		UiAutomation uiAutomation = automationWrapper.getUiAutomation();
		// 初始化UiDevice
		UiDevice.getInstance().initialize(
				new ShellUiAutomatorBridge(uiAutomation));
		deviceInfo.canConnectUiautomation = true;
	} catch (Throwable e) {
	}
}
 
Example #3
Source File: WifiManagerSnippet.java    From mobly-bundled-snippets with Apache License 2.0 6 votes vote down vote up
/**
 * Elevates permission as require for proper wifi controls.
 *
 * Starting in Android Q (29), additional restrictions are added for wifi operation. See
 * below Android Q privacy changes for additional details.
 * https://developer.android.com/preview/privacy/camera-connectivity
 *
 * @throws Throwable if failed to cleanup connection with UiAutomation
 */
private void adaptShellPermissionIfRequired() throws Throwable {
    if (mContext.getApplicationContext().getApplicationInfo().targetSdkVersion >= 29
        && Build.VERSION.SDK_INT >= 29) {
      Log.d("Elevating permission require to enable support for wifi operation in Android Q+");
      UiAutomation uia = InstrumentationRegistry.getInstrumentation().getUiAutomation();
      uia.adoptShellPermissionIdentity();
      try {
        Class<?> cls = Class.forName("android.app.UiAutomation");
        Method destroyMethod = cls.getDeclaredMethod("destroy");
        destroyMethod.invoke(uia);
      } catch (NoSuchMethodException
          | IllegalAccessException
          | ClassNotFoundException
          | InvocationTargetException e) {
              throw new WifiManagerSnippetException("Failed to cleaup Ui Automation", e);
      }
    }
}
 
Example #4
Source File: ServerInstrumentation.java    From appium-uiautomator2-server with Apache License 2.0 6 votes vote down vote up
private void setAccessibilityServiceState() {
    String disableSuppressAccessibilityService = InstrumentationRegistry.getArguments().getString("DISABLE_SUPPRESS_ACCESSIBILITY_SERVICES");
    if (disableSuppressAccessibilityService == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
        return;
    }

    boolean shouldDisableSuppressAccessibilityService = Boolean.parseBoolean(disableSuppressAccessibilityService);
    if (shouldDisableSuppressAccessibilityService) {
        Configurator.getInstance().setUiAutomationFlags(
                UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES);
    } else {
        // We can disable UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
        // only when we set the value as zero
        Configurator.getInstance().setUiAutomationFlags(0);
    }
}
 
Example #5
Source File: UicdDevice.java    From android-uiconductor with Apache License 2.0 6 votes vote down vote up
/** Returns a list containing the root {@link AccessibilityNodeInfo}s for each active window */
@TargetApi(VERSION_CODES.LOLLIPOP)
public static Set<AccessibilityNodeInfo> getWindowRoots() {
  Set<AccessibilityNodeInfo> roots = new HashSet();
  // Start with the active window, which seems to sometimes be missing from the list returned
  // by the UiAutomation.
  UiAutomation uiAutomation = getUiAutomation();

  AccessibilityNodeInfo activeRoot = uiAutomation.getRootInActiveWindow();
  if (activeRoot != null) {
    roots.add(activeRoot);
  }

  // Support multi-window searches for API level 21 and up.
  for (AccessibilityWindowInfo window : uiAutomation.getWindows()) {
    AccessibilityNodeInfo root = window.getRoot();
    Log.i(TAG, String.format("Getting Layer: %d", window.getLayer()));
    if (root == null) {
      Log.w(TAG, String.format("Skipping null root node for window: %s", window.toString()));
      continue;
    }
    roots.add(root);
  }

  return roots;
}
 
Example #6
Source File: UiDevice.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public int getDisplayUnRotationHeight() {
	int rotation = getDisplayRotation();
	if (rotation == UiAutomation.ROTATION_FREEZE_0
			|| rotation == UiAutomation.ROTATION_FREEZE_180) {
		return getDisplayHeight();
	} else {
		return getDisplayWidth();
	}
}
 
Example #7
Source File: UiDevice.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public int getDisplayUnRotationWidth() {
	int rotation = getDisplayRotation();
	if (rotation == UiAutomation.ROTATION_FREEZE_0
			|| rotation == UiAutomation.ROTATION_FREEZE_180) {
		return getDisplayWidth();
	} else {
		return getDisplayHeight();
	}
}
 
Example #8
Source File: UiDevice.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Check if the device is in its natural orientation. This is determined by
 * checking if the orientation is at 0 or 180 degrees.
 * 
 * @return true if it is in natural orientation
 * @since API Level 17
 */
public boolean isNaturalOrientation() {
	Tracer.trace();
	waitForIdle();
	int ret = getAutomatorBridge().getRotation();
	return ret == UiAutomation.ROTATION_FREEZE_0
			|| ret == UiAutomation.ROTATION_FREEZE_180;
}
 
Example #9
Source File: UiDevice.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public String waitToast(final String pkg, final long timeout) {
	final StringBuffer result = new StringBuffer();
	final Runnable emptyRunnable = new Runnable() {
		@Override
		public void run() {
		}
	};
	final UiAutomation.AccessibilityEventFilter checkWindowUpdate = (UiAutomation.AccessibilityEventFilter) new UiAutomation.AccessibilityEventFilter() {
		public boolean accept(final AccessibilityEvent event) {
			if (event.getEventType() == 64) {
				final String sourcePackageName = (String) event
						.getPackageName();
				if (sourcePackageName.equals(pkg)) {
					final Parcelable parcelable = event.getParcelableData();
					if (!(parcelable instanceof Notification)) {
						final String toastMsg = (String) event.getText()
								.get(0);
						if (toastMsg != null) {
							result.append(toastMsg);
						}
						return true;
					}
				}
			}
			return false;
		}
	};
	try {
		this.getAutomatorBridge()
				.executeCommandAndWaitForAccessibilityEvent(emptyRunnable,
						checkWindowUpdate, timeout);
	} catch (TimeoutException ex) {
	} catch (Exception ex2) {
	}
	return result.toString();
}
 
Example #10
Source File: UiAutomationShellWrapper.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public void connect() throws Exception {
	if (mHandlerThread.isAlive()) {
		throw new Exception("Already connected!");
	}
	mHandlerThread.start();
	mUiAutomation = new UiAutomation(mHandlerThread.getLooper(),
			new UiAutomationConnection());
	mUiAutomation.connect();

}
 
Example #11
Source File: UiAutomatorBridge.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public UiAutomatorBridge(UiAutomation uiAutomation) {
	mUiAutomation = uiAutomation;
	mInteractionController = new InteractionController(this);
	mQueryController = new QueryController(this);
	// 打开web增强
	setWebMode(false);
	// 关闭高速模式
	setFastMode(true);
}
 
Example #12
Source File: DisableAnimationsRule.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public Statement apply(Statement base, Description description) {
  return new Statement() {

    @Override
    public void evaluate() throws Throwable {
      UiAutomation uiAutomation = getInstrumentation().getUiAutomation();
      uiAutomation.executeShellCommand("settings put global window_animation_scale 0");
      uiAutomation.executeShellCommand("settings put global transition_animation_scale 0");
      uiAutomation.executeShellCommand("settings put global animator_duration_scale 0");
      base.evaluate();
    }
  };
}
 
Example #13
Source File: MyPermissionRequester.java    From pasm-yolov3-Android with GNU General Public License v3.0 5 votes vote down vote up
public static void request(String... permissions) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        UiAutomation auto = InstrumentationRegistry.getInstrumentation().getUiAutomation();
        String cmd = "pm grant " + InstrumentationRegistry.getTargetContext().getPackageName() + " %1$s";
        String cmdTest = "pm grant " + InstrumentationRegistry.getContext().getPackageName() + " %1$s";
        String currCmd;
        for (String perm : permissions) {
            execute(String.format(cmd, perm), auto);
            execute(String.format(cmdTest, perm), auto);
        }
    }
    //GrantPermissionRule.grant(permissions);
}
 
Example #14
Source File: PermissiveTestRule.java    From permissive with Apache License 2.0 5 votes vote down vote up
private void grantAllPermissions() {
  Context context = InstrumentationRegistry.getTargetContext();
  try {
    PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
    UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
    for (int i = 0; i < packageInfo.requestedPermissions.length; ++i) {
      if ((packageInfo.requestedPermissionsFlags[i] & PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0) {
        grantReal(uiAutomation, packageInfo.requestedPermissions[i]);
      }
    }
  } catch (PackageManager.NameNotFoundException e) {
    Log.w(TAG, "packageInfo not found for: " + context.getPackageName());
  }
}
 
Example #15
Source File: PermissiveTestRule.java    From permissive with Apache License 2.0 5 votes vote down vote up
private static void grantReal(UiAutomation automation, String permission) {
  try {
    String targetPackageName = InstrumentationRegistry.getTargetContext().getPackageName();
    ParcelFileDescriptor pfn = automation.executeShellCommand("pm grant " + targetPackageName + " " + permission);
    pfn.close();
  } catch (IOException e) {
    Log.w(TAG, e);
  }
}
 
Example #16
Source File: NotificationListener.java    From android-uiautomator-server with MIT License 5 votes vote down vote up
@Override
public void run() {
    while (!stopLooping) {
        AccessibilityEvent accessibilityEvent = null;
        //return true if the AccessibilityEvent type is NOTIFICATION type
        UiAutomation.AccessibilityEventFilter eventFilter = new UiAutomation.AccessibilityEventFilter() {
            @Override
            public boolean accept(AccessibilityEvent event) {
                return event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
            }
        };
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                // Not performing any event.
            }
        };
        try {
            //wait for AccessibilityEvent filter
            accessibilityEvent = Device.getInstance().getUiAutomation()
                    .executeAndWaitForEvent(runnable /*executable event*/, eventFilter /* event to filter*/, 500 /*time out in ms*/);
        } catch (Exception ignore) {}

        if (accessibilityEvent != null) {
            toastMessages.addAll(accessibilityEvent.getText());
        }
    }
}
 
Example #17
Source File: UiDevice.java    From za-Farmer with MIT License 5 votes vote down vote up
/**
 * Check if the device is in its natural orientation. This is determined by checking if the
 * orientation is at 0 or 180 degrees.
 * @return true if it is in natural orientation
 * @since API Level 17
 */
public boolean isNaturalOrientation() {
    Tracer.trace();
    waitForIdle();
    int ret = getAutomatorBridge().getRotation();
    return ret == UiAutomation.ROTATION_FREEZE_0 ||
            ret == UiAutomation.ROTATION_FREEZE_180;
}
 
Example #18
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 #19
Source File: MainActivityTest.java    From effective_android_sample with Apache License 2.0 4 votes vote down vote up
public void testAirplaneModeToOn() {
  UiAutomation uiAutomation = getInstrumentation().getUiAutomation();
  // Activityの起動を監視するリスナーをセット
  mMainLaunched = false;
  uiAutomation
      .setOnAccessibilityEventListener(new OnAccessibilityEventListener() {
        @Override
        public void onAccessibilityEvent(AccessibilityEvent event) {
          if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED) {
            // ウィンドウのコンテンツが変わった
            if (TARGET_PKG.equals(event.getPackageName())) {
              // MainActivityが起動した
              mMainLaunched = true;
            }
          }
        }
      });

  // MainActivity起動
  Activity target = launchActivity(TARGET_PKG, MainActivity.class, null);
  try {
    // MainActivity起動待ち
    do {
      Thread.sleep(1000);
    } while (!mMainLaunched);

    // 機内モードをOnにする
    // Settingsの起動
    Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getInstrumentation().getContext().startActivity(intent);

    // Settingsの起動待ち
    AccessibilityNodeInfo root;
    while (true) {
      root = uiAutomation.getRootInActiveWindow();
      if (root != null && SETTINGS_PKG.equals(root.getPackageName())) {
        break;
      } else {
        Thread.sleep(1000);
      }
    }

    // ボタンを押す
    List<AccessibilityNodeInfo> list = root
        .findAccessibilityNodeInfosByViewId("android:id/list");
    AccessibilityNodeInfo listViewInfo = list.get(0);
    AccessibilityNodeInfo airplaneModeView = listViewInfo.getChild(0);
    List<AccessibilityNodeInfo> checkList = airplaneModeView
        .findAccessibilityNodeInfosByViewId("android:id/checkbox");
    AccessibilityNodeInfo airplaneModeCheck = checkList.get(0);
    if (!airplaneModeCheck.isChecked()) {
      airplaneModeView.performAction(AccessibilityNodeInfo.ACTION_CLICK);
    }

    // Backキーを押してSettingsの終了
    uiAutomation.performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);

    // 機内モード反映待ち
    Thread.sleep(10000);

    // TextViewの文字列検証
    String expected = target
        .getString(org.techbooster.uiautomationsample.R.string.airplane_mode_off);
    TextView textView = (TextView) target
        .findViewById(org.techbooster.uiautomationsample.R.id.text_view);
    assertEquals(expected, textView.getText().toString());

  } catch (Exception e) {
    fail(e.getMessage());
    e.printStackTrace();
  } finally {
    if (target != null) {
      target.finish();
    }
  }
}
 
Example #20
Source File: UiAutomatorBridge.java    From za-Farmer with MIT License 4 votes vote down vote up
UiAutomatorBridge(UiAutomation uiAutomation) {
    mUiAutomation = uiAutomation;
    mInteractionController = new InteractionController(this);
    mQueryController = new QueryController(this);
}
 
Example #21
Source File: MyUiDevice.java    From PUMA with Apache License 2.0 4 votes vote down vote up
public void setUiAutomation(UiAutomation uiauto) {
	this.mAutomation = uiauto;
}
 
Example #22
Source File: MyUiDevice.java    From PUMA with Apache License 2.0 4 votes vote down vote up
public UiAutomation getUiAutomation() {
	return this.mAutomation;
}
 
Example #23
Source File: MyUiAutomatorTestRunner.java    From PUMA with Apache License 2.0 4 votes vote down vote up
/**
 * Called after all test classes are in place, ready to test
 */
protected void start() {
	TestCaseCollector collector = getTestCaseCollector(this.getClass().getClassLoader());
	try {
		collector.addTestClasses(mTestClasses);
	} catch (ClassNotFoundException e) {
		// will be caught by uncaught handler
		throw new RuntimeException(e.getMessage(), e);
	}
	if (mDebug) {
		Debug.waitForDebugger();
	}
	mHandlerThread = new HandlerThread(HANDLER_THREAD_NAME);
	mHandlerThread.setDaemon(true);
	mHandlerThread.start();
	UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
	automationWrapper.connect();

	long startTime = SystemClock.uptimeMillis();
	TestResult testRunResult = new TestResult();
	ResultReporter resultPrinter;
	String outputFormat = mParams.getString("outputFormat");
	List<TestCase> testCases = collector.getTestCases();
	Bundle testRunOutput = new Bundle();
	if ("simple".equals(outputFormat)) {
		resultPrinter = new SimpleResultPrinter(System.out, true);
	} else {
		resultPrinter = new WatcherResultPrinter(testCases.size());
	}
	try {
		automationWrapper.setRunAsMonkey(mMonkey);
		mUiDevice = MyUiDevice.getInstance();
		UiAutomation uiAutomation = automationWrapper.getUiAutomation();
		mUiDevice.initialize(new ShellUiAutomatorBridge(uiAutomation));
		mUiDevice.setUiAutomation(uiAutomation);

		String traceType = mParams.getString("traceOutputMode");
		if (traceType != null) {
			Tracer.Mode mode = Tracer.Mode.valueOf(Tracer.Mode.class, traceType);
			if (mode == Tracer.Mode.FILE || mode == Tracer.Mode.ALL) {
				String filename = mParams.getString("traceLogFilename");
				if (filename == null) {
					throw new RuntimeException("Name of log file not specified. " + "Please specify it using traceLogFilename parameter");
				}
				Tracer.getInstance().setOutputFilename(filename);
			}
			Tracer.getInstance().setOutputMode(mode);
		}

		// add test listeners
		testRunResult.addListener(resultPrinter);
		// add all custom listeners
		for (TestListener listener : mTestListeners) {
			testRunResult.addListener(listener);
		}

		// run tests for realz!
		for (TestCase testCase : testCases) {
			prepareTestCase(testCase);
			testCase.run(testRunResult);
		}
	} catch (Throwable t) {
		// catch all exceptions so a more verbose error message can be outputted
		resultPrinter.printUnexpectedError(t);
	} finally {
		long runTime = SystemClock.uptimeMillis() - startTime;
		resultPrinter.print(testRunResult, runTime, testRunOutput);
		automationWrapper.disconnect();
		automationWrapper.setRunAsMonkey(false);
		mHandlerThread.quit();
	}
}
 
Example #24
Source File: JsDroidEvent.java    From JsDroidCmd with Mozilla Public License 2.0 4 votes vote down vote up
public static Point toOriginPoint(int x, int y) {
	int rotation = UiDevice.getInstance().getRotation();
	int width = UiDevice.getInstance().getDisplayWidth();
	int height = UiDevice.getInstance().getDisplayHeight();
	int rWidth = xmax() - xmin();
	int rHeight = ymax() - ymin();
	int tempx = 0;
	int tempy = 0;
	int tempWidth = 0;
	int tempHeight = 0;
	// 将xy旋转回来
	switch (rotation) {
	case UiAutomation.ROTATION_FREEZE_0:

		break;
	case UiAutomation.ROTATION_FREEZE_90:
		// 原来的x = 现在的y,原来的y = 现在的宽度-现在的x
		tempx = y;
		tempy = width - x;
		x = tempx;
		y = tempy;
		tempWidth = height;
		tempHeight = width;
		break;
	case UiAutomation.ROTATION_FREEZE_180:
		// 原来的x = 现在的宽度-现在的x,原来的y=现在的高度-现在的y
		tempx = width - x;
		tempy = height - y;
		x = tempx;
		y = tempy;
		break;
	case UiAutomation.ROTATION_FREEZE_270:
		// 原来的x = 现在的高度-现在的y,原来的y=现在的x
		tempx = height - y;
		tempy = x;
		x = tempx;
		y = tempy;
		tempWidth = height;
		tempHeight = width;
		width = tempWidth;
		height = tempHeight;
		break;
	}
	// 缩放到驱动坐标
	x = (x * rWidth / width);
	y = (y * rHeight / height);
	return new Point(x, y);
}
 
Example #25
Source File: BitmapUtil.java    From JsDroidCmd with Mozilla Public License 2.0 4 votes vote down vote up
public static Bitmap takeScreenshot(int rotation, int screenWidth,
		int screenHeight) {
	Display display = DisplayManagerGlobal.getInstance().getRealDisplay(
			Display.DEFAULT_DISPLAY);
	Point displaySize = new Point();
	display.getRealSize(displaySize);
	final int displayWidth = screenWidth;
	final int displayHeight = screenHeight;
	final float screenshotWidth;
	final float screenshotHeight;
	switch (rotation) {
	case UiAutomation.ROTATION_FREEZE_0: {
		screenshotWidth = displayWidth;
		screenshotHeight = displayHeight;
	}
		break;
	case UiAutomation.ROTATION_FREEZE_90: {
		screenshotWidth = displayHeight;
		screenshotHeight = displayWidth;
	}
		break;
	case UiAutomation.ROTATION_FREEZE_180: {
		screenshotWidth = displayWidth;
		screenshotHeight = displayHeight;
	}
		break;
	case UiAutomation.ROTATION_FREEZE_270: {
		screenshotWidth = displayHeight;
		screenshotHeight = displayWidth;
	}
		break;
	default: {
		return null;
	}
	}

	Bitmap screenShot = null;
	try {
		screenShot = SurfaceControl.screenshot((int) screenshotWidth,
				(int) screenshotHeight);
		if (screenShot == null) {
			return null;
		}
	} catch (Exception re) {
		return null;
	}
	if (rotation != UiAutomation.ROTATION_FREEZE_0) {
		Bitmap unrotatedScreenShot = Bitmap.createBitmap(displayWidth,
				displayHeight, Bitmap.Config.ARGB_8888);
		Canvas canvas = new Canvas(unrotatedScreenShot);
		canvas.translate(unrotatedScreenShot.getWidth() / 2,
				unrotatedScreenShot.getHeight() / 2);
		canvas.rotate(getDegreesForRotation(rotation));
		canvas.translate(-screenshotWidth / 2, -screenshotHeight / 2);
		canvas.drawBitmap(screenShot, 0, 0, null);
		canvas.setBitmap(null);
		screenShot.recycle();
		screenShot = unrotatedScreenShot;
	}
	// Optimization
	screenShot.setHasAlpha(false);
	return screenShot;
}
 
Example #26
Source File: InstrumentationHook.java    From AtlasForAndroid with MIT License 4 votes vote down vote up
@TargetApi(18)
public UiAutomation getUiAutomation() {
    return this.mBase.getUiAutomation();
}
 
Example #27
Source File: InstrumentationHook.java    From ACDD with MIT License 4 votes vote down vote up
@Override
@TargetApi(18)
public UiAutomation getUiAutomation() {
    return this.mBase.getUiAutomation();
}
 
Example #28
Source File: InstrumentationDelegate.java    From container with GNU General Public License v3.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@Override
public UiAutomation getUiAutomation() {
	return base.getUiAutomation();
}
 
Example #29
Source File: UiAutomationConnectionWrapper.java    From test-butler with Apache License 2.0 4 votes vote down vote up
private UiAutomationConnectionWrapper(Method disconnectMethod, UiAutomation uiAutomation, HandlerThread thread) {
    this.disconnectMethod = disconnectMethod;
    this.uiAutomation = uiAutomation;
    this.thread = thread;
}
 
Example #30
Source File: UiAutomatorBridge.java    From appium-uiautomator2-server with Apache License 2.0 4 votes vote down vote up
public UiAutomation getUiAutomation() {
    return (UiAutomation) invoke(method(UiDevice.class, "getUiAutomation"), Device.getUiDevice());
}