Test device system readiness before opening.
Interface
/* Copyright (C) The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "Licens
E ");
* You are not a use this file except in compliance with the License. * Obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * unless required by a Pplicable law or agreed to in writing, software * Distributed under the License are distributed on a "as is" BASIS, * WI
Thout 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.android.tradefed.targetprep;
Import Com.android.tradefed.build.IBuildInfo;
Import com.android.tradefed.device.DeviceNotAvailableException;
Import Com.android.tradefed.device.ITestDevice;
/** * Prepares the test environment for the test run.
* <p/> * For example, installs software, tweaks env settings for testing, launches targets etc. * <p/> * notE that multiple {@link Itargetpreparer} can specified in a configuration.
It is recommended *, Itargetpreparer clearly document its expected environment Pre-setup and Post-setup. * e.g. a itargetpreparer, configures a device for testing must is run after the itargetpreparer * that installs SOFTW
Is.
*/public interface Itargetpreparer {/** * Perform the target setup for testing.
* * @param device the {@link itestdevice} to prepare.
* @param buildinfo data about the build under test. * @throws Targetsetuperror If fatal error occurred setting up environment * @throws devicenotavailableexception if de
Vice became unresponsive */public void setUp (Itestdevice device, Ibuildinfo buildinfo) throws Targetsetuperror,
Builderror, devicenotavailableexception;
}
One way: Setup (), such as installing a system, installing an APK, or any other installation transaction that is a case requirement, should be done in this method.
Implementation Class
/* Copyright (C) The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "Licens
E ");
* You are not a use this file except in compliance with the License. * Obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * unless required by a Pplicable law or agreed to in writing, software * Distributed under the License are distributed on a "as is" BASIS, * WI
Thout 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.android.tradefed.targetprep;
Import Com.android.ddmlib.Log;
Import Com.android.tradefed.build.IBuildInfo;
Import Com.android.tradefed.device.ITestDevice;
/** * Placeholder Empty implementation of a {@link itargetpreparer}. */public class Stubtargetpreparer implements Itargetpreparer {/** * {@inheritDoc} */@Override PU Blic void SetUp (ITeStdevice device, Ibuildinfo buildinfo) throws Targetsetuperror {log.d ("targetpreparer", "skipping target prepare
Step ");
}
}
The method in this class is to print a word, do not do any processing. But if you really want to meet your specific needs, write a class that inherits from that interface.