• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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.config;
17 
18 import com.android.tradefed.build.IBuildProvider;
19 import com.android.tradefed.device.IDeviceRecovery;
20 import com.android.tradefed.device.IDeviceSelection;
21 import com.android.tradefed.device.TestDeviceOptions;
22 import com.android.tradefed.targetprep.ITargetPreparer;
23 
24 import java.util.List;
25 
26 /**
27  * Device Configuration Holder Interface.
28  * Use to represent an object that can hold the information for the configuration of a device.
29  */
30 public interface IDeviceConfiguration {
31 
32     /** Returns The Name of the device specified in the field "name" of the configuration. */
getDeviceName()33     public String getDeviceName();
34 
35     /** Returns whether the container is for a Device Under Test or not. */
isFake()36     public boolean isFake();
37 
38     /**
39      * Return The list of all the configuration objects held the instance of
40      * {@link IDeviceConfiguration}
41      */
getAllObjects()42     public List<Object> getAllObjects();
43 
44     /**
45      * Return The list of all the configuration objects held the instance of {@link
46      * IDeviceConfiguration} that match the configuration type requested.
47      */
getAllObjectOfType(String configType)48     public List<Object> getAllObjectOfType(String configType);
49 
50     /**
51      * Pass one of the allowed objects that the Configuration Holder can keep track of.
52      * <p>
53      * Complete list of allowed objects are: {@link IBuildProvider}, {@link ITargetPreparer},
54      * {@link IDeviceRecovery}, {@link IDeviceSelection}, {@link TestDeviceOptions}
55      *
56      * @param config object from a type above.
57      * @throws ConfigurationException in case the object passed doesn't match the allowed types.
58      */
addSpecificConfig(Object config)59     public void addSpecificConfig(Object config) throws ConfigurationException;
60 
61     /**
62      * Keep track of the frequency of the object so we can properly inject option against it.
63      *
64      * @param config the object we are tracking the frequency.
65      * @param frequency frequency associated with the object.
66      */
addFrequency(Object config, Integer frequency)67     public void addFrequency(Object config, Integer frequency);
68 
69     /** Returns the frequency of the object. */
getFrequency(Object config)70     public Integer getFrequency(Object config);
71 
72     /** Return {@link IBuildProvider} that the device configuration holder has reference to. */
getBuildProvider()73     public IBuildProvider getBuildProvider();
74 
75     /**
76      * Return a list of {@link ITargetPreparer} that the device configuration holder has.
77      */
getTargetPreparers()78     public List<ITargetPreparer> getTargetPreparers();
79 
80     /**
81      * Return {@link IDeviceRecovery} that the device configuration holder has.
82      */
getDeviceRecovery()83     public IDeviceRecovery getDeviceRecovery();
84 
85     /**
86      * Return {@link TestDeviceOptions} that the device configuration holder has.
87      */
getDeviceOptions()88     public TestDeviceOptions getDeviceOptions();
89 
90     /**
91      * Return {@link IDeviceSelection} that the device configuration holder has.
92      */
getDeviceRequirements()93     public IDeviceSelection getDeviceRequirements();
94 
95     /**
96      * Return a shallow copy of this {@link IDeviceConfiguration} object.
97      */
clone()98     public IDeviceConfiguration clone();
99 }
100