1 /* 2 * Copyright (C) 2010 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.device; 17 18 /** 19 * Interface for recovering a device that has gone offline. 20 */ 21 public interface IDeviceRecovery { 22 23 /** 24 * Attempt to recover the given device that can no longer be communicated with. 25 * <p/> 26 * Method should block and only return when device is in requested state. 27 * 28 * @param monitor the {@link IDeviceStateMonitor} to use. 29 * @param recoverUntilOnline if true, method should return as soon as device is online on adb. 30 * If false, method should block until device is fully available for testing (ie 31 * {@link IDeviceStateMonitor#waitForDeviceAvailable()} succeeds. 32 * @throws DeviceNotAvailableException if device could not be recovered 33 */ recoverDevice(IDeviceStateMonitor monitor, boolean recoverUntilOnline)34 public void recoverDevice(IDeviceStateMonitor monitor, boolean recoverUntilOnline) 35 throws DeviceNotAvailableException; 36 37 /** 38 * Attempt to recover the given unresponsive device in recovery mode. 39 * 40 * @param monitor the {@link IDeviceStateMonitor} to use. 41 * @throws DeviceNotAvailableException if device could not be recovered 42 */ recoverDeviceRecovery(IDeviceStateMonitor monitor)43 public void recoverDeviceRecovery(IDeviceStateMonitor monitor) 44 throws DeviceNotAvailableException; 45 46 /** 47 * Attempt to recover the given unresponsive device in bootloader mode. 48 * 49 * @param monitor the {@link IDeviceStateMonitor} to use. 50 * @throws DeviceNotAvailableException if device could not be recovered 51 */ recoverDeviceBootloader(IDeviceStateMonitor monitor)52 public void recoverDeviceBootloader(IDeviceStateMonitor monitor) 53 throws DeviceNotAvailableException; 54 55 /** 56 * Attempt to recover the given unresponsive device in fastbootd mode. 57 * 58 * @param monitor the {@link IDeviceStateMonitor} to use. 59 * @throws DeviceNotAvailableException if device could not be recovered 60 */ recoverDeviceFastbootd(final IDeviceStateMonitor monitor)61 public void recoverDeviceFastbootd(final IDeviceStateMonitor monitor) 62 throws DeviceNotAvailableException; 63 64 /** 65 * Sets the path to the fastboot binary to be used. 66 * 67 * @param fastbootPath a {@link String} defining the path to the fastboot binary. 68 */ setFastbootPath(String fastbootPath)69 public default void setFastbootPath(String fastbootPath) { 70 // empty by default for implementation that do not require fastboot. 71 } 72 } 73