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 package com.android.tradefed.device;
18 
19 import com.android.ddmlib.IDevice;
20 import com.android.tradefed.util.ConditionPriorityBlockingQueue.IMatcher;
21 
22 import java.util.Collection;
23 import java.util.Map;
24 
25 /**
26  * Interface for device selection criteria.
27  */
28 public interface IDeviceSelection extends IMatcher<IDevice> {
29 
30     /**
31      * Gets a copy of the serial numbers
32      *
33      * @param device The {@link IDevice} representing the device considered for selection.
34      * @return a {@link Collection} of serial numbers
35      */
getSerials(IDevice device)36     public Collection<String> getSerials(IDevice device);
37 
38     /**
39      * Gets a copy of the serial numbers exclusion list
40      *
41      * @return a {@link Collection} of serial numbers
42      */
getExcludeSerials()43     public Collection<String> getExcludeSerials();
44 
45     /**
46      * Gets a copy of the product type list
47      *
48      * @return a {@link Collection} of product types
49      */
getProductTypes()50     public Collection<String> getProductTypes();
51 
52     /**
53      * Returns a map of the property list
54      *
55      * @return a {@link Map} of device property names to values
56      */
getProperties()57     public Map<String, String> getProperties();
58 
59     /**
60      * @return <code>true</code> if an emulator has been requested
61      */
emulatorRequested()62     public boolean emulatorRequested();
63 
64     /**
65      * @return <code>true</code> if a device has been requested
66      */
deviceRequested()67     public boolean deviceRequested();
68 
69     /**
70      * @return <code>true</code> if an stub emulator has been requested. A stub emulator is a
71      *         placeholder to be used when config has to launch an emulator.
72      */
stubEmulatorRequested()73     public boolean stubEmulatorRequested();
74 
75     /**
76      * @return <code>true</code> if a null device (aka no device required) has been requested
77      */
nullDeviceRequested()78     public boolean nullDeviceRequested();
79 
80     /**
81      * Gets the given devices product type
82      *
83      * @param device the {@link IDevice}
84      * @return the device product type or <code>null</code> if unknown
85      */
getDeviceProductType(IDevice device)86     public String getDeviceProductType(IDevice device);
87 
88     /**
89      * Gets the given devices product variant
90      *
91      * @param device the {@link IDevice}
92      * @return the device product variant or <code>null</code> if unknown
93      */
getDeviceProductVariant(IDevice device)94     public String getDeviceProductVariant(IDevice device);
95 
96     /**
97      * Retrieves the battery level for the given device
98      *
99      * @param device the {@link IDevice}
100      * @return the device battery level or <code>null</code> if unknown
101      */
getBatteryLevel(IDevice device)102     public Integer getBatteryLevel(IDevice device);
103 
104     /**
105      * Set the serial numbers inclusion list, replacing any existing values.
106      */
setSerial(String... serialNumber)107     public void setSerial(String... serialNumber);
108 
109 }
110