1 /* 2 * Copyright (C) 2011 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 17 18 package com.android.tradefed.targetprep; 19 20 import com.android.tradefed.build.IDeviceBuildInfo; 21 import com.android.tradefed.device.DeviceNotAvailableException; 22 import com.android.tradefed.device.ITestDevice; 23 24 import java.util.Collection; 25 26 /** 27 * Installs tests from a tests zip file (as outputted by the build system) on 28 * a device. 29 */ 30 public interface ITestsZipInstaller { 31 32 /** 33 * Pushes the contents of the tests.zip file onto the device's data partition. 34 * 35 * @param device the {@link ITestDevice} to flash, assumed to be in adb mode. 36 * @param deviceBuild the {@link IDeviceBuildInfo} that contains the tests zip to flash 37 * @throws DeviceNotAvailableException 38 * @throws TargetSetupError 39 */ pushTestsZipOntoData(ITestDevice device, IDeviceBuildInfo deviceBuild)40 public void pushTestsZipOntoData(ITestDevice device, IDeviceBuildInfo deviceBuild) 41 throws DeviceNotAvailableException, TargetSetupError; 42 43 /** 44 * Sets the list of paths under {@code /data} to avoid clearing. 45 * 46 * @param skipList the list of directories to skip. 47 * <p /> 48 * Note that the granularity of the skip list is direct children of {@code /data}. 49 * 50 * @see #deleteData 51 */ setDataWipeSkipList(Collection<String> skipList)52 public void setDataWipeSkipList(Collection<String> skipList); 53 54 /** 55 * Sets the list of paths under {@code /data} to avoid clearing. 56 * 57 * @param skipList the list of directories to skip. 58 * <p /> 59 * Note that the granularity of the skip list is direct children of {@code /data}. 60 * 61 * @see #deleteData 62 */ setDataWipeSkipList(String... skipList)63 public void setDataWipeSkipList(String... skipList); 64 65 /** 66 * Removes all of the files/directories from {@code /data} on the specified device, with the 67 * exception of those excluded by the skip list. 68 * <p/> 69 * Implementation will stop the runtime on device. It is highly recommended to reboot the device 70 * upon completion of this method. 71 * 72 * @param device The {@link ITestDevice} to act on 73 * @see #setDataWipeSkipList 74 */ deleteData(ITestDevice device)75 public void deleteData(ITestDevice device) throws DeviceNotAvailableException, TargetSetupError; 76 77 } 78