Remove reference to UiObjectNotFoundException that are never thrown
Change-Id: I3a558238e8d2c9b9b3f1faa33ea2d65927de6d64
diff --git a/libraries/launcher-helper/src/android/support/test/launcherhelper/AospLauncherStrategy.java b/libraries/launcher-helper/src/android/support/test/launcherhelper/AospLauncherStrategy.java
index fe03817..a9009ee 100644
--- a/libraries/launcher-helper/src/android/support/test/launcherhelper/AospLauncherStrategy.java
+++ b/libraries/launcher-helper/src/android/support/test/launcherhelper/AospLauncherStrategy.java
@@ -20,7 +20,6 @@
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import android.widget.Button;
import android.widget.TextView;
@@ -43,7 +42,7 @@
* {@inheritDoc}
*/
@Override
- public void open() throws UiObjectNotFoundException {
+ public void open() {
// if we see hotseat, assume at home screen already
if (!mDevice.hasObject(HOTSEAT)) {
mDevice.pressHome();
@@ -62,7 +61,7 @@
* {@inheritDoc}
*/
@Override
- public UiObject2 openAllApps(boolean reset) throws UiObjectNotFoundException {
+ public UiObject2 openAllApps(boolean reset) {
// if we see apps container, skip the opening step, only ensure that the "Apps" tab is
// selected
if (!mDevice.hasObject(APPS_CONTAINER)) {
@@ -100,7 +99,7 @@
* {@inheritDoc}
*/
@Override
- public UiObject2 openAllWidgets(boolean reset) throws UiObjectNotFoundException {
+ public UiObject2 openAllWidgets(boolean reset) {
boolean needReset = true;
// if we see apps container, skip the opening step, only ensure that the "Widgets" tab is
// selected
@@ -147,7 +146,7 @@
* {@inheritDoc}
*/
@Override
- public boolean launch(String appName, String packageName) throws UiObjectNotFoundException {
+ public boolean launch(String appName, String packageName) {
return CommonLauncherHelper.getInstance(mDevice).launchApp(this,
By.res("").clazz(TextView.class).desc(appName), packageName);
}
diff --git a/libraries/launcher-helper/src/android/support/test/launcherhelper/CommonLauncherHelper.java b/libraries/launcher-helper/src/android/support/test/launcherhelper/CommonLauncherHelper.java
index f06ee4b..de1776d 100644
--- a/libraries/launcher-helper/src/android/support/test/launcherhelper/CommonLauncherHelper.java
+++ b/libraries/launcher-helper/src/android/support/test/launcherhelper/CommonLauncherHelper.java
@@ -21,7 +21,6 @@
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import android.util.Log;
@@ -59,10 +58,8 @@
* Scrolls a container back to the beginning
* @param container
* @param backDirection
- * @throws UiObjectNotFoundException
*/
- public void scrollBackToBeginning(UiObject2 container, Direction backDirection)
- throws UiObjectNotFoundException {
+ public void scrollBackToBeginning(UiObject2 container, Direction backDirection) {
scrollBackToBeginning(container, backDirection, MAX_SCROLL_ATTEMPTS);
}
@@ -71,10 +68,8 @@
* @param container
* @param backDirection
* @param maxAttempts
- * @throws UiObjectNotFoundException
*/
- public void scrollBackToBeginning(UiObject2 container, Direction backDirection, int maxAttempts)
- throws UiObjectNotFoundException {
+ public void scrollBackToBeginning(UiObject2 container, Direction backDirection, int maxAttempts) {
int attempts = 0;
while (container.fling(backDirection)) {
attempts++;
@@ -91,10 +86,8 @@
* @param app
* @param container
* @param dir
- * @throws UiObjectNotFoundException
*/
- private void ensureIconVisible(BySelector app, UiObject2 container, Direction dir)
- throws UiObjectNotFoundException {
+ private void ensureIconVisible(BySelector app, UiObject2 container, Direction dir) {
UiObject2 appIcon = mDevice.findObject(app);
Rect appR = appIcon.getVisibleBounds();
Rect containerR = container.getVisibleBounds();
@@ -125,10 +118,9 @@
* @param app
* @param packageName
* @return
- * @throws UiObjectNotFoundException
*/
public boolean launchApp(ILauncherStrategy launcherStrategy, BySelector app,
- String packageName) throws UiObjectNotFoundException {
+ String packageName) {
return launchApp(launcherStrategy, app, packageName, MAX_SCROLL_ATTEMPTS);
}
@@ -140,11 +132,9 @@
* @param packageName
* @param maxScrollAttempts
* @return
- * @throws UiObjectNotFoundException
*/
public boolean launchApp(ILauncherStrategy launcherStrategy, BySelector app,
- String packageName, int maxScrollAttempts)
- throws UiObjectNotFoundException {
+ String packageName, int maxScrollAttempts) {
Direction dir = launcherStrategy.getAllAppsScrollDirection();
// attempt to find the app icon if it's not already on the screen
if (!mDevice.hasObject(app)) {
diff --git a/libraries/launcher-helper/src/android/support/test/launcherhelper/GoogleExperienceLauncherStrategy.java b/libraries/launcher-helper/src/android/support/test/launcherhelper/GoogleExperienceLauncherStrategy.java
index dec36fd..bd92b8b 100644
--- a/libraries/launcher-helper/src/android/support/test/launcherhelper/GoogleExperienceLauncherStrategy.java
+++ b/libraries/launcher-helper/src/android/support/test/launcherhelper/GoogleExperienceLauncherStrategy.java
@@ -20,7 +20,6 @@
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import android.util.Log;
import android.widget.TextView;
@@ -55,7 +54,7 @@
* {@inheritDoc}
*/
@Override
- public void open() throws UiObjectNotFoundException {
+ public void open() {
// if we see hotseat, assume at home screen already
if (!mDevice.hasObject(HOTSEAT)) {
mDevice.pressHome();
@@ -84,7 +83,7 @@
* {@inheritDoc}
*/
@Override
- public UiObject2 openAllApps(boolean reset) throws UiObjectNotFoundException {
+ public UiObject2 openAllApps(boolean reset) {
// if we see all apps container, skip the opening step
if (!mDevice.hasObject(APPS_CONTAINER)) {
open();
@@ -115,7 +114,7 @@
* {@inheritDoc}
*/
@Override
- public UiObject2 openAllWidgets(boolean reset) throws UiObjectNotFoundException {
+ public UiObject2 openAllWidgets(boolean reset) {
if (!mDevice.hasObject(WIDGETS_CONTAINER)) {
open();
// trigger the wallpapers/widgets/settings view
@@ -145,7 +144,7 @@
* {@inheritDoc}
*/
@Override
- public boolean launch(String appName, String packageName) throws UiObjectNotFoundException {
+ public boolean launch(String appName, String packageName) {
BySelector app = By.res(LAUNCHER_PKG, "icon").clazz(TextView.class).desc(appName);
return CommonLauncherHelper.getInstance(mDevice).launchApp(this, app, packageName);
}
diff --git a/libraries/launcher-helper/src/android/support/test/launcherhelper/ILauncherStrategy.java b/libraries/launcher-helper/src/android/support/test/launcherhelper/ILauncherStrategy.java
index 891bbc7..301bd1b 100644
--- a/libraries/launcher-helper/src/android/support/test/launcherhelper/ILauncherStrategy.java
+++ b/libraries/launcher-helper/src/android/support/test/launcherhelper/ILauncherStrategy.java
@@ -19,7 +19,6 @@
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.UiObjectNotFoundException;
/**
* Defines the common use cases a launcher UI automation helper should fulfill.
@@ -43,17 +42,15 @@
/**
* Shows the home screen of launcher
- * @throws UiObjectNotFoundException
*/
- public void open() throws UiObjectNotFoundException;
+ public void open();
/**
* Opens the all apps drawer of launcher
* @param reset if the all apps drawer should be reset to the beginning
* @return {@link UiObject2} representation of the all apps drawer
- * @throws UiObjectNotFoundException
*/
- public UiObject2 openAllApps(boolean reset) throws UiObjectNotFoundException;
+ public UiObject2 openAllApps(boolean reset);
/**
* Returns a {@link BySelector} describing the all apps drawer
@@ -71,9 +68,8 @@
* Opens the all widgets drawer of launcher
* @param reset if the all widgets drawer should be reset to the beginning
* @return {@link UiObject2} representation of the all widgets drawer
- * @throws UiObjectNotFoundException
*/
- public UiObject2 openAllWidgets(boolean reset) throws UiObjectNotFoundException;
+ public UiObject2 openAllWidgets(boolean reset);
/**
* Returns a {@link BySelector} describing the all widgets drawer
@@ -107,7 +103,6 @@
* performed.
* @return <code>true</code> if application is verified to be in foreground after launch, or the
* verification is skipped; <code>false</code> otherwise.
- * @throws UiObjectNotFoundException
*/
- public boolean launch(String appName, String packageName) throws UiObjectNotFoundException;
+ public boolean launch(String appName, String packageName);
}