1 /* 2 * Copyright (C) 2013 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 package com.android.tradefed.build; 18 19 import com.android.tradefed.device.DeviceNotAvailableException; 20 import com.android.tradefed.device.ITestDevice; 21 22 /** 23 * A {@link IBuildProvider} that uses information from a {@link ITestDevice} to retrieve a build. 24 * <p/> 25 * The typical use case for this interface is a build provider that fetches different kinds of 26 * builds based on the device type. It is not recommended to perform actions in a BuildProvider that 27 * modify a device's state. 28 * <p/> 29 * Implementing this interface will cause TF framework to call the {@link #getBuild(ITestDevice)} 30 * method instead of {@link IBuildProvider#getBuild()}. 31 */ 32 public interface IDeviceBuildProvider extends IBuildProvider { 33 34 /** 35 * Retrieve the data for build under test 36 * 37 * @param device the {@link ITestDevice} allocated for test 38 * @return the {@link IBuildInfo} for build under test or <code>null</code> if no build is 39 * available for testing 40 * @throws BuildRetrievalError if build info failed to be retrieved due to an unexpected error 41 * @throws DeviceNotAvailableException if device became unavailable for testing 42 */ getBuild(ITestDevice device)43 public IBuildInfo getBuild(ITestDevice device) throws BuildRetrievalError, 44 DeviceNotAvailableException; 45 46 } 47