mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-20 20:09:11 +00:00
Framework/Uiauto: Add support for Applaunch
This commit is contained in:
parent
ac5741136d
commit
6cc4021017
@ -0,0 +1,54 @@
|
||||
/* 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.wa.uiauto;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.test.uiautomator.UiObject;
|
||||
|
||||
/**
|
||||
* ApplaunchInterface.java
|
||||
* Interface used for enabling uxperfapplaunch workload.
|
||||
* This interface gets implemented by all workloads that support application launch
|
||||
* instrumentation.
|
||||
*/
|
||||
|
||||
public interface ApplaunchInterface {
|
||||
|
||||
/**
|
||||
* Sets the launchEndObject of a workload, which is a UiObject that marks
|
||||
* the end of the application launch.
|
||||
*/
|
||||
public UiObject getLaunchEndObject();
|
||||
|
||||
/**
|
||||
* Runs the Uiautomation methods for clearing the initial run
|
||||
* dialogues on the first time installation of an application package.
|
||||
*/
|
||||
public void runApplicationSetup() throws Exception;
|
||||
|
||||
/**
|
||||
* Provides the application launch command of the application which is
|
||||
* constructed as a string from the workload.
|
||||
*/
|
||||
public String getLaunchCommand();
|
||||
|
||||
/** Passes the workload parameters. */
|
||||
public void setWorkloadParameters(Bundle parameters);
|
||||
|
||||
/** Initialize the instrumentation for the workload */
|
||||
public void initialize_instrumentation();
|
||||
|
||||
}
|
@ -85,7 +85,7 @@ public class BaseUiAutomation {
|
||||
SystemClock.sleep(second * 1000);
|
||||
}
|
||||
|
||||
//Generate a package ID
|
||||
// Generate a package ID
|
||||
public String getPackageID(Bundle parameters) {
|
||||
String packageName = parameters.getString("package_name");
|
||||
return packageName + ":id/";
|
||||
|
@ -0,0 +1,35 @@
|
||||
/* 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.wa.uiauto;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
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_name");
|
||||
if (activityName.equals("None")) {
|
||||
launchCommand = String.format("am start --user -3 %s", packageName);
|
||||
}
|
||||
else {
|
||||
launchCommand = String.format("am start --user -3 -n %s/%s", packageName, activityName);
|
||||
}
|
||||
return launchCommand;
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user