1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 11:58:55 +00:00

Add UiAutoUtils class

UiAutoUtility class added to support utility functions used for UiAutomation.
This class can help in refactoring some existing fucntionalities into utility functions.

Launch command generation is added as a utility class method which can be used
by workloads to construct their launch command from parameters passed.
This commit is contained in:
jummp01 2017-01-31 17:44:51 +00:00
parent 4ce20e2d3f
commit 99b46b4630
2 changed files with 36 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,36 @@
/* Copyright 2013-2016 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arm.wlauto.uiauto;
import android.os.Bundle;
import java.util.logging.Logger;
public final class UiAutoUtils {
/** Construct launch command of an application. */
public static String createLaunchCommand(Bundle parameters) {
String launchCommand;
String activityName = parameters.getString("launch_activity");
String packageName = parameters.getString("package");
if (activityName.equals("None")) {
launchCommand = String.format("am start %s", packageName);
}
else {
launchCommand = String.format("am start -n %s/%s", packageName, activityName);
}
return launchCommand;
}
}