1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.tradefed.targetprep; 17 18 import com.android.tradefed.build.IBuildInfo; 19 import com.android.tradefed.device.DeviceNotAvailableException; 20 import com.android.tradefed.device.ITestDevice; 21 22 /** 23 * Cleans up the target device after the test run has finished. 24 * <p/> 25 * For example, removes software, collects metrics, remove temporary files etc. 26 * <p/> 27 * Note that multiple {@link ITargetCleaner}s can be specified in a configuration. 28 */ 29 public interface ITargetCleaner extends ITargetPreparer { 30 31 /** 32 * Perform the target cleanup/teardown after testing. 33 * 34 * @param device the {@link ITestDevice} to prepare. 35 * @param buildInfo data about the build under test. 36 * @param e if the invocation ended with an exception, this will be the exception that was 37 * caught at the Invocation level. Otherwise, will be <code>null</code>. 38 * @throws DeviceNotAvailableException if device became unresponsive 39 */ tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e)40 public void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e) 41 throws DeviceNotAvailableException; 42 } 43